From c3cb26026dd7360b5c80baa77a486b2c5ba278e2 Mon Sep 17 00:00:00 2001 From: Jeremy Rose <172423086+nornagon-openai@users.noreply.github.com> Date: Wed, 3 Dec 2025 16:46:50 -0800 Subject: [PATCH] Respect indent width when wrapping tooltips --- codex-rs/tui/src/history_cell.rs | 23 ++++++++++++----------- codex-rs/tui/tooltips.txt | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index 475eb1db17..435abbac98 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -573,18 +573,19 @@ impl TooltipHistoryCell { impl HistoryCell for TooltipHistoryCell { fn display_lines(&self, width: u16) -> Vec> { - let indent: Line<'static> = " ".into(); - let mut lines = Vec::new(); - let tooltip_line: Line<'static> = vec!["Tip: ".cyan(), self.tip.into()].into(); - let wrap_opts = RtOptions::new(usize::from(width.max(1))) - .initial_indent(indent.clone()) - .subsequent_indent(indent.clone()); - lines.extend( - word_wrap_line(&tooltip_line, wrap_opts.clone()) - .into_iter() - .map(|line| line_to_static(&line)), + let indent = " "; + let indent_width = UnicodeWidthStr::width(indent); + let wrap_width = usize::from(width.max(1)) + .saturating_sub(indent_width) + .max(1); + let mut lines: Vec> = Vec::new(); + append_markdown( + &format!("**Tip:** {}", self.tip), + Some(wrap_width), + &mut lines, ); - lines + + prefix_lines(lines, indent.into(), indent.into()) } } diff --git a/codex-rs/tui/tooltips.txt b/codex-rs/tui/tooltips.txt index 09167eb4fc..70c254d293 100644 --- a/codex-rs/tui/tooltips.txt +++ b/codex-rs/tui/tooltips.txt @@ -8,4 +8,4 @@ Type / to open the command popup; Tab autocompletes slash commands and saved pro Use /prompts: key=value to expand a saved prompt with placeholders before sending. With the composer empty, press Esc to step back and edit your last message; Enter confirms. Paste an image with Ctrl+V to attach it to your next message. -You can resume a previous conversation by doing `codex resume` \ No newline at end of file +You can resume a previous conversation by running `codex resume`