From ad0c2b4db302cdc89b9c52e33ec780dae85cb46a Mon Sep 17 00:00:00 2001 From: Jeremy Rose <172423086+nornagon-openai@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:22:58 -0700 Subject: [PATCH] don't clear screen on startup (#3925) --- codex-rs/tui/src/tui.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/codex-rs/tui/src/tui.rs b/codex-rs/tui/src/tui.rs index 6d7b9e81..cacbc716 100644 --- a/codex-rs/tui/src/tui.rs +++ b/codex-rs/tui/src/tui.rs @@ -14,7 +14,7 @@ use std::time::Instant; use crossterm::Command; use crossterm::SynchronizedUpdate; -use crossterm::cursor; +#[cfg(unix)] use crossterm::cursor::MoveTo; use crossterm::event::DisableBracketedPaste; use crossterm::event::DisableFocusChange; @@ -27,7 +27,6 @@ use crossterm::event::PopKeyboardEnhancementFlags; use crossterm::event::PushKeyboardEnhancementFlags; use crossterm::terminal::EnterAlternateScreen; use crossterm::terminal::LeaveAlternateScreen; -use crossterm::terminal::ScrollUp; use ratatui::backend::Backend; use ratatui::backend::CrosstermBackend; use ratatui::crossterm::execute; @@ -127,15 +126,6 @@ pub fn init() -> Result { set_panic_hook(); - // Instead of clearing the screen (which can drop scrollback in some terminals), - // scroll existing lines up until the cursor reaches the top, then start at (0, 0). - if let Ok((_x, y)) = cursor::position() - && y > 0 - { - execute!(stdout(), ScrollUp(y))?; - } - execute!(stdout(), MoveTo(0, 0))?; - let backend = CrosstermBackend::new(stdout()); let tui = CustomTerminal::with_options(backend)?; Ok(tui)