Commit Graph

448 Commits

Author SHA1 Message Date
Maxime Coste
ffb02222c3 Merge remote-tracking branch 'krobelus/c-n-autocomplete' 2022-02-15 20:51:11 +11:00
Johannes Altmanninger
43fc5b0078 Make <c-n> show completion menu again when autocomplete is off
As pointed out in [1], when insert mode autocomplete is disabled,
<c-n> could be used to activate insert mode completions temporarily
[2].  This regressed in 6f7c5aed (Do not show custom completions when
autocomplete is off, 2022-01-03). Fix this by enabling completions
on <c-n>/<c-p>. This allows us to remove a special case for explicit
completers.

Alternative behavior (future?): make <c-n> toggle completion like
<c-o>.  This can be done today, as suggested by Screwtape on IRC:

	map global insert <c-n> %{<c-o><c-n><a-;>:toggle-ctrl-n<ret>}
	define-command toggle-ctrl-n %{
		hook global InsertCompletionShow .* %{ map window insert <c-n> <c-n> }
		hook global InsertCompletionHide .* %{ unmap window insert <c-n> <c-n> }
	}

[1] https://github.com/mawww/kakoune/pull/4493#issuecomment-1031189823
[2] <c-n> completion only lives for the lifetime of the completion
    menu, whereas <c-o> lasts until you exit insert mode. This means
    that autocompletion is much more convenient than <c-n> or <c-x>f,
    because those require an explicit completion request for each
    path component.
2022-02-07 14:52:51 +01:00
Johannes Altmanninger
a4953c59ce Enable test/regression/0-autocomplete-overrules-completers
test/run skips directories without the "cmd" file, so it doesn't run
this test.  Fix this by adding an empty "cmd", like elsewhere.
2022-02-07 14:52:51 +01:00
Maxime Coste
33e81af0f3 Fix regex alternation execution priority
The ThreadedRegexVM implementation does not execute split opcodes as
expected: on split the pending thread is pushed on top of the thread
stack, which means that when multiple splits are executed in a row
(such as with a disjunction with 3 or more branches) the last split
target gets on top of the thread stack and gets executed next (when the
thread from the first split target would be the expected one)

Fixing this in the ThreadedRegexVM would have a performance impact as
we would not be able to use a plain stack for current threads, so the
best solution at the moment is to reverse the order of splits generated
by a disjunction.

Fixes #4519
2022-02-02 14:51:17 +11:00
Maxime Coste
4bd34caf4f Fix modified keys not being mappable in goto mode
The test was invalid, non-codepoint keys should be considered mappable.

Fixes #4521
2022-02-01 13:36:36 +11:00
Maxime Coste
6f135c0c8e Do not insert any end-of-line when piping data out
This will unfortunately break some use case which will require
using wrapper scripts to add the necessary newline. It is however
harder to do the contrary, and it makes a lot of other use case
possible, such as checksuming.

Fixes #3669
2022-01-24 21:53:33 +11:00
Johannes Altmanninger
6f7c5aed10 Do not show custom completions when autocomplete is off
As reported in [1], completions provided by "set global completers
option=my_completion" activate insert mode autocompletion, even when
the autocomplete option does not have the insert mode flag.

This happens because InsertCompleter::on_option_changed() calls
InsertCompleter::setup_ifn(), which shows the completion pager.
Fix this by computing whether the completion pager is enabled;
otherwise we can return early from setup_ifn().
The completion pager is enabled if the autocompletion bit is set,
or if the user has requested explicit completion.

[1]: https://github.com/kak-lsp/kak-lsp/issues/585
2022-01-09 20:23:51 +01:00
Maxime Coste
f68e8313b2 Fix invalid line joining logic with multiple selection per line
Fixes #4476
2021-12-20 09:13:53 +11:00
Sidharth Kshatriya
83e53ea83a OpenBSD sh compat workaround: Move & within subshell invocation. Also see #2955 2021-12-17 11:59:18 +05:30
Sidharth Kshatriya
e013385a58 The enabled check was actually was not being run by the test infrastructure.
Now that it is, we get the following error when trying to execute
`test/compose/select-display-columns`

```sh
./enabled: 2: [: 4: unexpected operator
```

This commit fixes the enabled check
2021-12-14 16:54:50 +05:30
Sidharth Kshatriya
4d3a057a03 Bug: The enabled test checks, though they exist are never actually run
Fix by copying the `enabled` check file, if it exists to where the tests are being run
2021-12-14 16:53:41 +05:30
Sidharth Kshatriya
7c8595c5ee Use grep -E as OpenBSD grep does not like | in regexp otherwise 2021-12-14 15:27:27 +05:30
Maxime Coste
6029ee9815 Fix explicit line completion
trim_indent call was incorrect, trim_indent is intended to work
on multi-line strings and trims trailing whitespace as well (could
benefit from a better name).

Fixes #4378
2021-12-11 09:34:51 +11:00
Maxime Coste
7648d56fc3 Fix parsing nul bytes in regex
Fixes #4460
2021-12-11 09:01:03 +11:00
Sidharth Kshatriya
9be2a1f170 Remove .kak_history file that seems to have been committed by mistake 2021-11-02 15:28:39 +05:30
Maxime Coste
8299d1da1f Fix pasting all from empty register
Raise an error if the register is empty for paste-all

Fixes #4414
2021-11-01 09:05:57 +11:00
Maxime Coste
05fb07fbc6 Add tests for <a-p>/<a-P>/<a-R> 2021-09-30 20:12:48 +10:00
Maxime Coste
133cb9053a Merge remote-tracking branch 'hugomg/better-lua-indentation' 2021-09-29 20:25:15 +10:00
Hugo Musso Gualandi
25a0fe8f58 lua.kak: Add test cases for unindent 2021-09-26 11:54:43 -03:00
Hugo Musso Gualandi
c26fb65ed1 lua.kak: Add some test cases, and also fix a bug 2021-09-26 11:19:58 -03:00
Frank LENORMAND
e4d6952d8c src: Show a readonly modeline tag when relevant 2021-09-21 12:59:30 +03:00
Maxime Coste
3fc8e29d10 Add support for curly underline and separate underline color
Add support for a third color in face definition that controls
the underline and a 'c' attribute for curly underline (that takes
precedence over 'u' if both are specified)

Allow empty colors to mean default, so that `,,red+u` means the
same as `default,default,red+u`

Fixes #4138
2021-09-07 08:21:26 +10:00
Maxime Coste
40e3614cf4 Prevent overwriting existing file in :write <explicit filename>
Add a -force (equivalent to w!) switch that enables overwriting.
2021-07-20 22:30:41 +10:00
Maxime Coste
be9b2de0ee Only compute command coordinates when necessary
Tracking the line/column of each token takes a surprising big part
of the command parsing logic runtime and is only necessary when we
hit an error.
2021-06-24 17:20:37 +10:00
Maxime Coste
8fdda6d980 Merge remote-tracking branch 'greenfork/improve-elixir-hooks' 2021-06-15 20:48:06 +10:00
Dmitry Matveyev
4e94bf0e41 Event better tests for comments 2021-06-06 14:27:39 +06:00
Dmitry Matveyev
8574c3827a Event better tests for comments 2021-06-06 14:25:06 +06:00
Dmitry Matveyev
0b1654b0cf Better comment inserting tests and fix implementation 2021-06-06 14:13:34 +06:00
Dmitry Matveyev
167cffb3da Better comment inserting tests and fix implementation 2021-06-06 14:08:40 +06:00
Dmitry Matveyev
785f7fe9ed Add more tests for "do" auto-insert 2021-06-06 01:34:09 +06:00
Dmitry Matveyev
8867e40929 Fix elixir copying comment # sign
Elixir uses # for comments, not --.
Implementation is copied from Nim.
2021-06-06 01:32:56 +06:00
Dmitry Matveyev
0f49e7375e Add auto-inserting of "end" keyword to Elixir
fixup! Add auto-inserting of "end" keyword to Elixir
2021-06-06 01:32:53 +06:00
Dmitry Matveyev
fcc04384d1 Fix Ruby <ret> mid-comment
Implementation is copied from Nim.
2021-06-06 00:38:36 +06:00
Dmitry Matveyev
02e625e8fb Remove electric behavior for end keyword
Correctly indentint on "end" keyword seems very hard,
it is simpler to remove it. And we already insert "end"
in ruby-insert-on-new-line hook, so the removal shouldn't
hurt too much.
2021-06-06 00:30:50 +06:00
Dmitry Matveyev
148ad6c1ab Add test for electric indentation in Ruby 2021-06-06 00:27:45 +06:00
Skyler Hawthorne
fb04102fe3 add TODO comment highlighting 2021-05-02 20:38:42 -04:00
Skyler Hawthorne
4bff607758 add tests for rust let statements 2021-05-01 00:46:27 -04:00
Skyler Hawthorne
a25ef2bd6d fix rust pub highlight 2021-05-01 00:35:56 -04:00
Maxime Coste
e04cc1b4c8 Fix rust highlighting tests 2021-04-30 12:41:37 +10:00
Maxime Coste
6f56f02924 Restore previous line-compose test 2021-04-18 16:27:15 +10:00
Tw
41833d7b7d fix line completion with prefix
There's a bug in current line completion, fix it.

Signed-off-by: Tw <tw19881113@gmail.com>
2021-04-11 11:54:48 +08:00
Maxime Coste
5696ed02e4 Fix invalid insertion of ; after } closing some functions
Function taking a parameter with a struct tag on the last line
before the opening { were wrongly treated as structs. Add some
additional regex logic to try to catch those cases.

Fixes #4136
2021-04-08 20:14:02 +10:00
SeerLite
e84dd80244 rc markdown: Fix trailing whitespace removal
Modified the test cases accordingly too
2021-04-01 22:27:30 -03:00
Maxime Coste
835eaf5495 Merge remote-tracking branch 'pickfire/rust-indent' 2021-03-11 07:51:08 +11:00
Ivan Tham
ebe7f82bb2 Support rust visibility for enum and others 2021-03-07 14:22:43 +08:00
Ivan Tham
8df5621334 Support dedent with rust fn qualifiers 2021-03-07 14:12:01 +08:00
Jacob Collins
66787e3b53 Add test for selecting horizontal whitespace 2021-02-25 11:03:18 -05:00
Ivan Tham
4e594e034a Dedent rust await function with ? 2021-02-17 01:17:17 +08:00
Ivan Tham
049591f6b4 Dedent rust empty match 2021-02-17 01:17:14 +08:00
Maxime Coste
978dfe4bdf Fix splitting display line in front of a replaced range
When a replaced buffer range atom was starting exactly at the
location we wanted to split onto the code would split *after*
that atom instead of before.

Fixes #4052
2021-02-16 12:35:25 +11:00