Skip to content

Commit 8255aa2

Browse files
committed
Fix bug where --read0 not properly displaying long lines
Fix #2508
1 parent a4bc08f commit 8255aa2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
fzf --color fg:3,fg+:11
99
fzf --color fg:yellow,fg+:bright-yellow
1010
```
11+
- Fix bug where `--read0` not properly displaying long lines
1112

1213
0.27.1
1314
------

src/util/util.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package util
33
import (
44
"math"
55
"os"
6+
"strings"
67
"time"
78

89
"github.com/mattn/go-isatty"
@@ -21,7 +22,8 @@ func RunesWidth(runes []rune, prefixWidth int, tabstop int, limit int) (int, int
2122
if len(rs) == 1 && rs[0] == '\t' {
2223
w = tabstop - (prefixWidth+width)%tabstop
2324
} else {
24-
w = runewidth.StringWidth(string(rs))
25+
s := string(rs)
26+
w = runewidth.StringWidth(s) + strings.Count(s, "\n")
2527
}
2628
width += w
2729
if limit > 0 && width > limit {

0 commit comments

Comments
 (0)