check null bytes instead to detect binaries
This commit is contained in:
parent
751dbe8a7c
commit
7fe72c188f
7
ui.go
7
ui.go
@ -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{"[1mbinary[0m"}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user