From 4f2214e1d61606c7ca9a270de42c61b86e3c50be Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 17 Apr 2024 22:55:08 +0200 Subject: [PATCH] terminal: Treat paths with non-digit col/rows as paths nonetheless (#10691) This relaxes path parsing to allow paths like ./foo.rs:food or ./food/foo_bar.rs:2:12:food as some tools may add a suffix without regard for col/row end. Fixes #10688 Release Notes: - Made path parsing in terminal (for directory links) more lenient with regards to row/column fields. --- crates/util/src/paths.rs | 44 ++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs index 6bbc1f212e98eb96ee20ef2c5622fd00bf899918..97740fb75c8634675c0a4a780c957e48d09fbc2d 100644 --- a/crates/util/src/paths.rs +++ b/crates/util/src/paths.rs @@ -205,23 +205,27 @@ impl
PathLikeWithPosition
{
column: None,
})
} else {
- let maybe_col_str =
- if maybe_col_str.ends_with(FILE_ROW_COLUMN_DELIMITER) {
- &maybe_col_str[..maybe_col_str.len() - 1]
- } else {
- maybe_col_str
- };
+ let (maybe_col_str, _) =
+ maybe_col_str.split_once(':').unwrap_or((maybe_col_str, ""));
match maybe_col_str.parse::