Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix terminal path click failing when path is prefixed with '0:' (#50663)

xcb3d83b05f1cbba7
diff --git a/assets/settings/default.json b/assets/settings/default.json
index b193c0f60d0..6593c3b192c 100644
--- a/assets/settings/default.json
+++ b/assets/settings/default.json
@@ -1831,8 +1831,8 @@
" (",
" # multi-char path: first char (not opening delimiter, space, or box drawing char)",
" [^({\\[<\"'`\\ \\u2500-\\u257F]",
- " # middle chars: non-space, and colon/paren only if not followed by digit/paren",
- " ([^\\ :(]|[:(][^0-9()])*",
+ " # middle chars: non-space, and colon/paren only if not followed by digit/paren/space",
+ " ([^\\ :(]|[:(][^0-9()\\ ])*",
" # last char: not closing delimiter or colon",
" [^()}\\]>\"'`.,;:\\ ]",
" |",
diff --git a/crates/terminal/src/terminal_hyperlinks.rs b/crates/terminal/src/terminal_hyperlinks.rs
index d239f680f9e..0ca6cb2edd9 100644
--- a/crates/terminal/src/terminal_hyperlinks.rs
+++ b/crates/terminal/src/terminal_hyperlinks.rs
@@ -905,6 +905,18 @@ mod tests {
);
}
+ #[test]
+ // <https://github.com/zed-industries/zed/issues/50531>
+ fn issue_50531() {
+ // Paths preceded by "N:" prefix (e.g. grep output line numbers)
+ // should still be clickable
+ test_path!("0: ‹«foo/👉bar.txt»›");
+ test_path!("0: ‹«👉foo/bar.txt»›");
+ test_path!("42: ‹«👉foo/bar.txt»›");
+ test_path!("1: ‹«/👉test/cool.rs»›");
+ test_path!("1: ‹«/👉test/cool.rs»:«4»:«2»›");
+ }
+
#[test]
// <https://github.com/zed-industries/zed/issues/46795>
fn issue_46795() {