From 576789335a9ff7d62b7fb0d5ea897275ba95e8ab Mon Sep 17 00:00:00 2001 From: "Caio S. Rohwedder" Date: Wed, 23 Jul 2025 05:31:15 -0600 Subject: feat: add inline_height_shell_up_key_binding option (#2817) --- crates/atuin-client/config.toml | 5 +++++ crates/atuin-client/src/settings.rs | 1 + crates/atuin/src/command/client/search/interactive.rs | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'crates') 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, pub shell_up_key_binding: bool, pub inline_height: u16, + pub inline_height_shell_up_key_binding: Option, 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 { - 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()?; } -- cgit v1.3.1