]> git.lizzy.rs Git - micro.git/commitdiff
Merge pull request #1085 from jtolds/themes
authorZachary Yedidia <zyedidia@gmail.com>
Sat, 21 Apr 2018 20:57:53 +0000 (16:57 -0400)
committerGitHub <noreply@github.com>
Sat, 21 Apr 2018 20:57:53 +0000 (16:57 -0400)
darcula: fix highlighted line and color column

cmd/micro/actions.go
cmd/micro/cursor.go

index 21179e3bb14de2f25490f40f9d5fa6bb5efeb53e..4d52e79bfc5e1386a0e0513c23c3d372f62e0608 100644 (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)
index 15b01010eec9879ba45dbaf8fda1b5c8c1e41c10..452268ba12b1f3802623be7fca8c5d33097e81e0 100644 (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)