summaryrefslogtreecommitdiff
path: root/src/insert_completer.cc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2022-02-07 13:31:56 +0100
committerJohannes Altmanninger <aclopte@gmail.com>2022-02-07 14:52:51 +0100
commit43fc5b0078db48583f1222d8b9b96ba87f2e8fc7 (patch)
tree2c7a168a6933219c8dab679bffd1e7f9992b1b79 /src/insert_completer.cc
parenta4953c59ce53c2238f37e4c911abec60250d73c0 (diff)
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.
Diffstat (limited to 'src/insert_completer.cc')
-rw-r--r--src/insert_completer.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/insert_completer.cc b/src/insert_completer.cc
index f32b35ca..8f67f155 100644
--- a/src/insert_completer.cc
+++ b/src/insert_completer.cc
@@ -414,6 +414,7 @@ InsertCompleter::~InsertCompleter()
void InsertCompleter::select(int index, bool relative, Vector<Key>& keystrokes)
{
+ m_enabled = true;
if (not setup_ifn())
return;
@@ -461,7 +462,7 @@ void InsertCompleter::select(int index, bool relative, Vector<Key>& keystrokes)
void InsertCompleter::update(bool allow_implicit)
{
- m_enabled = allow_implicit or m_explicit_completer;
+ m_enabled = allow_implicit;
if (m_explicit_completer and try_complete(m_explicit_completer))
return;