Add parsecursor option for file:line:col syntax

This option is disabled by default, and when enabled causes micro
to parse `:line:col` as a location for the cursor rather than
as part of the filename.

Closes #1650
Closes #1685
This commit is contained in:
Zachary Yedidia
2020-05-29 14:55:24 -04:00
parent 8bd7e5807c
commit eeab114ed5
4 changed files with 22 additions and 7 deletions

View File

@@ -197,7 +197,11 @@ type Buffer struct {
// and an error if the file is a directory
func NewBufferFromFile(path string, btype BufType) (*Buffer, error) {
var err error
filename, cursorPos := util.GetPathAndCursorPosition(path)
var cursorPos []string
filename := path
if config.GetGlobalOption("parsecursor").(bool) {
filename, cursorPos = util.GetPathAndCursorPosition(path)
}
filename, err = util.ReplaceHome(filename)
if err != nil {
return nil, err