Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Avoid cloning buffered TUI history lines (#34204)

Charlie Marsh54994582b189
diff --git a/codex-rs/tui/src/insert_history.rs b/codex-rs/tui/src/insert_history.rs
index 760b516421..19055fb4eb 100644
--- a/codex-rs/tui/src/insert_history.rs
+++ b/codex-rs/tui/src/insert_history.rs
@@ -95,7 +95,7 @@ where
{
insert_history_hyperlink_lines_with_mode_and_wrap_policy(
terminal,
- plain_hyperlink_lines(lines.iter().map(line_to_static).collect()),
+ &plain_hyperlink_lines(lines.iter().map(line_to_static).collect()),
mode,
wrap_policy,
)
@@ -103,7 +103,7 @@ where
pub(crate) fn insert_history_hyperlink_lines_with_mode_and_wrap_policy<B>(
terminal: &mut crate::custom_terminal::Terminal<B>,
- lines: Vec<HyperlinkLine>,
+ lines: &[HyperlinkLine],
mode: InsertHistoryMode,
wrap_policy: HistoryLineWrapPolicy,
) -> io::Result<()>
@@ -131,7 +131,7 @@ where
let mut wrapped = Vec::new();
let mut wrapped_rows = 0usize;
- for line in &lines {
+ for line in lines {
let line_wrapped = match wrap_policy {
HistoryLineWrapPolicy::Terminal => vec![line.clone()],
HistoryLineWrapPolicy::PreWrap
diff --git a/codex-rs/tui/src/tui.rs b/codex-rs/tui/src/tui.rs
index 3c94ac5089..149790d9c2 100644
--- a/codex-rs/tui/src/tui.rs
+++ b/codex-rs/tui/src/tui.rs
@@ -883,7 +883,7 @@ impl Tui {
};
crate::insert_history::insert_history_hyperlink_lines_with_mode_and_wrap_policy(
terminal,
- batch.lines.clone(),
+ &batch.lines,
mode,
batch.wrap_policy,
)?;