Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

use markdown for rendering tips (#7557)

Jeremy Roseccdeb9d9c4f9
diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs
index c4fd31f548..de8c06488e 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<Line<'static>> {
- 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<Line<'static>> = 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:<name> 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`