From 0e86accb588445f09b07ec68e6cc62903f9ba7bd Mon Sep 17 00:00:00 2001 From: Petter Rodhelind Date: Sun, 25 Feb 2018 10:46:59 +0100 Subject: Add alternative mouse clicks for one-btn-only laptops, fix scroll and add "save buffer with a new name". --- text.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'text.go') diff --git a/text.go b/text.go index b9398ed..fb4090a 100644 --- a/text.go +++ b/text.go @@ -82,9 +82,6 @@ func (t *Text) String() string { // ReadRune reads a rune from buffer and advances the internal offset. This could be called in sequence to get all runes from buffer. This populates LastRune(). func (t *Text) ReadRune() (r rune, size int, err error) { r, size, err = t.ReadRuneAt(t.off) - if err != nil { - return 0, 0, err - } t.off += size t.lastRune = r return @@ -96,7 +93,7 @@ func (t *Text) UnreadRune() (r rune, size int, err error) { r, size, err = t.ReadRuneAt(t.off) t.off++ if err != nil { - return 0, 0, err + return } t.off -= size return @@ -104,7 +101,7 @@ func (t *Text) UnreadRune() (r rune, size int, err error) { // ReadRuneAt returns the rune and its size at offset. If the given offset (in byte count) is not a valid rune, it will try to back up until it finds a valid starting point for a rune and return that one. // -// This is basically a Seek(offset) followed by a ReadRune(), but does not affect the internal offset for future reads.. +// This is basically a Seek(offset) followed by a ReadRune(), but does not affect the internal offset for future reads. func (t *Text) ReadRuneAt(offset int) (r rune, size int, err error) { var c byte c, err = t.buf.ByteAt(offset) -- cgit v1.2.3