diff --git a/src/commands/config_cmds.rs b/src/commands/config_cmds.rs index b5b89a5..d435a88 100644 --- a/src/commands/config_cmds.rs +++ b/src/commands/config_cmds.rs @@ -510,8 +510,12 @@ pub(super) async fn cmd_backend(args: &str, state: &mut AppState) -> Result<()> for (i, b) in BackendName::all().iter().enumerate() { println!(" {DIM}{}){RESET} {}", i + 1, b.as_str()); } + // Blank line so the list and the prompt don't crowd each other. + println!(); let prompt = format!(" {DIM}Select (1-{}):{RESET} ", BackendName::all().len()); let pick = plain_read_line(prompt).await?.trim().to_string(); + // Blank line between the typed selection and the response below. + println!(); pick.parse::() .ok() .and_then(|n| n.checked_sub(1)) @@ -633,8 +637,12 @@ pub(super) async fn cmd_model(args: &str, state: &mut AppState) -> Result<()> { if total > shown.len() { println!(" {DIM}…and {} more{RESET}", total - shown.len()); } + // Blank line so the list and the prompt don't crowd each other. + println!(); let prompt = format!(" {DIM}Select (1-{}):{RESET} ", shown.len()); let pick = plain_read_line(prompt).await?.trim().to_string(); + // Blank line between the typed selection and the response below. + println!(); if let Some(idx) = pick.parse::().ok().and_then(|n| n.checked_sub(1)) { if let Some(m) = shown.get(idx) { state.config.model_override = Some(m.clone()); diff --git a/src/input.rs b/src/input.rs index 06ba272..dc305fa 100644 --- a/src/input.rs +++ b/src/input.rs @@ -353,16 +353,20 @@ fn read_plain_outcome( continue; } if let Some(outcome) = control_key_outcome(code, modifiers) { + // See the Enter branch: `\r\n`, not `\n`, while raw mode is on. redraw(&mut out, &chars, cursor, sel, true)?; - writeln!(out)?; + write!(out, "\r\n")?; out.flush()?; return Ok(outcome); } match code { KeyCode::Enter => { - // Clear any open menu, then drop to the next line. + // Clear any open menu, then drop to the next line. Raw mode + // is still active here, so a bare `\n` only line-feeds and + // leaves the cursor in the input's last column — `\r` returns + // it to column 0 so the caller's output isn't shifted right. redraw(&mut out, &chars, cursor, sel, true)?; - writeln!(out)?; + write!(out, "\r\n")?; out.flush()?; return Ok(ReadLineOutcome::Line(chars.iter().collect())); }