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:
Charlie Marsh
2026-07-19 17:32:53 +00:00
committed by copyberry
parent 4d7a5c7c73
commit 54994582b1
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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,
)?;