Disallow view switching during a search

Closes #642

This commit also removes some unnecessary functions that weren't being
used.
This commit is contained in:
Zachary Yedidia
2017-05-05 10:52:09 -04:00
parent 960c6cae62
commit 8d1618692e
3 changed files with 21 additions and 45 deletions

View File

@@ -2,32 +2,12 @@ package main
import (
"bufio"
"bytes"
"io"
"unicode/utf8"
"github.com/zyedidia/micro/cmd/micro/highlight"
)
func lineCounter(r io.Reader) (int, error) {
buf := make([]byte, 32*1024)
count := 0
lineSep := []byte{'\n'}
for {
c, err := r.Read(buf)
count += bytes.Count(buf[:c], lineSep)
switch {
case err == io.EOF:
return count, nil
case err != nil:
return count, err
}
}
}
func runeToByteIndex(n int, txt []byte) int {
if n == 0 {
return 0