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

Add 'start' event that is triggered once when fzf finder starts

Close #1622
This commit is contained in:
Junegunn Choi
2022-10-27 00:33:05 +09:00
parent 170fc517d0
commit 168829b555
6 changed files with 39 additions and 2 deletions

View File

@@ -543,6 +543,8 @@ func parseKeyChords(str string, message string) map[tui.Event]string {
add(tui.Change)
case "backward-eof":
add(tui.BackwardEOF)
case "start":
add(tui.Start)
case "alt-enter", "alt-return":
chords[tui.CtrlAltKey('m')] = key
case "alt-space":

View File

@@ -2362,13 +2362,21 @@ func (t *Terminal) Loop() {
}()
looping := true
_, startEvent := t.keymap[tui.Start.AsEvent()]
for looping {
var newCommand *string
changed := false
beof := false
queryChanged := false
event := t.tui.GetChar()
var event tui.Event
if startEvent {
event = tui.Start.AsEvent()
startEvent = false
} else {
event = t.tui.GetChar()
}
t.mutex.Lock()
previousInput := t.input

View File

@@ -90,6 +90,7 @@ const (
Change
BackwardEOF
Start
AltBS