summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-03-25 21:06:04 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-03-25 21:08:06 +0900
commitf43e82f17fb107d2093e6226833eb68e532c1810 (patch)
tree599d311b2a0107e1390c99ab75be277dc9f77dbd
parent62238620a50566a1941dbb250f7b9ffc3174feae (diff)
downloadfzf-f43e82f17fb107d2093e6226833eb68e532c1810.tar.gz
Do not ignore current query when input is hidden
* The initial query given by --query should be respected * The current query should still be respected after `hide-input` (or `toggle-input) Fix #4327
-rw-r--r--src/terminal.go5
-rw-r--r--test/test_core.rb10
2 files changed, 11 insertions, 4 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 0182d196..03af52a0 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -1418,10 +1418,7 @@ func (t *Terminal) Input() (bool, []rune) {
t.mutex.Lock()
defer t.mutex.Unlock()
paused := t.paused
- var src []rune
- if !t.inputless {
- src = t.input
- }
+ src := t.input
if t.inputOverride != nil {
paused = false
src = *t.inputOverride
diff --git a/test/test_core.rb b/test/test_core.rb
index 235fe52a..ade644a2 100644
--- a/test/test_core.rb
+++ b/test/test_core.rb
@@ -1856,4 +1856,14 @@ class TestCore < TestInteractive
tmux.send_keys :Space
tmux.until { |lines| assert_includes lines[line + 2], "> 5" }
end
+
+ def test_no_input_query
+ tmux.send_keys %(seq 1000 | #{FZF} --no-input --query 555 --bind space:toggle-input), :Enter
+ tmux.until { |lines| assert_includes lines, '> 555' }
+ tmux.send_keys :Space
+ tmux.until do |lines|
+ assert_equal 1, lines.match_count
+ assert_includes lines, '> 555'
+ end
+ end
end