mirror of
https://github.com/junegunn/fzf.git
synced 2026-05-25 17:58:50 +08:00
Reorder info line: N/M (X) (S%) +S +T*
Flags that appear/disappear are now at the end, so the multi-select indicator stays in a fixed position and doesn't flicker.
This commit is contained in:
+10
-10
@@ -3030,6 +3030,16 @@ func (t *Terminal) printInfoImpl() {
|
|||||||
found := t.resultMerger.Length()
|
found := t.resultMerger.Length()
|
||||||
total := max(found, t.count)
|
total := max(found, t.count)
|
||||||
output := fmt.Sprintf("%d/%d", found, total)
|
output := fmt.Sprintf("%d/%d", found, total)
|
||||||
|
if t.multi > 0 {
|
||||||
|
if t.multi == maxMulti {
|
||||||
|
output += fmt.Sprintf(" (%d)", len(t.selected))
|
||||||
|
} else {
|
||||||
|
output += fmt.Sprintf(" (%d/%d)", len(t.selected), t.multi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if t.progress > 0 && t.progress < 100 {
|
||||||
|
output += fmt.Sprintf(" (%d%%)", t.progress)
|
||||||
|
}
|
||||||
if t.toggleSort {
|
if t.toggleSort {
|
||||||
if t.sort {
|
if t.sort {
|
||||||
output += " +S"
|
output += " +S"
|
||||||
@@ -3050,16 +3060,6 @@ func (t *Terminal) printInfoImpl() {
|
|||||||
output += " +t"
|
output += " +t"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.multi > 0 {
|
|
||||||
if t.multi == maxMulti {
|
|
||||||
output += fmt.Sprintf(" (%d)", len(t.selected))
|
|
||||||
} else {
|
|
||||||
output += fmt.Sprintf(" (%d/%d)", len(t.selected), t.multi)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if t.progress > 0 && t.progress < 100 {
|
|
||||||
output += fmt.Sprintf(" (%d%%)", t.progress)
|
|
||||||
}
|
|
||||||
if t.failed != nil && t.count == 0 {
|
if t.failed != nil && t.count == 0 {
|
||||||
output = fmt.Sprintf("[Command failed: %s]", *t.failed)
|
output = fmt.Sprintf("[Command failed: %s]", *t.failed)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -404,11 +404,11 @@ class TestCore < TestInteractive
|
|||||||
tmux.send_keys "seq 1 111 | #{fzf("-m +s --tac #{opt} -q11")}", :Enter
|
tmux.send_keys "seq 1 111 | #{fzf("-m +s --tac #{opt} -q11")}", :Enter
|
||||||
tmux.until { |lines| assert_equal '> 111', lines[-3] }
|
tmux.until { |lines| assert_equal '> 111', lines[-3] }
|
||||||
tmux.send_keys :Tab
|
tmux.send_keys :Tab
|
||||||
tmux.until { |lines| assert_equal ' 4/111 -S (1)', lines[-2] }
|
tmux.until { |lines| assert_equal ' 4/111 (1) -S', lines[-2] }
|
||||||
tmux.send_keys 'C-R'
|
tmux.send_keys 'C-R'
|
||||||
tmux.until { |lines| assert_equal '> 11', lines[-3] }
|
tmux.until { |lines| assert_equal '> 11', lines[-3] }
|
||||||
tmux.send_keys :Tab
|
tmux.send_keys :Tab
|
||||||
tmux.until { |lines| assert_equal ' 4/111 +S (2)', lines[-2] }
|
tmux.until { |lines| assert_equal ' 4/111 (2) +S', lines[-2] }
|
||||||
tmux.send_keys :Enter
|
tmux.send_keys :Enter
|
||||||
assert_equal %w[111 11], fzf_output_lines
|
assert_equal %w[111 11], fzf_output_lines
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user