Skip to content

Commit b801481

Browse files
authored
fix: Layout fix (#2798)
1 parent fcd52f9 commit b801481

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

crates/chat-cli/src/cli/chat/cli/experiment.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,16 @@ async fn select_experiment(os: &mut Os, session: &mut ChatSession) -> Result<Opt
108108
sel
109109
},
110110
// Ctrl‑C -> Err(Interrupted)
111-
Err(dialoguer::Error::IO(ref e)) if e.kind() == std::io::ErrorKind::Interrupted => return Ok(None),
111+
Err(dialoguer::Error::IO(ref e)) if e.kind() == std::io::ErrorKind::Interrupted => {
112+
// Move to beginning of line and clear everything from warning message down
113+
queue!(
114+
session.stderr,
115+
crossterm::cursor::MoveToColumn(0),
116+
crossterm::cursor::MoveUp(experiment_labels.len() as u16 + 3),
117+
crossterm::terminal::Clear(crossterm::terminal::ClearType::FromCursorDown),
118+
)?;
119+
return Ok(None);
120+
},
112121
Err(e) => return Err(ChatError::Custom(format!("Failed to choose experiment: {e}").into())),
113122
};
114123

@@ -161,6 +170,13 @@ async fn select_experiment(os: &mut Os, session: &mut ChatSession) -> Result<Opt
161170
style::SetForegroundColor(Color::Reset),
162171
style::SetBackgroundColor(Color::Reset),
163172
)?;
173+
} else {
174+
// ESC was pressed - clear the warning message
175+
queue!(
176+
session.stderr,
177+
crossterm::cursor::MoveUp(3), // Move up past selection + 2 disclaimer lines
178+
crossterm::terminal::Clear(crossterm::terminal::ClearType::FromCursorDown),
179+
)?;
164180
}
165181

166182
execute!(session.stderr, style::ResetColor)?;

0 commit comments

Comments
 (0)