From c4301c40d9b855318c8425e74cba91c1d9d87fa0 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 23 Dec 2025 21:45:06 +0100 Subject: [PATCH] refactor: add dropdown_keybinds configuration option --- src/config.zig | 6 ++++++ src/keybind/builtin/flow.json | 15 ++++++++++++++- src/tui/mode/overlay/dropdown.zig | 5 ++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/config.zig b/src/config.zig index e12bab1..51cbe70 100644 --- a/src/config.zig +++ b/src/config.zig @@ -71,6 +71,7 @@ centered_view_min_screen_width: usize = 145, lsp_output: enum { quiet, verbose } = .quiet, keybind_mode: KeybindMode = .normal, +dropdown_keybinds: DropdownKeybindMode = .standard, include_files: []const u8 = "", @@ -158,6 +159,11 @@ pub const KeybindMode = enum { ignore_alt_text_modifiers, }; +pub const DropdownKeybindMode = enum { + standard, + noninvasive, +}; + pub const InitialFindQuery = enum { empty, selection, diff --git a/src/keybind/builtin/flow.json b/src/keybind/builtin/flow.json index 9c613cc..081c8df 100644 --- a/src/keybind/builtin/flow.json +++ b/src/keybind/builtin/flow.json @@ -375,7 +375,7 @@ ["right_control", "palette_menu_activate_quick"] ] }, - "overlay/dropdown": { + "overlay/dropdown-noninvasive": { "inherit": "normal", "press": [ ["alt+f9", "dropdown_next_widget_style"], @@ -388,6 +388,19 @@ ["tab", "palette_menu_complete"] ] }, + "overlay/dropdown": { + "inherit": "normal", + "press": [ + ["alt+f9", "dropdown_next_widget_style"], + ["ctrl+p", "palette_menu_up"], + ["ctrl+n", "palette_menu_down"], + ["escape", "palette_menu_cancel"], + ["up", "palette_menu_up"], + ["down", "palette_menu_down"], + ["enter", "palette_menu_activate"], + ["tab", "palette_menu_complete"] + ] + }, "mini/numeric": { "press": [ ["ctrl+?", "toggle_keybind_hints"], diff --git a/src/tui/mode/overlay/dropdown.zig b/src/tui/mode/overlay/dropdown.zig index 4a480db..83c1cf4 100644 --- a/src/tui/mode/overlay/dropdown.zig +++ b/src/tui/mode/overlay/dropdown.zig @@ -93,7 +93,10 @@ pub fn Create(options: type) type { .query = .empty, .view_rows = get_view_rows(tui.screen()), .entries = .empty, - .mode = try keybind.mode("overlay/dropdown", allocator, .{ + .mode = try keybind.mode(switch (tui.config().dropdown_keybinds) { + .standard => "overlay/dropdown", + .noninvasive => "overlay/dropdown-noninvasive", + }, allocator, .{ .insert_command = "overlay_insert_bytes", }), .placement = if (@hasDecl(options, "placement")) options.placement else .top_center,