mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 00:03:39 -05:00
@@ -632,6 +632,8 @@ func parseKeyChordsImpl(str string, message string, exit func(string)) map[tui.E
|
||||
add(tui.Focus)
|
||||
case "one":
|
||||
add(tui.One)
|
||||
case "zero":
|
||||
add(tui.Zero)
|
||||
case "alt-enter", "alt-return":
|
||||
chords[tui.CtrlAltKey('m')] = key
|
||||
case "alt-space":
|
||||
|
||||
@@ -956,10 +956,18 @@ func (t *Terminal) UpdateList(merger *Merger, reset bool) {
|
||||
t.cy = count - util.Min(count, t.maxItems()) + pos
|
||||
}
|
||||
}
|
||||
if !t.reading && t.merger.Length() == 1 {
|
||||
one := tui.One.AsEvent()
|
||||
if _, prs := t.keymap[one]; prs {
|
||||
t.eventChan <- one
|
||||
if !t.reading {
|
||||
switch t.merger.Length() {
|
||||
case 0:
|
||||
zero := tui.Zero.AsEvent()
|
||||
if _, prs := t.keymap[zero]; prs {
|
||||
t.eventChan <- zero
|
||||
}
|
||||
case 1:
|
||||
one := tui.One.AsEvent()
|
||||
if _, prs := t.keymap[one]; prs {
|
||||
t.eventChan <- one
|
||||
}
|
||||
}
|
||||
}
|
||||
t.mutex.Unlock()
|
||||
@@ -2854,7 +2862,7 @@ func (t *Terminal) Loop() {
|
||||
}
|
||||
select {
|
||||
case event = <-t.eventChan:
|
||||
needBarrier = event != tui.Load.AsEvent()
|
||||
needBarrier = !event.Is(tui.Load, tui.One, tui.Zero)
|
||||
case actions = <-t.serverChan:
|
||||
event = tui.Invalid.AsEvent()
|
||||
needBarrier = false
|
||||
|
||||
@@ -94,6 +94,7 @@ const (
|
||||
Load
|
||||
Focus
|
||||
One
|
||||
Zero
|
||||
|
||||
AltBS
|
||||
|
||||
@@ -283,6 +284,15 @@ type Event struct {
|
||||
MouseEvent *MouseEvent
|
||||
}
|
||||
|
||||
func (e Event) Is(types ...EventType) bool {
|
||||
for _, t := range types {
|
||||
if e.Type == t {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type MouseEvent struct {
|
||||
Y int
|
||||
X int
|
||||
|
||||
Reference in New Issue
Block a user