diff options
| author | Caio S. Rohwedder <caiosalvador96@gmail.com> | 2025-07-23 05:31:15 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-23 13:31:15 +0200 |
| commit | 576789335a9ff7d62b7fb0d5ea897275ba95e8ab (patch) | |
| tree | 029136e81b6f2df638dad75b243b3692cba05481 | |
| parent | nushell: fix `get -i` deprecation (#2829) (diff) | |
| download | atuin-576789335a9ff7d62b7fb0d5ea897275ba95e8ab.zip | |
feat: add inline_height_shell_up_key_binding option (#2817)
| -rw-r--r-- | crates/atuin-client/config.toml | 5 | ||||
| -rw-r--r-- | crates/atuin-client/src/settings.rs | 1 | ||||
| -rw-r--r-- | crates/atuin/src/command/client/search/interactive.rs | 18 |
3 files changed, 19 insertions, 5 deletions
diff --git a/crates/atuin-client/config.toml b/crates/atuin-client/config.toml index a154a65b..f87984f0 100644 --- a/crates/atuin-client/config.toml +++ b/crates/atuin-client/config.toml @@ -71,6 +71,11 @@ ## set it to 0 to always go full screen # inline_height = 0 +## the maximum number of lines the interface should take up +## when atuin is invoked from a shell up-key binding +## the accepted values are identical to those of "inline_height" +# inline_height_shell_up_key_binding = 0 + ## Invert the UI - put the search bar at the top , Default to `false` # invert = false diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index 88bf27d5..2ffba5e4 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -462,6 +462,7 @@ pub struct Settings { pub search_mode_shell_up_key_binding: Option<SearchMode>, pub shell_up_key_binding: bool, pub inline_height: u16, + pub inline_height_shell_up_key_binding: Option<u16>, pub invert: bool, pub show_preview: bool, pub max_preview_height: u16, diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs index 708c36e4..f54b8c17 100644 --- a/crates/atuin/src/command/client/search/interactive.rs +++ b/crates/atuin/src/command/client/search/interactive.rs @@ -1056,13 +1056,21 @@ pub async fn history( history_store: &HistoryStore, theme: &Theme, ) -> Result<String> { - let stdout = Stdout::new(settings.inline_height > 0)?; + let inline_height = if settings.shell_up_key_binding { + settings + .inline_height_shell_up_key_binding + .unwrap_or(settings.inline_height) + } else { + settings.inline_height + }; + + let stdout = Stdout::new(inline_height > 0)?; let backend = CrosstermBackend::new(stdout); let mut terminal = Terminal::with_options( backend, TerminalOptions { - viewport: if settings.inline_height > 0 { - Viewport::Inline(settings.inline_height) + viewport: if inline_height > 0 { + Viewport::Inline(inline_height) } else { Viewport::Fullscreen }, @@ -1142,7 +1150,7 @@ pub async fn history( let mut results = app.query_results(&mut db, settings.smart_sort).await?; - if settings.inline_height > 0 { + if inline_height > 0 { terminal.clear()?; } @@ -1223,7 +1231,7 @@ pub async fn history( app.finalize_keymap_cursor(settings); - if settings.inline_height > 0 { + if inline_height > 0 { terminal.clear()?; } |
