check null bytes instead to detect binaries

This commit is contained in:
Gokcehan 2016-10-02 00:29:14 +03:00
parent 751dbe8a7c
commit 7fe72c188f

7
ui.go
View File

@ -443,11 +443,8 @@ func (ui *UI) loadFile(nav *Nav) {
for i := 0; i < nav.height && buf.Scan(); i++ {
for _, r := range buf.Text() {
if unicode.IsSpace(r) {
continue
}
if !unicode.IsPrint(r) && r != EscapeCode {
ui.regprev = []string{"binary"}
if r == 0 {
ui.regprev = []string{"binary"}
return
}
}