T45: Cmd-press, Ctrl-press off macOS, opens links inside herdr too: herdr wraps a long URL at its pane's edge and passes no OSC 8 target on, so the app opened a cut URL or nothing; while herdr's client leads the session and tracks the mouse the press goes to herdr, which opens its pane's link whole and underlines it under the key, Cmd heard as Ctrl on macOS; elsewhere the app opens links as before
CI / platforms (windows-latest) (push) Failing after 11s
CI / platforms (ubuntu-24.04) (push) Successful in 1m24s
CI / macos (push) Canceled after 0s

This commit is contained in:
ZacharyZhang-NY committed 2026-10-18 04:35:49 -04:00
1 parent 6b2ec654dc
commit ae3de244c2
8 files changed
+31 -9

No files matched your search

+9 -1
View File
@@ -76,7 +76,11 @@ pub fn follow(cx: &mut Context<TerminalView>) -> Task<()> {
"terminal {pid}: herdr left the foreground, its agents' records with it"
);
states.clear();
if view.update(cx, |view, cx| view.agents(&[], cx)).is_err() {
let left = view.update(cx, |view, cx| {
view.herdr = false;
view.agents(&[], cx);
});
if left.is_err() {
break;
}
}
@@ -101,6 +105,10 @@ pub fn follow(cx: &mut Context<TerminalView>) -> Task<()> {
socket.display()
);
}
let runs = socket.is_some();
if view.update(cx, |view, _| view.herdr = runs).is_err() {
break;
}
}
let Some(path) = socket.clone() else {
continue;
+13 -3
View File
@@ -80,13 +80,16 @@ impl TerminalView {
modifiers: &Modifiers,
tracking: Tracking,
) -> bool {
let wheel = matches!(button, Some(Button::WheelUp | Button::WheelDown));
// herdr's link key is Ctrl; on macOS Cmd stands for it, the wheel aside.
let link = cfg!(target_os = "macos") && self.herdr && modifiers.platform && !wheel;
let report = Report {
button,
gesture,
cell,
shift: modifiers.shift,
alt: modifiers.alt,
ctrl: modifiers.control,
ctrl: modifiers.control || link,
};
let format = self.mouse.format;
let Some(bytes) = mouse::encode(&report, MouseMode { tracking, format }) else {
@@ -111,7 +114,15 @@ impl TerminalView {
} else {
event.modifiers.control
};
if event.button == MouseButton::Left && opens {
let tracking = self.tracking(&event.modifiers);
// herdr opens its panes' links itself, whole where its drawing wraps them.
let herdr = self.herdr && tracking != Tracking::Off;
if event.button == MouseButton::Left && opens && herdr {
log::debug!(
"terminal {}: herdr takes the link press at {cell:?}",
self.pty.pid
);
} else if event.button == MouseButton::Left && opens {
let link = link_at(&self.pty.term.lock(), point);
if let Some(link) = link {
log::info!("terminal {}: opens {link}", self.pty.pid);
@@ -119,7 +130,6 @@ impl TerminalView {
return;
}
}
let tracking = self.tracking(&event.modifiers);
if tracking != Tracking::Off {
let Some(pressed) = button(event.button) else {
return;
+3
View File
@@ -70,6 +70,8 @@ pub struct TerminalView {
/// Keys go as Windows' records, as ConPTY asks.
#[cfg(windows)]
pub(super) win32: bool,
/// herdr's client leads the session, so herdr opens its panes' links.
pub(super) herdr: bool,
/// Keys whose press this terminal saw, so their releases may go out; true where it went as Windows' record.
pub(super) held: HashMap<Held, bool>,
pub(super) finder: Option<Finder>,
@@ -135,6 +137,7 @@ impl TerminalView {
mouse: MouseMode::default(),
#[cfg(windows)]
win32: false,
herdr: false,
held: HashMap::new(),
finder: None,
size,