T35: Cmd-Up and Cmd-Down, Ctrl-Shift-Up and Ctrl-Shift-Down off macOS, jump to the prompt before or after the view's top, as Ghostty jumps: the tap rewrites each OSC 133 mark in place into an OSC 8 link of the terminal's own, which the parser keeps in the prompt's cells through scroll, reflow and history, and links pass over; the tap's OSC scanner ends a body as vte does
CI / platforms (ubuntu-24.04) (push) Successful in 1m4s
CI / platforms (windows-latest) (push) Successful in 1m36s
CI / macos (push) Successful in 11m52s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-16 23:46:58 -04:00
1 parent d3700f5278
commit 15e83f5b7e
13 files changed
+419 -27

No files matched your search

+14 -2
View File
@@ -4,13 +4,18 @@ use alacritty_terminal::{
};
use ely_gpui_component::terminal::{Target, links};
/// The OSC 8 target at `point`, else a URL in its wrapped line.
use super::prompts;
/// The OSC 8 target at `point`, else a URL in its wrapped line; a prompt's own link is no target.
pub fn link_at<T>(term: &Term<T>, mut point: Point) -> Option<String> {
let grid = term.grid();
if grid[point].flags.contains(Flags::WIDE_CHAR_SPACER) {
point.column -= 1;
}
if let Some(link) = grid[point].hyperlink() {
if let Some(link) = grid[point]
.hyperlink()
.filter(|link| link.uri() != prompts::LINK)
{
return Some(link.uri().to_string());
}
let end = term.line_search_right(point);
@@ -63,6 +68,13 @@ mod tests {
assert_eq!(link(text, 0, 0), None);
}
#[test]
fn a_prompt_s_own_link_is_no_target() {
let text = "\x1b]8;;\x7f\x1b\\$ https://ely.dev\x1b]8;;\x1b\\";
assert_eq!(link(text, 0, 0), None);
assert_eq!(link(text, 0, 4).as_deref(), Some("https://ely.dev"));
}
#[test]
fn a_url_ends_before_its_sentence_does() {
assert_eq!(link("(a.io/x).", 0, 2), None, "no scheme, no link");