Allow overwriting options with flags

Fixes #258

Also related to #233, this commit also changes how +LINE,COL works. Now it is
micro -startpos LINE,COL file.
This commit is contained in:
Zachary Yedidia
2016-09-03 11:26:01 -04:00
parent 1c2b815d95
commit af22e0a567
2 changed files with 30 additions and 18 deletions

View File

@@ -89,9 +89,9 @@ func NewBuffer(txt []byte, path string) *Buffer {
// Put the cursor at the first spot
cursorStartX := 0
cursorStartY := 0
// If +LINE,COL was passed, use start position LINE,COL
if len(flagLineColumn) > 0 {
positions := strings.Split(flagLineColumn[1:], ",")
// If -startpos LINE,COL was passed, use start position LINE,COL
if len(*flagStartPos) > 0 {
positions := strings.Split(*flagStartPos, ",")
if len(positions) == 2 {
lineNum, errPos1 := strconv.Atoi(positions[0])
colNum, errPos2 := strconv.Atoi(positions[1])