diff options
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/atuin-client/config.toml | 4 | ||||
| -rw-r--r-- | crates/atuin-client/src/settings.rs | 4 | ||||
| -rw-r--r-- | crates/atuin/src/command/client/search/interactive.rs | 6 |
3 files changed, 12 insertions, 2 deletions
diff --git a/crates/atuin-client/config.toml b/crates/atuin-client/config.toml index 388e3f85..4f9a46b7 100644 --- a/crates/atuin-client/config.toml +++ b/crates/atuin-client/config.toml @@ -209,6 +209,10 @@ enter_accept = true [keys] # Defaults to true. If disabled, using the up/down key won't exit the TUI when scrolled past the first/last entry. # scroll_exits = true +# Defaults to true. The left arrow key will exit the TUI when scrolling before the first character +# exit_past_line_start = true +# Defaults to true. The right arrow key performs the same functionality as Tab and copies the selected line to the command line to be modified. +# accept_past_line_end = true [sync] # Enable sync v2 by default diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index 4c2b10ab..c01281c7 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -330,6 +330,8 @@ pub struct Sync { #[derive(Clone, Debug, Deserialize, Default, Serialize)] pub struct Keys { pub scroll_exits: bool, + pub exit_past_line_start: bool, + pub accept_past_line_end: bool, pub prefix: String, } @@ -777,6 +779,8 @@ impl Settings { .set_default("enter_accept", false)? .set_default("sync.records", true)? .set_default("keys.scroll_exits", true)? + .set_default("keys.accept_past_line_end", true)? + .set_default("keys.exit_past_line_start", true)? .set_default("keys.prefix", "a")? .set_default("keymap_mode", "emacs")? .set_default("keymap_mode_shell", "auto")? diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs index d7c9d5eb..4b672705 100644 --- a/crates/atuin/src/command/client/search/interactive.rs +++ b/crates/atuin/src/command/client/search/interactive.rs @@ -224,10 +224,12 @@ impl State { KeyCode::Esc if esc_allow_exit => Some(Self::handle_key_exit(settings)), KeyCode::Char('[') if ctrl && esc_allow_exit => Some(Self::handle_key_exit(settings)), KeyCode::Tab => Some(InputAction::Accept(self.results_state.selected())), - KeyCode::Right if cursor_at_end_of_line => { + KeyCode::Right if cursor_at_end_of_line && settings.keys.accept_past_line_end => { Some(InputAction::Accept(self.results_state.selected())) } - KeyCode::Left if cursor_at_start_of_line => Some(Self::handle_key_exit(settings)), + KeyCode::Left if cursor_at_start_of_line && settings.keys.exit_past_line_start => { + Some(Self::handle_key_exit(settings)) + } KeyCode::Char('o') if ctrl => { self.tab_index = (self.tab_index + 1) % TAB_TITLES.len(); Some(InputAction::Continue) |
