diff options
author | Christian Duerr <contact@christianduerr.com> | 2024-11-02 20:05:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-02 20:05:51 +0000 |
commit | fd745a9f4cb3ba81623167c9d1117747353db33a (patch) | |
tree | effc8817d4d024dd80477fce123bcd2335b95874 /alacritty/src/event.rs | |
parent | 39ea7271e32ad88280191d8040d6f8feafe4307a (diff) | |
download | r-alacritty-fd745a9f4cb3ba81623167c9d1117747353db33a.tar.gz r-alacritty-fd745a9f4cb3ba81623167c9d1117747353db33a.tar.bz2 r-alacritty-fd745a9f4cb3ba81623167c9d1117747353db33a.zip |
Fix racing condition in hint triggering
This fixes an issue with hints where it was possible that the terminal
content of highlighted hints changed between the highlighted hint update
and the activation of the hint.
This patch always validates the hint's text content against the hint
itself to ensure that the content is still valid for the original hint
which triggered the highlight.
Closes #8277.
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r-- | alacritty/src/event.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index f0159060..e82d7974 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -1141,16 +1141,16 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon } let hint_bounds = hint.bounds(); - let text = match hint.hyperlink() { - Some(hyperlink) => hyperlink.uri().to_owned(), - None => self.terminal.bounds_to_string(*hint_bounds.start(), *hint_bounds.end()), + let text = match hint.text(self.terminal) { + Some(text) => text, + None => return, }; match &hint.action() { // Launch an external program. HintAction::Command(command) => { let mut args = command.args().to_vec(); - args.push(text); + args.push(text.into()); self.spawn_daemon(command.program(), &args); }, // Copy the text to the clipboard. |