mirror of
https://github.com/zyedidia/micro.git
synced 2024-09-17 15:07:41 +03: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
@ -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 New Issue
Block a user