mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-05 07:21:00 +00:00
util: Fix opening filenames including colons with parsecursor (#3119)
The regex pattern shall search for the end of the filename first as it does while opening with +LINE:COL.
This commit is contained in:
parent
e5026ef3fa
commit
eedebd80d4
1 changed files with 1 additions and 1 deletions
|
|
@ -315,7 +315,7 @@ func ReplaceHome(path string) (string, error) {
|
|||
// This is used for opening files like util.go:10:5 to specify a line and column
|
||||
// Special cases like Windows Absolute path (C:\myfile.txt:10:5) are handled correctly.
|
||||
func GetPathAndCursorPosition(path string) (string, []string) {
|
||||
re := regexp.MustCompile(`([\s\S]+?)(?::(\d+))(?::(\d+))?`)
|
||||
re := regexp.MustCompile(`([\s\S]+?)(?::(\d+))(?::(\d+))?$`)
|
||||
match := re.FindStringSubmatch(path)
|
||||
// no lines/columns were specified in the path, return just the path with no cursor location
|
||||
if len(match) == 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue