This commit is contained in:
Zachary Yedidia
2018-04-28 17:04:47 -04:00
3 changed files with 21 additions and 5 deletions

View File

@@ -435,7 +435,11 @@ func (v *View) StartOfLine(usePlugin bool) bool {
v.deselect(0)
v.Cursor.Start()
if v.Cursor.X != 0 {
v.Cursor.Start()
} else {
v.Cursor.StartOfText()
}
if usePlugin {
return PostActionCall("StartOfLine", v)
@@ -1215,9 +1219,9 @@ func (v *View) Cut(usePlugin bool) bool {
return PostActionCall("Cut", v)
}
return true
} else {
return v.CutLine(usePlugin)
}
return false
}
// DuplicateLine duplicates the current line or selection

View File

@@ -333,6 +333,18 @@ func (c *Cursor) Start() {
c.LastVisualX = c.GetVisualX()
}
// StartOfText moves the cursor to the first non-whitespace rune of
// the line it is on
func (c *Cursor) StartOfText() {
c.Start()
for IsWhitespace(c.RuneUnder(c.X)) {
if c.X == Count(c.buf.Line(c.Y)) {
break
}
c.Right()
}
}
// GetCharPosInLine gets the char position of a visual x y
// coordinate (this is necessary because tabs are 1 char but
// 4 visual spaces)

View File

@@ -19,8 +19,8 @@ color-link line-number "#666666,#242424"
color-link current-line-number "#666666,#242424"
color-link gutter-error "#CB4B16,#242424"
color-link gutter-warning "#E6DB74,#242424"
color-link cursor-line "#2C2C2C"
color-link color-column "#2C2C2C"
color-link cursor-line "default,#2C2C2C"
color-link color-column "default,#2C2C2C"
#No extended types; Plain brackets.
color-link type.extended "default"
#color-link symbol.brackets "default"