feat: add option to disable auto find

This commit is contained in:
CJ van den Berg 2025-12-03 15:55:13 +01:00
parent 35aa99f57f
commit d16e64963e
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 2 additions and 0 deletions

View file

@ -30,6 +30,7 @@ modes_can_change_cursor: bool = true,
enable_auto_save: bool = false, enable_auto_save: bool = false,
limit_auto_save_file_types: ?[]const []const u8 = null, // null means *all* limit_auto_save_file_types: ?[]const []const u8 = null, // null means *all*
enable_prefix_keyhints: bool = true, enable_prefix_keyhints: bool = true,
enable_auto_find: bool = true,
indent_size: usize = 4, indent_size: usize = 4,
tab_width: usize = 8, tab_width: usize = 8,

View file

@ -1432,6 +1432,7 @@ pub fn handle_editor_event(self: *Self, _: tp.pid_ref, m: tp.message) tp.result
return self.clear_auto_find(editor); return self.clear_auto_find(editor);
if (try m.match(.{ tp.any, tp.any, tp.extract(&sel.begin.row), tp.extract(&sel.begin.col), tp.extract(&sel.end.row), tp.extract(&sel.end.col) })) { if (try m.match(.{ tp.any, tp.any, tp.extract(&sel.begin.row), tp.extract(&sel.begin.col), tp.extract(&sel.end.row), tp.extract(&sel.end.col) })) {
if (editor.have_matches_not_of_type(.auto_find)) return; if (editor.have_matches_not_of_type(.auto_find)) return;
if (!tui.config().enable_auto_find) return;
sel.normalize(); sel.normalize();
if (sel.end.row - sel.begin.row > ed.max_match_lines) if (sel.end.row - sel.begin.row > ed.max_match_lines)
return self.clear_auto_find(editor); return self.clear_auto_find(editor);