aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorLucas Trzesniewski <lucas.trzesniewski@gmail.com>2025-09-09 12:24:25 +0200
committerGitHub <noreply@github.com>2025-09-09 11:24:25 +0100
commitc28ac1b0d50629515098a5df00eaaa751041bbeb (patch)
treeb28bddb24665bd39af52491600e7b3d178aeb244 /crates
parentfeat(tui): select entries using number in vim-normal mode. closes #2368 (#2893) (diff)
downloadatuin-c28ac1b0d50629515098a5df00eaaa751041bbeb.zip
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
Diffstat (limited to 'crates')
-rw-r--r--crates/atuin/src/command/client/search/interactive.rs10
1 files changed, 10 insertions, 0 deletions
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(