summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2022-07-21 10:24:09 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2022-07-21 16:48:44 +0200
commit19fccc15871cbfcbb79e872b3c4d1540a16f7013 (patch)
tree9f24e178d63334dfcf9bed95818eda6fc567649d /src/input_handler.cc
parent559af669c77a3b3b6de0376f177ebbba5ebd0328 (diff)
Compute prompt completion only from characters left of the cursor
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).
Diffstat (limited to 'src/input_handler.cc')
0 files changed, 0 insertions, 0 deletions