From 8ec917b1c36ed1cf6ace64419307aa85fda4bee3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 1 Apr 2023 17:16:02 +0900 Subject: Add 'one' event Close #2629 Close #2494 Close #459 --- src/options.go | 2 ++ src/terminal.go | 6 ++++++ src/tui/tui.go | 1 + 3 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/options.go b/src/options.go index 36ca7710..8703c0ec 100644 --- a/src/options.go +++ b/src/options.go @@ -622,6 +622,8 @@ func parseKeyChordsImpl(str string, message string, exit func(string)) map[tui.E add(tui.Load) case "focus": add(tui.Focus) + case "one": + add(tui.One) case "alt-enter", "alt-return": chords[tui.CtrlAltKey('m')] = key case "alt-space": diff --git a/src/terminal.go b/src/terminal.go index 57ff4f54..5ecba97b 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -932,6 +932,12 @@ 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 + } + } t.mutex.Unlock() t.reqBox.Set(reqInfo, nil) t.reqBox.Set(reqList, nil) diff --git a/src/tui/tui.go b/src/tui/tui.go index 3d67c489..b8b7ae6a 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -93,6 +93,7 @@ const ( Start Load Focus + One AltBS -- cgit v1.2.3