diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2021-02-02 00:08:54 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2021-02-02 00:11:05 +0900 |
commit | f55c990e863e995809912bded64fde4431e1961a (patch) | |
tree | 71bfaa58e30168b376091f991ddb68c2e42f782d /src | |
parent | d110372f99fe4cc905f7dea19f8f2eb4ee593c7b (diff) |
Add `close` action
Close #2331
Diffstat (limited to 'src')
-rw-r--r-- | src/options.go | 2 | ||||
-rw-r--r-- | src/terminal.go | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/options.go b/src/options.go index cee11ffc..a55dc340 100644 --- a/src/options.go +++ b/src/options.go @@ -883,6 +883,8 @@ func parseKeymap(keymap map[tui.Event][]action, str string) { appendAction(actSelectAll) case "deselect-all": appendAction(actDeselectAll) + case "close": + appendAction(actClose) case "toggle": appendAction(actToggle) case "down": diff --git a/src/terminal.go b/src/terminal.go index f5fb4803..fa9adb88 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -221,6 +221,7 @@ const ( actClearScreen actClearQuery actClearSelection + actClose actDeleteChar actDeleteCharEOF actEndOfLine @@ -2334,6 +2335,12 @@ func (t *Terminal) Loop() { } req(reqList, reqInfo) } + case actClose: + if t.isPreviewEnabled() { + togglePreview(false) + } else { + req(reqQuit) + } case actToggle: if t.multi > 0 && t.merger.Length() > 0 && toggle() { req(reqList) |