@@ -1797,15 +1797,15 @@
"(?x)",
"(?<path>",
" (",
- " # multi-char path: first char (not opening delimiter or space)",
- " [^({\\[<\"'`\\ ]",
+ " # 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()])*",
" # last char: not closing delimiter or colon",
" [^()}\\]>\"'`.,;:\\ ]",
" |",
- " # single-char path: not delimiter, punctuation, or space",
- " [^(){}\\[\\]<>\"'`.,;:\\ ]",
+ " # single-char path: not delimiter, punctuation, space, or box drawing char",
+ " [^(){}\\[\\]<>\"'`.,;:\\ \\u2500-\\u257F]",
" )",
" # optional line/column suffix (included in path for PathWithPosition::parse_str)",
" (:+[0-9]+(:[0-9]+)?|:?\\([0-9]+([,:]?[0-9]+)?\\))?",
@@ -905,6 +905,23 @@ mod tests {
);
}
+ #[test]
+ // <https://github.com/zed-industries/zed/issues/46795>
+ fn issue_46795() {
+ // Box drawing characters are commonly used as UI elements and
+ // should not interfere with path detection; they appear rarely
+ // enough in actual paths that false positives should be minimal
+
+ test_path!("─‹«/👉test/cool.rs»:«4»:«2»›");
+ test_path!("┤‹«/👉test/cool.rs»:«4»:«2»›");
+ test_path!("╿‹«/👉test/cool.rs»:«4»:«2»›");
+
+ test_path!("└──‹«/👉test/cool.rs»:«4»:«2»›");
+ test_path!("├─[‹«/👉test/cool.rs»:«4»:«2»›]");
+ test_path!("─[‹«/👉test/cool.rs»:«4»:«2»›]");
+ test_path!("┬‹«/👉test/cool.rs»:«4»:«2»›┬");
+ }
+
#[test]
#[cfg_attr(
not(target_os = "windows"),