From 43fc5b0078db48583f1222d8b9b96ba87f2e8fc7 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 7 Feb 2022 13:31:56 +0100 Subject: Make show completion menu again when autocomplete is off As pointed out in [1], when insert mode autocomplete is disabled, 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 /. This allows us to remove a special case for explicit completers. Alternative behavior (future?): make toggle completion like . This can be done today, as suggested by Screwtape on IRC: map global insert %{:toggle-ctrl-n} define-command toggle-ctrl-n %{ hook global InsertCompletionShow .* %{ map window insert } hook global InsertCompletionHide .* %{ unmap window insert } } [1] https://github.com/mawww/kakoune/pull/4493#issuecomment-1031189823 [2] completion only lives for the lifetime of the completion menu, whereas lasts until you exit insert mode. This means that autocompletion is much more convenient than or f, because those require an explicit completion request for each path component. --- src/insert_completer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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& keystrokes) { + m_enabled = true; if (not setup_ifn()) return; @@ -461,7 +462,7 @@ void InsertCompleter::select(int index, bool relative, Vector& 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; -- cgit v1.2.3