diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2025-07-20 10:52:29 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2025-07-20 10:53:58 +0900 |
| commit | ead302981cc9d9219e58c1517921e9f2d68a6b6e (patch) | |
| tree | 0e4a8574ef775582c69266cb9261b969f4906e90 | |
| parent | fe0ffa14ffb1d4b1c441889d4736fe1063bf65ca (diff) | |
| download | fzf-ead302981cc9d9219e58c1517921e9f2d68a6b6e.tar.gz | |
Add support for {*n} and {*nf} placeholder
Close #4458
| -rw-r--r-- | src/terminal.go | 2 | ||||
| -rw-r--r-- | test/test_preview.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/terminal.go b/src/terminal.go index 748a2dfc..95977614 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -67,7 +67,7 @@ const maxFocusEvents = 10000 const blockDuration = 1 * time.Second func init() { - placeholder = regexp.MustCompile(`\\?(?:{[+*sfr]*[0-9,-.]*}|{q(?::s?[0-9,-.]+)?}|{fzf:(?:query|action|prompt)}|{\+?f?nf?})`) + placeholder = regexp.MustCompile(`\\?(?:{[+*sfr]*[0-9,-.]*}|{q(?::s?[0-9,-.]+)?}|{fzf:(?:query|action|prompt)}|{[+*]?f?nf?})`) whiteSuffix = regexp.MustCompile(`\s*$`) offsetComponentRegex = regexp.MustCompile(`([+-][0-9]+)|(-?/[1-9][0-9]*)`) offsetTrimCharsRegex = regexp.MustCompile(`[^0-9/+-]`) diff --git a/test/test_preview.rb b/test/test_preview.rb index fa05fbcb..d14d9f68 100644 --- a/test/test_preview.rb +++ b/test/test_preview.rb @@ -190,17 +190,17 @@ class TestPreview < TestInteractive end def test_preview_asterisk - tmux.send_keys %(seq 5 | #{FZF} --multi --preview 'echo [{} / {+} / {*}]' --preview-window '+{1}'), :Enter + tmux.send_keys %(seq 5 | #{FZF} --multi --preview 'echo [{}/{+}/{*}/{*n}]' --preview-window '+{1}'), :Enter tmux.until { |lines| assert_equal 5, lines.match_count } - tmux.until { |lines| assert_includes lines[1], ' [1 / 1 / 1 2 3 4 5] ' } + tmux.until { |lines| assert_includes lines[1], ' [1/1/1 2 3 4 5/0 1 2 3 4] ' } tmux.send_keys :BTab - tmux.until { |lines| assert_includes lines[1], ' [2 / 1 / 1 2 3 4 5] ' } + tmux.until { |lines| assert_includes lines[1], ' [2/1/1 2 3 4 5/0 1 2 3 4] ' } tmux.send_keys :BTab - tmux.until { |lines| assert_includes lines[1], ' [3 / 1 2 / 1 2 3 4 5] ' } + tmux.until { |lines| assert_includes lines[1], ' [3/1 2/1 2 3 4 5/0 1 2 3 4] ' } tmux.send_keys '5' - tmux.until { |lines| assert_includes lines[1], ' [5 / 1 2 / 5] ' } + tmux.until { |lines| assert_includes lines[1], ' [5/1 2/5/4] ' } tmux.send_keys '5' - tmux.until { |lines| assert_includes lines[1], ' [ / 1 2 / ] ' } + tmux.until { |lines| assert_includes lines[1], ' [/1 2//] ' } end def test_preview_file |
