Skip to content
Myr

Do not apply nth style when the whole range is covered

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent b712f2b · Browse files · 3 files+25 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+25 added−2 removed

  • other:+25 added−2 removed

3 files+25 added−2 removed

modified:src/terminal.go+20 added-1 removed
2722 unmodified lines
2723 charOffsets[idx] = offset2724 }2725 sort.Sort(ByOrder(charOffsets))2726 }27272728 wholeCovered := len(t.nthCurrent) == 02729 for _, nth := range t.nthCurrent {2730 // Do we still want to apply a different style when the current nth2731 // covers the whole string? Probably not. And we can simplify the logic.2732 if nth.IsFull() {2733 wholeCovered = true2734 break2735 }2736 }2737 // But if 'nth' is set to 'regular', it's a sign that you're applying2738 // a different style to the rest of the string. e.g. 'nth:regular,fg:dim'2739 // In this case, we still need to apply and clear the style.2740 // We do the same when postTask is nil, which means we're printing header lines.2741 if t.nthAttr == tui.AttrRegular && wholeCovered || postTask == nil {2742 if t.nthAttr == tui.AttrRegular {2743 colBase = colBase.WithAttr(t.nthAttr)2744 }2745 }2746 var nthOffsets []Offset2728 if len(t.nthCurrent) > 0 && t.nthAttr > 0 && postTask != nil {2747 if !wholeCovered && t.nthAttr > 0 && postTask != nil {2748 var tokens []Token2749 if item.transformed != nil {2750 tokens = item.transformed.tokens2751 } else {
3108 unmodified lines
modified:src/tokenizer.go+4 added
16 unmodified lines
17 begin int18 end int19}2021func (r Range) IsFull() bool {22 return r.begin == rangeEllipsis && r.end == rangeEllipsis23}2425func RangesToString(ranges []Range) string {26 strs := []string{}27 for _, r := range ranges {28 s := ""
255 unmodified lines
modified:CHANGELOG.md+1 added-1 removed
93 unmodified lines
9495 # With 'change-nth'. The current nth option is exported as $FZF_NTH.96 ps -ef | fzf --reverse --header-lines 1 --header-border bottom --input-border \97 --color nth:regular,fg:dim,current-fg:dim \98 --nth 8.. --bind 'ctrl-n:change-nth(1|2|3|4|5|6|7|)' \98 --bind 'ctrl-n:change-nth(8..|1|2|3|4|5|6|7|)' \99 --bind 'result:transform-prompt:echo "${FZF_NTH}> "'100 ```101- A single-character delimiter is now treated as a plain string delimiter rather than a regular expression delimiter, even if it's a regular expression meta-character.102 - This means you can just write `--delimiter '|'` instead of escaping it as `--delimiter '\|'`
2332 unmodified lines