Highlight selected newlines in the transcript view (#47068)

## Why

Transcript selections could include a newline without showing it in the highlight, making `code` and `code\n` look identical.

## What changed

Highlight one trailing cell for selected hard line breaks when space permits, including newline separators between transcript entries. Track logical line endings so soft wraps and synthetic rows do not receive newline highlights.

## Testing

Add selection snapshots for hard breaks within and between entries, plus layout coverage for empty lines, wrapping, trailing whitespace, and synthetic rows. Update the app selection test to assert the leading newline highlight.

GitOrigin-RevId: d6f332c472598a3f79557b7ebb41730c6acc7820
This commit is contained in:
Eric Traut
2026-09-21 16:42:35 +00:00
committed by copyberry
parent a4c8fc7a6b
commit f07aaf920b
6 changed files with 151 additions and 7 deletions
+15 -3
View File
@@ -332,9 +332,21 @@ impl TranscriptView {
self.area.width,
/*height*/ 1,
);
visible
.layout
.highlight(begin..finish, area, buf, visible.row);
let next = (visible.index + 1..=end.index)
.filter_map(|index| {
selection
.snapshot
.pinned
.get(&self.entry_key(&selection.snapshot.cells, index))
})
.find(|layout| layout.row_count() > 0);
visible.layout.highlight_selection(
begin..finish,
next.map(AsRef::as_ref),
area,
buf,
visible.row,
);
}
}