]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/highlighter.go
Small optimization
[micro.git] / cmd / micro / highlighter.go
index 5acec698822e37199e72051390fbea34a1f2f205..bcf0aabdfcf6f91475072f2abdf35215a9a9ca91 100644 (file)
@@ -1,7 +1,7 @@
 package main
 
 import (
-       "github.com/gdamore/tcell"
+       "github.com/zyedidia/tcell"
        "io/ioutil"
        "path/filepath"
        "regexp"
@@ -93,6 +93,7 @@ var preInstalledSynFiles = []string{
        "privoxy-filter",
        "puppet",
        "python",
+       "r",
        "reST",
        "rpmspec",
        "ruby",
@@ -385,8 +386,8 @@ func Match(v *View) SyntaxMatches {
 
        viewStart := v.topline
        viewEnd := v.topline + v.height
-       if viewEnd > len(buf.lines) {
-               viewEnd = len(buf.lines)
+       if viewEnd > buf.numLines {
+               viewEnd = buf.numLines
        }
 
        lines := buf.lines[viewStart:viewEnd]
@@ -402,8 +403,8 @@ func Match(v *View) SyntaxMatches {
        if totalStart < 0 {
                totalStart = 0
        }
-       if totalEnd > len(buf.lines) {
-               totalEnd = len(buf.lines)
+       if totalEnd > buf.numLines {
+               totalEnd = buf.numLines
        }
 
        str := strings.Join(buf.lines[totalStart:totalEnd], "\n")