mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-16 15:23:48 -05:00
@@ -135,6 +135,7 @@ func Run(opts *Options) (int, error) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
item.text, item.colors = ansiProcessor(stringBytes(transformed))
|
item.text, item.colors = ansiProcessor(stringBytes(transformed))
|
||||||
|
item.text.TrimTrailingWhitespaces()
|
||||||
item.text.Index = itemIndex
|
item.text.Index = itemIndex
|
||||||
item.origText = &data
|
item.origText = &data
|
||||||
itemIndex++
|
itemIndex++
|
||||||
|
|||||||
@@ -778,7 +778,7 @@ func nthTransformer(str string) (func(Delimiter) func([]Token, int32) string, er
|
|||||||
}
|
}
|
||||||
return func(Delimiter) func([]Token, int32) string {
|
return func(Delimiter) func([]Token, int32) string {
|
||||||
return func(tokens []Token, index int32) string {
|
return func(tokens []Token, index int32) string {
|
||||||
return strings.TrimRightFunc(JoinTokens(Transform(tokens, nth)), unicode.IsSpace)
|
return JoinTokens(Transform(tokens, nth))
|
||||||
}
|
}
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,6 +184,11 @@ func (chars *Chars) TrailingWhitespaces() int {
|
|||||||
return whitespaces
|
return whitespaces
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (chars *Chars) TrimTrailingWhitespaces() {
|
||||||
|
whitespaces := chars.TrailingWhitespaces()
|
||||||
|
chars.slice = chars.slice[0 : len(chars.slice)-whitespaces]
|
||||||
|
}
|
||||||
|
|
||||||
func (chars *Chars) TrimSuffix(runes []rune) {
|
func (chars *Chars) TrimSuffix(runes []rune) {
|
||||||
lastIdx := len(chars.slice)
|
lastIdx := len(chars.slice)
|
||||||
firstIdx := lastIdx - len(runes)
|
firstIdx := lastIdx - len(runes)
|
||||||
|
|||||||
Reference in New Issue
Block a user