Open source file links at line and column targets in the TUI (#61890)

## What changed

- Extend sidebar previews beyond Markdown to source files, including extensionless files. Preserve line and column targets such as `./Makefile#L12C3`, scroll to the target, and highlight its line and character.
- Render source previews with syntax highlighting and line numbers when space permits. Keep plain Markdown links rendered as Markdown, and show source when a location is specified.
- Show local link labels without appended destinations when workspace previews are available, and emphasize links on hover. Refresh rendering when preview availability changes.
- Limit source previews to 1 MiB and 10,000 lines, and disable document previews for Windows workspaces.

## Testing

Add coverage for extensionless link parsing, matching hover and click targets, streamed file citation metadata, and source navigation with CRLF input, tab reuse, and Escape handling.

GitOrigin-RevId: c2629b122628a4f5afa17df1890f63bd1c9bbcf6
This commit is contained in:
Felipe Coury
2026-11-16 21:50:03 +00:00
committed by copyberry
parent 7c3f5e2cc2
commit 3a51865c8c
30 changed files with 846 additions and 201 deletions
@@ -117,7 +117,7 @@ pub(super) struct Selection {
pointer_origin_row: u16,
pub(super) resume_on_empty: bool,
pub(super) pointer: Option<ScreenPosition>,
pub(super) pressed_link: Option<String>,
pub(super) pressed_link: Option<crate::terminal_hyperlinks::ReaderLink>,
origin: (Anchor, Anchor),
table_cell: Option<TableSelection>,
unit: SelectionUnit,
@@ -661,7 +661,10 @@ impl TranscriptView {
| ViewAction::CopyOnSelect(text)
| ViewAction::PrimarySelection(text)
| ViewAction::CopyAndFollow(text) => text.as_str(),
ViewAction::Changed | ViewAction::ExitSelectMode | ViewAction::OpenLink(_) => {
ViewAction::Changed
| ViewAction::ExitSelectMode
| ViewAction::OpenLink(_)
| ViewAction::OpenDocument(_) => {
return None;
}
};