diff options
Diffstat (limited to 'src/reader.go')
-rw-r--r-- | src/reader.go | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/reader.go b/src/reader.go index d979eb6a..3e2cf0a0 100644 --- a/src/reader.go +++ b/src/reader.go @@ -5,14 +5,13 @@ import ( "io" "os" "os/exec" - "unicode/utf8" "github.com/junegunn/fzf/src/util" ) // Reader reads from command or standard input type Reader struct { - pusher func([]rune) bool + pusher func([]byte) bool eventBox *util.EventBox delimNil bool } @@ -42,21 +41,10 @@ func (r *Reader) feed(src io.Reader) { // end in delim. bytea, err := reader.ReadBytes(delim) if len(bytea) > 0 { - runes := make([]rune, 0, len(bytea)) - for i := 0; i < len(bytea); { - if bytea[i] < utf8.RuneSelf { - runes = append(runes, rune(bytea[i])) - i++ - } else { - r, sz := utf8.DecodeRune(bytea[i:]) - i += sz - runes = append(runes, r) - } - } if err == nil { - runes = runes[:len(runes)-1] + bytea = bytea[:len(bytea)-1] } - if r.pusher(runes) { + if r.pusher(bytea) { r.eventBox.Set(EvtReadNew, nil) } } |