]> git.lizzy.rs Git - micro.git/commitdiff
Fix bug with view.Center
authorZachary Yedidia <zyedidia@gmail.com>
Mon, 29 Aug 2016 13:16:12 +0000 (09:16 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Mon, 29 Aug 2016 13:16:24 +0000 (09:16 -0400)
Fixes #215

cmd/micro/actions.go
cmd/micro/highlighter.go

index dc61c685109a8c5991a0a86801c18043a6242c26..c355f23688d86705c51c63d6d47c150db63db178 100644 (file)
@@ -51,10 +51,11 @@ func (v *View) Center(usePlugin bool) bool {
        }
 
        v.Topline = v.Cursor.Y - v.height/2
+       if v.Topline+v.height > v.Buf.NumLines {
+               v.Topline = v.Buf.NumLines - v.height
+       }
        if v.Topline < 0 {
                v.Topline = 0
-       } else if v.Topline+v.height > v.Buf.NumLines {
-               v.Topline = v.Buf.NumLines - v.height
        }
 
        if usePlugin {
index b59b654ffb8e7865a79de0ec68c97a9bcbce6796..8d8f7941b98f18a960741ba7ec8542558f29b58a 100644 (file)
@@ -482,7 +482,6 @@ func Match(v *View) SyntaxMatches {
                                        for _, value := range indicies {
                                                start := runePos(value[0], line)
                                                end := runePos(value[1], line)
-                                               // messenger.Message(start, " ", end)
                                                for i := start; i < end; i++ {
                                                        matches[lineN][i] = rule.style
                                                }