home/src
Johannes Altmanninger 19fccc1587 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).
2022-07-21 16:48:44 +02:00
..
.gdbinit Embed gdb pretty-printing script directly into Kakoune binary 2019-01-23 20:27:16 +11:00
alias_registry.cc
alias_registry.hh
array_view.hh Replace std::enable_if with requires 2021-11-21 09:44:56 +11:00
assert.cc Escape message before running xmessage in a shell 2022-06-26 18:07:22 +02:00
assert.hh
backtrace.cc
backtrace.hh
buffer_manager.cc Support opening files bigger than 2 GiB 2021-05-28 17:03:41 +10:00
buffer_manager.hh Remove unnecessary forward declaration 2021-07-20 22:30:41 +10:00
buffer_utils.cc Fix File Buffer flag not being correctly applied 2021-05-28 20:31:28 +10:00
buffer_utils.hh rework selection insert/replace using a for_each method 2021-09-30 20:12:58 +10:00
buffer.cc Distinguish between non-eol max column target and plain max column 2022-07-05 08:43:40 +10:00
buffer.hh Distinguish between non-eol max column target and plain max column 2022-07-05 08:43:40 +10:00
buffer.inl.hh Convert comparisons to spaceship operator 2021-11-21 09:44:56 +11:00
changes.cc
changes.hh Binary search for first range to change 2021-03-08 16:55:43 -05:00
client_manager.cc Move control character escaping responsibility to the terminal UI 2021-08-17 20:40:30 +10:00
client_manager.hh Always redraw after getting some user input 2021-03-11 09:08:35 +11:00
client.cc src: Show a readonly modeline tag when relevant 2021-09-21 12:59:30 +03:00
client.hh Add support for markup in info boxes 2019-11-22 21:50:51 +11:00
clock.hh Remove DurationMs and slight code refactor 2018-12-28 06:27:35 +11:00
color.cc Make Color::validate_alpha() a constexpr function. 2022-02-12 21:35:33 +11:00
color.hh Make Color::validate_alpha() a constexpr function. 2022-02-12 21:35:33 +11:00
command_manager.cc Compute prompt completion only from characters left of the cursor 2022-07-21 16:48:44 +02:00
command_manager.hh Add a complete-command command to configure command completion 2022-03-06 10:13:14 +11:00
commands.cc Improve readability of debug memory command output 2022-07-18 17:39:19 +10:00
commands.hh
completion.cc
completion.hh Restore auto-select on return, add a flag to disable that for commands 2020-11-18 19:56:05 +11:00
constexpr_utils.hh Fix compilation due to failing template deduction for aggregates 2022-04-28 19:34:36 +02:00
context.cc src: Allow ga to skip removed buffers 2021-10-06 08:44:47 +02:00
context.hh src: Allow ga to skip removed buffers 2021-10-06 08:44:47 +02:00
coord.hh Convert comparisons to spaceship operator 2021-11-21 09:44:56 +11:00
diff.hh Remove posB from information given by the diff algorithm 2020-03-20 20:27:50 +11:00
display_buffer.cc Re-work line trimming to fix issues with column highighters 2022-07-13 12:24:14 +10:00
display_buffer.hh Re-work line trimming to fix issues with column highighters 2022-07-13 12:24:14 +10:00
enum.hh Replace std::enable_if with requires 2021-11-21 09:44:56 +11:00
env_vars.cc Do not copy environment strings, just refer to them 2019-03-21 20:43:24 +11:00
env_vars.hh
event_manager.cc Do not select on non-urgent fd when handling only urgent events 2021-03-11 09:02:02 +11:00
event_manager.hh Add support for $kak_command_fifo and $kak_response_fifo 2021-07-07 19:25:06 +10:00
exception.cc
exception.hh
face_registry.cc Faces: Check that underline colour comes before base/attributes markers 2022-02-11 09:35:49 +00:00
face_registry.hh Change faces alias to be a base that can be modified 2019-04-23 23:15:23 +01:00
face.hh Re-work line trimming to fix issues with column highighters 2022-07-13 12:24:14 +10:00
file.cc Only set fd to non-block if there is an EventManager 2022-06-03 15:57:25 +10:00
file.hh Do not keep MappedFile fd opened 2022-02-18 20:24:23 +11:00
flags.hh Replace std::enable_if with requires 2021-11-21 09:44:56 +11:00
hash_map.cc Fix use of removed std::random_shuffle 2019-01-20 22:59:28 +11:00
hash_map.hh Replace std::enable_if with requires 2021-11-21 09:44:56 +11:00
hash.cc Merge branch 'roam-murmurhash-endian' of http://github.com/ppentchev/kakoune 2022-07-10 17:46:07 +10:00
hash.hh Replace std::enable_if with requires 2021-11-21 09:44:56 +11:00
highlighter_group.cc Add -override support to add-highlighter 2020-03-30 21:04:01 +11:00
highlighter_group.hh Rename DefinedHighlighters to SharedHighlighters 2020-08-08 11:19:02 +10:00
highlighter.cc Add -override support to add-highlighter 2020-03-30 21:04:01 +11:00
highlighter.hh Refactor highlighting logic 2022-07-10 14:58:24 +10:00
highlighters.cc Remove out-of-date column computation in show-whitespaces 2022-07-19 22:47:39 +10:00
highlighters.hh Use inplace_merge() for ranges 2021-03-09 10:13:31 -05:00
hook_manager.cc Add a range based remove_if overload 2020-05-29 11:59:03 +10:00
hook_manager.hh Add a RegisterModified hook 2020-07-19 12:56:55 +10:00
input_handler.cc Remove <esc> as end macro recording, Q should be enough 2022-07-05 08:43:40 +10:00
input_handler.hh Split InsertMode into InsertMode and PasteMode 2021-10-10 11:02:09 +11:00
insert_completer.cc Code style cleanups around insert completer 2022-06-04 10:50:09 +10:00
insert_completer.hh Code style cleanups around insert completer 2022-06-04 10:50:09 +10:00
json_ui.cc Add support for curly underline and separate underline color 2021-09-07 08:21:26 +10:00
json_ui.hh Add support for markup in info boxes 2019-11-22 21:50:51 +11:00
json.cc Fix spurious warning likely due to String::Data not being std compliant 2021-12-11 08:44:19 +11:00
json.hh src: Move JSON parsing code to its own file 2019-11-17 09:27:46 +01:00
keymap_manager.cc
keymap_manager.hh src: Fix the API of KeymapManager::add_user_mode() 2021-10-23 10:34:27 +02:00
keys.cc Make Shift+Space insert a space in insert mode 2022-04-16 19:56:26 +02:00
keys.hh Make space a named key to correctly handle shift modifier 2021-12-11 08:12:08 +11:00
line_modification.cc Support opening files bigger than 2 GiB 2021-05-28 17:03:41 +10:00
line_modification.hh Introduce FunctionRef to replace std::function when not storing 2019-09-01 13:04:47 +10:00
main.cc Refactor highlighting logic 2022-07-10 14:58:24 +10:00
Makefile make clean: also clean up generated version files 2022-05-29 10:31:59 +02:00
memory.cc Track more memory statistics 2019-03-21 20:35:22 +11:00
memory.hh always inline custom operator new/delete to avoid spurious warnings 2021-07-26 16:55:36 +10:00
meta.hh
normal.cc Remove <esc> as end macro recording, Q should be enough 2022-07-05 08:43:40 +10:00
normal.hh Add static or const where useful 2019-11-09 12:53:45 -05:00
option_manager.cc Defer deletion of unsetted option to return to main loop 2019-01-20 22:46:40 +11:00
option_manager.hh Add support for removing from options 2020-09-09 21:00:30 +10:00
option_types.cc Use std::remove_cvref instead of std::decay 2021-11-21 09:44:57 +11:00
option_types.hh Replace std::enable_if with requires 2021-11-21 09:44:56 +11:00
option.hh Add support for removing from options 2020-09-09 21:00:30 +10:00
optional.hh Avoid copying token content strings in expand_token 2021-07-09 17:03:22 +10:00
parameters_parser.cc Do not keep a reference to ParametersDesc inside ParameterParser 2019-05-10 23:46:16 +10:00
parameters_parser.hh Stop using deprecated std::iterator 2022-05-21 15:10:03 +02:00
range.hh Refactor how InsetCompletionHide hook parameter is computed 2020-06-27 13:33:50 +10:00
ranges.cc Fix compilation due to failing template deduction for aggregates 2022-04-28 19:34:36 +02:00
ranges.hh Stop using deprecated std::iterator 2022-05-21 15:10:03 +02:00
ranked_match.cc Bug fix: use only iswlower() in RankedMatch::is_word_boundary() 2021-12-14 15:10:01 +05:30
ranked_match.hh
ref_ptr.hh Fix crash when deleting a buffer from a user mapping 2022-04-12 12:49:19 +10:00
regex_impl.cc Fix regex alternation execution priority 2022-02-02 14:51:17 +11:00
regex_impl.hh Fix regex alternation execution priority 2022-02-02 14:51:17 +11:00
regex.cc Try to bypass clang crash 2019-01-20 22:59:28 +11:00
regex.hh Stop using deprecated std::iterator 2022-05-21 15:10:03 +02:00
register_manager.cc Store HistoryRegisters with most recent entry in front 2022-07-05 08:43:40 +10:00
register_manager.hh commands: add "registers" subcommand to :debug 2020-12-23 14:22:44 -08:00
remote.cc Check for buffer overflow when constructing the socket path. 2022-04-07 21:36:15 +10:00
remote.hh Rework session directory logic 2021-05-01 15:29:50 +10:00
safe_ptr.hh Header and dependency cleanup 2019-01-24 21:22:20 +11:00
scope.cc Do not include non-primitive option value in *SetOption hook filter 2020-06-09 21:38:47 +10:00
scope.hh Add override 2019-11-09 12:53:45 -05:00
selection.cc src: Select the data inserted by ! and <a-!> 2022-03-06 10:13:14 +11:00
selection.hh Distinguish between non-eol max column target and plain max column 2022-07-05 08:43:40 +10:00
selectors.cc Distinguish between non-eol max column target and plain max column 2022-07-05 08:43:40 +10:00
selectors.hh Ensure that the capture group actually matched in select_matches 2020-09-22 21:14:40 +10:00
shared_string.cc
shared_string.hh src: Fix undefined behaviour 2021-10-23 10:36:37 +02:00
shell_manager.cc Use strerror to display execve failures 2022-01-24 21:59:16 +11:00
shell_manager.hh Expand env vars as list of strings 2020-03-02 20:53:28 +11:00
string_utils.cc Work around incomplete std::to_chars() support in libstdc++ 10 2022-05-08 14:00:27 +02:00
string_utils.hh Stop using deprecated std::iterator 2022-05-21 15:10:03 +02:00
string.cc Improve code-generation for Strings 2021-07-20 22:30:41 +10:00
string.hh Add a complete-command command to configure command completion 2022-03-06 10:13:14 +11:00
terminal_ui.cc Make space a named key to correctly handle shift modifier 2021-12-11 08:12:08 +11:00
terminal_ui.hh Use DECRQM/DECRPM to detect support for synchronized output 2021-10-23 09:42:31 +11:00
unicode.hh Follow ECMA specification for regex whitespace 2021-02-25 11:03:18 -05:00
unit_tests.cc Remove posB from information given by the diff algorithm 2020-03-20 20:27:50 +11:00
unit_tests.hh
units.hh Try to fix more CI failures related to C++20 2021-11-21 20:16:58 +11:00
user_interface.hh Add support for markup in info boxes 2019-11-22 21:50:51 +11:00
utf8_iterator.hh Convert comparisons to spaceship operator 2021-11-21 09:44:56 +11:00
utf8.hh Rank a word-boundary after a non-word-boundary 2019-09-07 22:53:29 +02:00
utils.hh Clang is still unhappy, trying another approach with defining my own concept 2021-11-25 22:32:10 +11:00
value.hh Use std::remove_cvref instead of std::decay 2021-11-21 09:44:57 +11:00
vector.hh Only redraw updated lines 2021-07-12 10:25:58 +10:00
window.cc Re-work line trimming to fix issues with column highighters 2022-07-13 12:24:14 +10:00
window.hh Fix window_range expansion 2019-12-16 14:09:20 +11:00
word_db.cc Support opening files bigger than 2 GiB 2021-05-28 17:03:41 +10:00
word_db.hh Fix performance issue with word completion 2020-11-07 10:42:51 +11:00