summaryrefslogtreecommitdiff
path: root/src/util/chars.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-05-27 01:20:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-05-27 01:35:05 +0900
commit2f51eb2b414f3e27f0d3ab3f4ef1a3f3a48c6d06 (patch)
tree6ad0a17d17eaa2dd18d2575375ed9d22cecd2337 /src/util/chars.go
parent0ccbd79e10813f7fb67cd29687203ef3cd0d5692 (diff)
downloadfzf-2f51eb2b414f3e27f0d3ab3f4ef1a3f3a48c6d06.tar.gz
Different marker for the first and last line of multi-line entries
Can be configured via `--marker-multi-line`
Diffstat (limited to 'src/util/chars.go')
-rw-r--r--src/util/chars.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/util/chars.go b/src/util/chars.go
index 7c706ae8..82773f40 100644
--- a/src/util/chars.go
+++ b/src/util/chars.go
@@ -75,18 +75,18 @@ func (chars *Chars) Bytes() []byte {
return chars.slice
}
-func (chars *Chars) NumLines(atMost int) int {
+func (chars *Chars) NumLines(atMost int) (int, bool) {
lines := 1
if runes := chars.optionalRunes(); runes != nil {
for _, r := range runes {
if r == '\n' {
lines++
}
- if lines >= atMost {
- return atMost
+ if lines > atMost {
+ return atMost, true
}
}
- return lines
+ return lines, false
}
for idx := 0; idx < len(chars.slice); idx++ {
@@ -97,11 +97,11 @@ func (chars *Chars) NumLines(atMost int) int {
idx += found
lines++
- if lines >= atMost {
- return atMost
+ if lines > atMost {
+ return atMost, true
}
}
- return lines
+ return lines, false
}
func (chars *Chars) optionalRunes() []rune {