| Age | Commit message (Collapse) | Author |
|
The general is_horizontal_blank supports various unicode blanks,
but passing an utf8 continuation byte to it can lead to surprising
results as we can match with 0xA0 (when char is unsigned).
Fixes #5250
|
|
Since shell-script-completions now runs the script asynchronously
and unconditionally, there is no use for the CompletionFlags::Fast
anymore which means we can remove that type altogether.
|
|
Refactor ShellManager and pipe to feed lines from the buffer directly,
this should reduce memory use when piping big chunks of buffers.
The pipe output is still provided as a single big buffer.
|
|
Lots of code includes buffer_utils.hh just for write_to_debug_buffer
which pulls many unnecessary dependencies. Reorganise to reduce
compile times.
|
|
This make the completer lifetime tied to the Prompt mode and removes
the need for the Start flag. It also makes it possible to cleanup
on completer destruction.
|
|
|
|
This should fix a bug in lint.kak though I didn't check.
|
|
Since clang-16 there has been a regression in the P0522R0 support.
(Bug report at https://github.com/llvm/llvm-project/issue/63281)
Closes #4892
|
|
|
|
%exp{...} just expands its content the same way double quoted strings
do, but using a named expansion type makes it possible to use the
more quoting mechanism to avoid quoting hell.
|
|
Including this here because grandparent parent commit broke completions
for "edit -fifo".
|
|
|
|
The command line "hook -group xyz " should get scope completions but
it actually gets hook completions because "xyz" is wrongly interpreted
as positional argument.
Fix this by using the parameters parser to compute positional
arguments.
Fixes #4840
|
|
This is trickier than expected because ModuleLoaded hooks can (as
any other hooks) use arbitrary regular expressions for their filter.
Fixes #4841
|
|
|
|
Recently, switch completion were given the menu behavior.
Unfortunately this breaks cases like
:echo -- -mark<ret>
where the hypothetical user wanted to actually display "-mark", not
"-markup".
Simply bail if there is a double-dash. This is not fully correct,
for example it wrongly disables switch completion on
echo -to-file -- -
but that's minor, we can fix it later.
In future, we should reuse the ParametersParser when computing completions,
which will obsolete this workaround.
|
|
|
|
|
|
If I type
:echo -mx
I get no completions, even when I move the cursor on the x.
If I replace the x with a k, I get a completion "-markup".
The odd thing is that if I accept the completion while the cursor is
on the k, then the commandline will be
:echo markupk
Evidently, the characters under cursor (x/k) influence the completion
(actually all letters right of the cursor do), but they are not
incorporated in the final result, which is weird.
I think there are two consistent behaviors:
1. Compute completions only from characters left of the cursor. We already
do this in insert mode completion, and when completing the command name
in a prompt.
2. Compute completions from the whole token, and when accepting a completion,
replace the whole token.
Most readline-style completion systems out there implement 1. A
notable exception is fish's tab-completion. I think we should stick
to 1 because it's more predictable and familiar. Do that.
This allows us to get rid of a special case for completing command
names, because the new behavior subsumes it.
In fact, I think this would allow us to get rid of most "pos_in_token"
or "cursor_pos" completer parameters. I believe the only place where we
it's actually different from the end of the query is in "shell-script"
completers, where we expose "$kak_pos_in_token". I think we can still
remove that parameter and just cut the commandline at the cursor
position before passing it to a "shell-script" completer. Then we
also don't need "$kak_token_to_complete" (but we can still keep
expose them for backwards compatibility).
|
|
This adds completions for
:echo "%val{
|
|
We already use the menu behavior in complete_command_name(); let's do
the same for switches, since we can complete all valid inputs and
it can save a Tab key in some scenarios.
CommandManager::complete is fairly complex. We can't expect callers
to add the menu bit when appropriate, so we currently do it here.
|
|
The next commit will give switch completions the menu behavior, so this
is necessary so we can still type "echo --" without an auto-expansion
to "echo -to-file".
|
|
|
|
Fixes #4625
Fixes #4209
Fixes #4040
|
|
Fixes #4601
|
|
This fixes a crash when using kak-lsp with bash-language-server. The
issue is that the second read() in parse_quoted may read past the end of
the string. If this happens and the condition on line 126 is false,
then the loop on line 119 will continue to read past the end of the
buffer since it checks for state.pos != end instead of state.pos < end,
which will likely result in a crash. The fix is to add a check for the
buffer end before the second read. The added test fails without the
change and passes with the change.
|
|
This makes it possible to change command completion in hooks and
paves the way to more flexibility in how custom commands can be
completed
|
|
|
|
Use CTAD instead of make functions, requires instead of enable_if
|
|
Commit 2289f350 ("Remove command parsing Reader and just track a
ParserState") introduced a small regression in parse_percent_token()
because we failed to recognize a token like %val{ as percent-expansion.
I tried to add a test case but a UI test doesn't seem possible, e.g.
kak -ui json -e "exec ':echo %opt{<tab>}<ret>'"
prints: 'exec': option not found: ''
|
|
This seems to slightly improve parse speed which is where kakoune
spends most of its time during startup.
|
|
The Reader abstraction was leading to suboptimal code by encouraging
decoding utf8 separately from advancing to next codepoint.
|
|
Instead of return a vector, take the target vector as a parameter
and push tokens to it.
|
|
We can move that data instead of copying
|
|
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.
|
|
|
|
This fixes an issue where completion would still be provided after
the closing character of a token, which could then get frustrating
combined with auto-insertion of completions.
For example, inserting `%{<newline>}` for a command-completed token
(such as the commands for a hook) would still trigger completion right
after the `}` and that completion would get auto-inserted **replacing**
that closing `}`.
|
|
Different approach than the one suggested by eraserhd
Closes $4095
|
|
Quote by wrapping in quotes if we are replacing the whole token,
using backspaces if the completion only adds to it.
This ensure that the inserted completion will be correctly parsed
once validated.
Fixes #4121
|
|
It turns out the fix for #4061 was breaking auto-selection with
space of command names.
|
|
Only requote when completion is replacing the whole token
Do not requote command names as they should not require it, tag
them as quoted.
Fixes #4061
|
|
Fixes #4042
|
|
This makes it possible to keep significant EOL in shell expansions (e.g.
for use with clipboard helpers).
|
|
Fixes #3849 Again
|
|
The menu flag signifies that only the completions are valid arguments,
hence it makes sense to auto insert the best one on space.
Because full match is always considered the best match in completion
ranking, this should always have a reasonable behaviour.
This makes it harder to enter a hidden command, but completion can
always be disabled via <c-o> or by quoting in those rare cases.
|
|
|
|
distinguish the loading from loaded state, detect recursive loading.
|
|
|
|
|
|
Reduce the amount of decoding by working directly on
bytes.
Fixes #3388
|