Avoid cloning hyperlink text during TUI rendering (#34366)

## What changed

Add a borrowed `Line` conversion and use it when rendering and measuring
hyperlink-aware history and pager content. This preserves line styling and
alignment while avoiding clones of the underlying span strings.

GitOrigin-RevId: c9cd6ff5ec63cd29719ea2ae51acede7364f2bd8
This commit is contained in:
Charlie Marsh authored and copyberry committed 2026-07-20 15:39:31 +00:00
1 parent f944456d81
commit 28aacbb9d9
4 files changed
+32 -6

No files matched your search

+2 -1
View File
@@ -37,6 +37,7 @@ use crate::terminal_hyperlinks::mark_buffer_hyperlinks;
use crate::terminal_hyperlinks::plain_hyperlink_lines;
use crate::terminal_hyperlinks::prefix_hyperlink_lines;
use crate::terminal_hyperlinks::visible_lines;
use crate::terminal_hyperlinks::visible_lines_ref;
#[cfg(test)]
use crate::test_support::PathBufExt;
#[cfg(test)]
@@ -309,7 +310,7 @@ pub(crate) trait HistoryCell: std::fmt::Debug + Send + Sync + Any {
impl Renderable for Box<dyn HistoryCell> {
fn render(&self, area: Rect, buf: &mut Buffer) {
let hyperlink_lines = self.display_hyperlink_lines(area.width);
let lines = visible_lines(hyperlink_lines.clone());
let lines = visible_lines_ref(&hyperlink_lines);
let paragraph = Paragraph::new(Text::from(lines)).wrap(Wrap { trim: false });
let y = if area.height == 0 {
0