Allow zed filename.rs: (#38677)

iTerm's editor configuration dialog allows you to set your editor to
`zed \1:\2`, but not (as far as I know) to leave off the : when there's
no line number

This fixes clicking on bare filenames in iTerm for me.

Release Notes:

- Fixed line number parsing so that `zed filename.rs:` will now act as
though you did `zed filename.rs`
This commit is contained in:
Conrad Irwin
2025-09-22 22:26:47 +00:00
committed by GitHub
parent c9e3b32366
commit e9fbcf5abf
+5 -3
View File
@@ -379,6 +379,8 @@ const ROW_COL_CAPTURE_REGEX: &str = r"(?xs)
\:+(\d+)\:(\d+)\:*$ # filename:row:column
|
\:+(\d+)\:*()$ # filename:row
|
\:+()()$
)";
/// A representation of a path-like string with optional row and column numbers.
@@ -455,8 +457,8 @@ impl PathWithPosition {
/// row: None,
/// column: None,
/// });
/// assert_eq!(PathWithPosition::parse_str("test_file.rs::"), PathWithPosition {
/// path: PathBuf::from("test_file.rs::"),
/// assert_eq!(PathWithPosition::parse_str("test_file.rs"), PathWithPosition {
/// path: PathBuf::from("test_file.rs"),
/// row: None,
/// column: None,
/// });
@@ -998,7 +1000,7 @@ mod tests {
assert_eq!(
PathWithPosition::parse_str("test_file.rs:"),
PathWithPosition {
path: PathBuf::from("test_file.rs:"),
path: PathBuf::from("test_file.rs"),
row: None,
column: None
}