fix: don't auto_find on a single space

This is rarely useful and feels spammy.
This commit is contained in:
CJ van den Berg 2025-12-16 15:07:30 +01:00
parent c6c310b9d0
commit a9ee5321ac
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1496,6 +1496,8 @@ pub fn handle_editor_event(self: *Self, _: tp.pid_ref, m: tp.message) tp.result
const text = editor.get_selection(sel, self.allocator) catch return self.clear_auto_find(editor); const text = editor.get_selection(sel, self.allocator) catch return self.clear_auto_find(editor);
if (text.len == 0) if (text.len == 0)
return self.clear_auto_find(editor); return self.clear_auto_find(editor);
if (text.len == 1 and (text[0] == ' '))
return self.clear_auto_find(editor);
if (!self.is_last_match_text(text)) if (!self.is_last_match_text(text))
tp.self_pid().send(.{ "cmd", "find_query", .{ text, "auto_find" } }) catch return; tp.self_pid().send(.{ "cmd", "find_query", .{ text, "auto_find" } }) catch return;
} }