fix: cancel completion on update in automatic completion mode

If completion is automatically triggered (the default), then it also makes
sense to automatically cancel completions in situations where a completion
update would be required and we are *not* expected to automatically
re-trigger.
This commit is contained in:
CJ van den Berg 2026-02-04 16:43:43 +01:00
parent 4a97bd8774
commit e26d86eca3
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 17 additions and 0 deletions

View file

@ -381,6 +381,9 @@ const cmds = struct {
const Result = command.Result;
pub fn update_completion(self: *Type, _: Ctx) Result {
if (tui.config().completion_trigger == .automatic and self.value.editor.get_last_trigger_char() == null)
return tp.self_pid().send(.{ "cmd", "palette_menu_cancel" }) catch |e| self.logger.err(module_name, e);
clear_entries(self);
self.longest_hint = try load_entries(self);
try update_query_text(self, self.value.editor.get_primary().cursor);