Skip to content
Myr

Fix ghost text with inline info

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

Fix #4312

authored by Junegunn Choi · committed by Junegunn Choi · parent 4298c0b · Browse files · 2 files+21 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

2 files+21 added−2 removed

  • tests:+15 added−0 removed
  • other:+6 added−2 removed

2 files+21 added−2 removed

modified:src/terminal.go+6 added-2 removed
2483 unmodified lines
2484 output = t.executeCommand(t.infoCommand, false, true, true, true, output)2485 outputPrinter, outputLen = t.ansiLabelPrinter(output, &tui.ColInfo, false)2486 }24872488 shiftLen := t.queryLen[0] + t.queryLen[1] + 12489 if shiftLen == 1 && len(t.ghost) > 0 {2490 shiftLen = util.StringWidth(t.ghost)2491 }2492 switch t.infoStyle {2493 case infoDefault:2494 if !move(line+1, 0, t.separatorLen == 0) {2495 return
5 unmodified lines
2501 if !move(line+1, 0, false) {2502 return2503 }2504 case infoInlineRight:2501 pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 12505 pos = t.promptLen + shiftLen2506 case infoInline:2503 pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 12507 pos = t.promptLen + shiftLen2508 printInfoPrefix()2509 }25102511 if t.infoStyle == infoRight {
3797 unmodified lines
modified:test/test_core.rb+15 added
1829 unmodified lines
1830 assert_equal 100, lines.match_count1831 assert_includes lines, 'X Type in query ...'1832 end1833 end18341835 def test_ghost_inline1836 tmux.send_keys %(seq 100 | #{FZF} --info 'inline: Y' --no-separator --prompt 'X ' --ghost 'Type in query ...'), :Enter1837 tmux.until do |lines|1838 assert_includes lines, 'X Type in query ... Y100/100'1839 end1840 tmux.send_keys '100'1841 tmux.until do |lines|1842 assert_includes lines, 'X 100 Y1/100'1843 end1844 tmux.send_keys 'C-u'1845 tmux.until do |lines|1846 assert_includes lines, 'X Type in query ... Y100/100'1847 end1848 end1849end