From c28ac1b0d50629515098a5df00eaaa751041bbeb Mon Sep 17 00:00:00 2001 From: Lucas Trzesniewski Date: Tue, 9 Sep 2025 12:24:25 +0200 Subject: fix: use fullscreen if `inline_height` is too large (#2888) This uses fullscreen mode if `inline_height` is larger than the terminal height. Currently, in that situation, the screen is always cleared upon exit from `atuin search -i`. This change will preserve the buffer when Atuin takes the whole screen, which is a much friendlier behavior. Demo by @LecrisUT: https://github.com/atuinsh/atuin/pull/2600#issuecomment-3228255130 Closes #2207 ## Checks - [x] I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle - [x] I have checked that there are no existing pull requests for the same thing --- crates/atuin/src/command/client/search/interactive.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs index 51a94f45..6990c3e8 100644 --- a/crates/atuin/src/command/client/search/interactive.rs +++ b/crates/atuin/src/command/client/search/interactive.rs @@ -1081,6 +1081,16 @@ pub async fn history( settings.inline_height }; + // Use fullscreen mode if the inline height doesn't fit in the terminal, + // this will preserve the scroll position upon exit + let inline_height = if let Ok(size) = terminal::size() + && inline_height >= size.1 + { + 0 + } else { + inline_height + }; + let stdout = Stdout::new(inline_height > 0)?; let backend = CrosstermBackend::new(stdout); let mut terminal = Terminal::with_options( -- cgit v1.3.1