m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Add 'multi' event triggered on multi-selection changes

This commit is contained in:
Junegunn Choi
2025-07-06 10:05:25 +09:00
parent d7db7fc132
commit 6e3c830cd2
6 changed files with 31 additions and 4 deletions

View File

@@ -1008,6 +1008,8 @@ func parseKeyChordsImpl(str string, message string) (map[tui.Event]string, error
add(tui.JumpCancel)
case "click-header":
add(tui.ClickHeader)
case "multi":
add(tui.Multi)
case "alt-enter", "alt-return":
chords[tui.CtrlAltKey('m')] = key
case "alt-space":
@@ -1561,7 +1563,7 @@ func parseActionList(masked string, original string, prevActions []*action, putA
appendAction(actCancel)
case "clear-query":
appendAction(actClearQuery)
case "clear-selection":
case "clear-multi", "clear-selection":
appendAction(actClearSelection)
case "forward-char":
appendAction(actForwardChar)

View File

@@ -5399,6 +5399,7 @@ func (t *Terminal) Loop() error {
}
previousInput := t.input
previousCx := t.cx
previousVersion := t.version
t.lastKey = event.KeyName()
updatePreviewWindow := func(forcePreview bool) {
t.resizeWindows(forcePreview, false)
@@ -6656,6 +6657,9 @@ func (t *Terminal) Loop() error {
if onEOFs, prs := t.keymap[tui.BackwardEOF.AsEvent()]; beof && prs && !doActions(onEOFs) {
continue
}
if onMultis, prs := t.keymap[tui.Multi.AsEvent()]; t.version != previousVersion && prs && !doActions(onMultis) {
continue
}
} else {
jumpEvent := tui.JumpCancel
if event.Type == tui.Rune {

View File

@@ -132,6 +132,7 @@ const (
Jump
JumpCancel
ClickHeader
Multi
)
func (t EventType) AsEvent() Event {