mirror of
https://github.com/openai/codex.git
synced 2026-10-21 23:19:44 +00:00
Avoid cloning buffered TUI history lines (#34204)
## What changed Make the hyperlink-aware history insertion helper accept a slice and borrow pending history batches when flushing them. This avoids cloning each batch's entire `Vec<HyperlinkLine>` before insertion. GitOrigin-RevId: 0bc86c33e2f047c62de60b7642899c4aaa4bb6b8
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user