summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-07-19 13:17:06 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-07-19 13:17:06 +0900
commita9e64efe450b2bddedbea852662b0b58656e949b (patch)
tree92d8fc28f8d51218931782b38c69b5d839562ad1
parent6b5886c034800c46d25a02c8b91c2797ec5fb6d6 (diff)
Fix regression: output printed on alternate screen
-rw-r--r--src/terminal.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 2863f1a5..03381368 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -1343,14 +1343,12 @@ func (t *Terminal) Loop() {
}()
}
- exit := func(code int, printQuery bool) {
+ exit := func(getCode func() int) {
if !t.cleanExit && t.fullscreen && t.inlineInfo {
t.placeCursor()
}
t.tui.Close()
- if printQuery {
- t.printer(string(t.input))
- }
+ code := getCode()
if code <= exitNoMatch && t.history != nil {
t.history.append(string(t.input))
}
@@ -1398,11 +1396,12 @@ func (t *Terminal) Loop() {
case reqRedraw:
t.redraw()
case reqClose:
- if t.output() {
- exit(exitOk, false)
- } else {
- exit(exitNoMatch, false)
- }
+ exit(func() int {
+ if t.output() {
+ return exitOk
+ }
+ return exitNoMatch
+ })
case reqPreviewDisplay:
t.previewer.text = value.(string)
t.previewer.lines = strings.Count(t.previewer.text, "\n")
@@ -1411,9 +1410,12 @@ func (t *Terminal) Loop() {
case reqPreviewRefresh:
t.printPreview()
case reqPrintQuery:
- exit(exitOk, true)
+ exit(func() int {
+ t.printer(string(t.input))
+ return exitOk
+ })
case reqQuit:
- exit(exitInterrupt, false)
+ exit(func() int { return exitInterrupt })
}
}
t.placeCursor()