summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2021-06-01 16:55:51 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2021-06-01 16:55:51 +0900
commit8255aa23f46ee90861f6ab1f1fadeae89dd3d4d8 (patch)
tree6f98424c837e4eab774300db39dd77bb955c79b3
parenta4bc08f5a35da6e374a2ce0da4c931d7fd32fdf1 (diff)
Fix bug where `--read0` not properly displaying long lines
Fix #2508
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/util/util.go4
2 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f2a89d8a..06fe7d8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ CHANGELOG
fzf --color fg:3,fg+:11
fzf --color fg:yellow,fg+:bright-yellow
```
+- Fix bug where `--read0` not properly displaying long lines
0.27.1
------
diff --git a/src/util/util.go b/src/util/util.go
index 59fb5708..b3c32970 100644
--- a/src/util/util.go
+++ b/src/util/util.go
@@ -3,6 +3,7 @@ package util
import (
"math"
"os"
+ "strings"
"time"
"github.com/mattn/go-isatty"
@@ -21,7 +22,8 @@ func RunesWidth(runes []rune, prefixWidth int, tabstop int, limit int) (int, int
if len(rs) == 1 && rs[0] == '\t' {
w = tabstop - (prefixWidth+width)%tabstop
} else {
- w = runewidth.StringWidth(string(rs))
+ s := string(rs)
+ w = runewidth.StringWidth(s) + strings.Count(s, "\n")
}
width += w
if limit > 0 && width > limit {