mirror of
https://github.com/junegunn/fzf.git
synced 2025-09-02 21:33:50 -07:00
Different marker for the first and last line of multi-line entries
Can be configured via `--marker-multi-line`
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user