diff options
-rw-r--r-- | atuin-client/config.toml | 4 | ||||
-rw-r--r-- | atuin-client/src/settings.rs | 9 | ||||
-rw-r--r-- | atuin/src/command/client/search/interactive.rs | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/atuin-client/config.toml b/atuin-client/config.toml index 97c62881..1475b359 100644 --- a/atuin-client/config.toml +++ b/atuin-client/config.toml @@ -174,3 +174,7 @@ enter_accept = true ## Set commands that will be completely ignored from stats #ignored_commands = ["cd", "ls", "vi"] + +[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 = false diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index 763fde1b..ad2e45ec 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -306,6 +306,11 @@ pub struct Sync { pub records: bool, } +#[derive(Clone, Debug, Deserialize, Default)] +pub struct Keys { + pub scroll_exits: bool, +} + #[derive(Clone, Debug, Deserialize)] pub struct Settings { pub dialect: Dialect, @@ -360,6 +365,9 @@ pub struct Settings { #[serde(default)] pub sync: Sync, + #[serde(default)] + pub keys: Keys, + // This is automatically loaded when settings is created. Do not set in // config! Keep secrets and settings apart. #[serde(skip)] @@ -588,6 +596,7 @@ impl Settings { // New users will get the new default, that is more similar to what they are used to. .set_default("enter_accept", false)? .set_default("sync.records", false)? + .set_default("keys.scroll_exits", true)? .set_default("keymap_mode", "emacs")? .set_default("keymap_mode_shell", "auto")? .set_default("keymap_cursor", HashMap::<String, String>::new())? diff --git a/atuin/src/command/client/search/interactive.rs b/atuin/src/command/client/search/interactive.rs index 1c71a5b6..1f3a2cff 100644 --- a/atuin/src/command/client/search/interactive.rs +++ b/atuin/src/command/client/search/interactive.rs @@ -225,7 +225,7 @@ impl State { is_down: bool, ) -> InputAction { if is_down { - if enable_exit && self.results_state.selected() == 0 { + if settings.keys.scroll_exits && enable_exit && self.results_state.selected() == 0 { return Self::handle_key_exit(settings); } self.scroll_down(1); |