From e9fbcf5abf6d7b72c583cb09816a2975954290ba Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 22 Sep 2025 16:26:47 -0600 Subject: [PATCH] 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` --- crates/util/src/paths.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs index 72753b026e2194e0b083acb1f9d6d69864286c6b..7d16ee0b5ec88362fe45ab8ff594eb13c446417f 100644 --- a/crates/util/src/paths.rs +++ b/crates/util/src/paths.rs @@ -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 }