Skip to content

Commit

Permalink
fix(tui): cursor not moved to the bottom of the terminal on exit when…
Browse files Browse the repository at this point in the history
… using `--tui-preserve-screen` (#1375)
  • Loading branch information
fujiapple852 committed Nov 5, 2024
1 parent 4f81cbf commit e0a8acb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/trippy-tui/src/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crossterm::{
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use ratatui::layout::Position;
use ratatui::{
backend::{Backend, CrosstermBackend},
Terminal,
Expand Down Expand Up @@ -45,7 +46,9 @@ pub fn run_frontend(
let preserve_screen = tui_config.preserve_screen;
let res = run_app(&mut terminal, traces, tui_config, resolver, geoip_lookup);
disable_raw_mode()?;
if !preserve_screen {
if preserve_screen {
terminal.set_cursor_position(Position::new(0, terminal.size()?.height))?;
} else {
execute!(terminal.backend_mut(), LeaveAlternateScreen)?;
}
terminal.show_cursor()?;
Expand Down

0 comments on commit e0a8acb

Please sign in to comment.