mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-16 02:07:06 +00:00
Remove duplicate code
This commit is contained in:
parent
0e0de29b87
commit
01ee335521
@ -173,14 +173,6 @@ func joinTokens(tokens []Token) []rune {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func joinTokensAsRunes(tokens []Token) []rune {
|
|
||||||
ret := []rune{}
|
|
||||||
for _, token := range tokens {
|
|
||||||
ret = append(ret, token.text.ToRunes()...)
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transform is used to transform the input when --with-nth option is given
|
// Transform is used to transform the input when --with-nth option is given
|
||||||
func Transform(tokens []Token, withNth []Range) []Token {
|
func Transform(tokens []Token, withNth []Range) []Token {
|
||||||
transTokens := make([]Token, len(withNth))
|
transTokens := make([]Token, len(withNth))
|
||||||
@ -191,7 +183,7 @@ func Transform(tokens []Token, withNth []Range) []Token {
|
|||||||
if r.begin == r.end {
|
if r.begin == r.end {
|
||||||
idx := r.begin
|
idx := r.begin
|
||||||
if idx == rangeEllipsis {
|
if idx == rangeEllipsis {
|
||||||
parts = append(parts, util.RunesToChars(joinTokensAsRunes(tokens)))
|
parts = append(parts, util.RunesToChars(joinTokens(tokens)))
|
||||||
} else {
|
} else {
|
||||||
if idx < 0 {
|
if idx < 0 {
|
||||||
idx += numTokens + 1
|
idx += numTokens + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user