summaryrefslogtreecommitdiffstats
path: root/src/tui
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-03-04 11:29:31 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-03-04 11:29:31 +0900
commit53348feb8959754497453232ffacd4bd3f1154ea (patch)
treef1fd030b9e2f6ab8afbe4ea70968a929c567b083 /src/tui
parent337cdbb37c1efc49b09b4cacc6e9ee1369c7d76d (diff)
Add --no-clear option
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/light.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index fb8f4f03..2af31c4b 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -74,6 +74,7 @@ type LightRenderer struct {
theme *ColorTheme
mouse bool
forceBlack bool
+ clearOnExit bool
prevDownTime time.Time
clickY []int
ttyin *os.File
@@ -106,11 +107,12 @@ type LightWindow struct {
bg Color
}
-func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, maxHeightFunc func(int) int) Renderer {
+func NewLightRenderer(theme *ColorTheme, forceBlack bool, mouse bool, tabstop int, clearOnExit bool, maxHeightFunc func(int) int) Renderer {
r := LightRenderer{
theme: theme,
forceBlack: forceBlack,
mouse: mouse,
+ clearOnExit: clearOnExit,
ttyin: openTtyIn(),
yoffset: 0,
tabstop: tabstop,
@@ -571,14 +573,20 @@ func (r *LightRenderer) Refresh() {
func (r *LightRenderer) Close() {
// r.csi("u")
- if r.fullscreen {
- r.rmcup()
- } else {
- r.origin()
- if r.upOneLine {
- r.csi("A")
+ if r.clearOnExit {
+ if r.fullscreen {
+ r.rmcup()
+ } else {
+ r.origin()
+ if r.upOneLine {
+ r.csi("A")
+ }
+ r.csi("J")
}
- r.csi("J")
+ } else if r.fullscreen {
+ r.csi("G")
+ } else {
+ r.move(r.height, 0)
}
if r.mouse {
r.csi("?1000l")