Skip to content
Myr

Add 'multi' event triggered on multi-selection changes

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

authored by Junegunn Choi · committed by Junegunn Choi · parent d7db7fc · Browse files · 6 files+31 added−4 removed
This commit

State

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

Diff stats

6 files+31 added−4 removed

  • tests:+11 added−0 removed
  • other:+20 added−4 removed

6 files+31 added−4 removed

modified:man/man1/fzf.1+6 added-2 removed
19 unmodified lines
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22THE SOFTWARE.23..24.TH fzf 1 "Jun 2025" "fzf 0.63.0" "fzf - a command-line fuzzy finder"24.TH fzf 1 "Jul 2025" "fzf 0.64.0" "fzf - a command-line fuzzy finder"2526.SH NAME27fzf - a command-line fuzzy finder28
1579 unmodified lines
16081609 # Beware not to introduce an infinite loop1610 seq 10 | fzf \-\-bind 'focus:up' \-\-cycle\fR1611.RE1612\fImulti\fR1613.RS1614Triggered when the multi\-selection has changed.1615.RE16161617\fIone\fR1618.RS1619Triggered when there's only one match. \fBone:accept\fR binding is comparable
94 unmodified lines
1714 \fBchange\-preview\-window(...)\fR (change \fB\-\-preview\-window\fR option; rotate through the multiple option sets separated by '|')1715 \fBchange\-prompt(...)\fR (change prompt to the given string)1716 \fBchange\-query(...)\fR (change query string to the given string)1717 \fBclear\-screen\fR \fIctrl\-l\fR1714 \fBclear\-selection\fR (clear multi\-selection)1718 \fBclear\-multi\fR (clear multi\-selection)1719 \fBclose\fR (close preview window if open, abort fzf otherwise)1720 \fBclear\-query\fR (clear query string)1721 \fBdelete\-char\fR \fIdel\fR1722 \fBdelete\-char/eof\fR \fIctrl\-d\fR (same as \fBdelete\-char\fR except aborts fzf if query is empty)
292 unmodified lines
modified:src/tui/tui.go+1 added
130 unmodified lines
131 Result132 Jump133 JumpCancel134 ClickHeader135 Multi136)137138func (t EventType) AsEvent() Event {139 return Event{t, 0, nil}
1013 unmodified lines
modified:src/options.go+3 added-1 removed
1006 unmodified lines
1007 case "jump-cancel":1008 add(tui.JumpCancel)1009 case "click-header":1010 add(tui.ClickHeader)1011 case "multi":1012 add(tui.Multi)1013 case "alt-enter", "alt-return":1014 chords[tui.CtrlAltKey('m')] = key1015 case "alt-space":1016 chords[tui.AltKey(' ')] = key
545 unmodified lines
1562 case "cancel":1563 appendAction(actCancel)1564 case "clear-query":1565 appendAction(actClearQuery)1564 case "clear-selection":1566 case "clear-multi", "clear-selection":1567 appendAction(actClearSelection)1568 case "forward-char":1569 appendAction(actForwardChar)1570 case "forward-word":
2046 unmodified lines
modified:src/terminal.go+4 added
5397 unmodified lines
5398 }5399 }5400 previousInput := t.input5401 previousCx := t.cx5402 previousVersion := t.version5403 t.lastKey = event.KeyName()5404 updatePreviewWindow := func(forcePreview bool) {5405 t.resizeWindows(forcePreview, false)5406 req(reqPrompt, reqList, reqInfo, reqHeader, reqFooter)
1249 unmodified lines
6656 }6657 if onEOFs, prs := t.keymap[tui.BackwardEOF.AsEvent()]; beof && prs && !doActions(onEOFs) {6658 continue6659 }6660 if onMultis, prs := t.keymap[tui.Multi.AsEvent()]; t.version != previousVersion && prs && !doActions(onMultis) {6661 continue6662 }6663 } else {6664 jumpEvent := tui.JumpCancel6665 if event.Type == tui.Rune {6666 if idx := strings.IndexRune(t.jumpLabels, event.Char); idx >= 0 && idx < t.maxItems() && idx < t.merger.Length() {
259 unmodified lines
modified:test/test_core.rb+11 added
1986 unmodified lines
1987 tmux.until { assert_equal 100, it.match_count }1988 tmux.until { assert it.any_include?('boom') }1989 tmux.until { assert it.any_include?('bam') }1990 end19911992 def test_multi_event1993 tmux.send_keys %(seq 100 | #{FZF} --multi --bind 'multi:transform-footer:(( FZF_SELECT_COUNT )) && echo "Selected $FZF_SELECT_COUNT item(s)"'), :Enter1994 tmux.until { assert_equal 100, it.match_count }1995 tmux.send_keys :Tab1996 tmux.until { assert_equal 1, it.select_count }1997 tmux.until { assert it.any_include?('Selected 1 item(s)') }1998 tmux.send_keys :Tab1999 tmux.until { assert_equal 0, it.select_count }2000 tmux.until { refute it.any_include?('Selected') }2001 end2002end
modified:CHANGELOG.md+6 added-1 removed
1CHANGELOG2=========340.63.140.64.05------6- Added `multi` event that is triggered when the multi-selection has changed.7 ```sh8 fzf --multi --bind 'multi:transform-footer:(( FZF_SELECT_COUNT )) && echo "Selected: $FZF_SELECT_COUNT item(s)"'9 ```10- [Halfwidth and fullwidth alphanumeric and punctuation characters](https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block)) are now internally normalized to their ASCII equivalents to allow matching with ASCII queries.11 ```sh12 echo ABC| fzf -q abc13 ```14- Fixed a bug which caused fzf to abort due to incorrect update ordering.15- Renamed `clear-selection` action to `clear-multi` for consistency.16170.63.018------19_Release highlights: https://junegunn.github.io/fzf/releases/0.63.0/_
2715 unmodified lines