Skip to content
Myr

Fix query precedence in an action chain (#4326)

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

When 'search' and any action that modifies the query are in an action chain, anything that comes later takes precedence.

authored by Junegunn Choi · committed by Junegunn Choi · parent 4a0ab6c · Browse files · 2 files+11 added−3 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+11 added−3 removed

  • tests:+9 added−0 removed
  • other:+2 added−3 removed

2 files+11 added−3 removed

modified:src/terminal.go+2 added-3 removed
6037 unmodified lines
6038 // Always just discard the change6039 t.input = currentInput6040 t.cx = len(t.input)6041 beof = false6042 } else if string(t.input) != string(currentInput) {6043 t.inputOverride = nil6044 }6045 return true6046 }6047
17 unmodified lines
6065 if !t.inputless {6066 t.truncateQuery()6067 }6068 queryChanged = queryChanged || t.pasting == nil && string(previousInput) != string(t.input)6067 if queryChanged {6068 t.inputOverride = nil6069 }6069 changed = changed || queryChanged6070 if onChanges, prs := t.keymap[tui.Change.AsEvent()]; queryChanged && prs && !doActions(onChanges) {6071 continue6072 }
262 unmodified lines
modified:test/test_core.rb+9 added
1879 unmodified lines
1880 refute_includes lines, '>>999'1881 assert_includes lines, '> 555'1882 end1883 end18841885 def test_search_override_query_in_no_input_mode1886 tmux.send_keys %(seq 1000 | #{FZF} --sync --no-input --bind 'enter:show-input+change-query(555)+hide-input+search(999),space:search(111)+show-input+change-query(777)'), :Enter1887 tmux.until { |lines| assert_includes lines, '> 1' }1888 tmux.send_keys :Enter1889 tmux.until { |lines| assert_includes lines, '> 999' }1890 tmux.send_keys :Space1891 tmux.until { |lines| assert_includes lines, '> 777' }1892 end1893end