Skip to content

Commit

Permalink
Do not disable mouse after execute(-silent) when --height option is used
Browse files Browse the repository at this point in the history
The action takes place in the alternate screen so the offsets should
still be correct.
  • Loading branch information
junegunn committed May 17, 2020
1 parent ace92ba commit 97a725f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1422,13 +1422,13 @@ func (t *Terminal) executeCommand(template string, forcePlus bool, background bo
cmd.Stderr = os.Stderr
t.tui.Pause(true)
cmd.Run()
t.tui.Resume(true)
t.tui.Resume(true, false)
t.redraw()
t.refresh()
} else {
t.tui.Pause(false)
cmd.Run()
t.tui.Resume(false)
t.tui.Resume(false, false)
}
cleanTemporaryFiles()
}
Expand Down Expand Up @@ -1701,7 +1701,7 @@ func (t *Terminal) Loop() {
case reqRefresh:
t.suppress = false
case reqReinit:
t.tui.Resume(t.fullscreen)
t.tui.Resume(t.fullscreen, true)
t.redraw()
case reqRedraw:
t.redraw()
Expand Down
12 changes: 6 additions & 6 deletions src/tui/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const (
Reverse = Attr(1 << 6)
)

func (r *FullscreenRenderer) Init() {}
func (r *FullscreenRenderer) Pause(bool) {}
func (r *FullscreenRenderer) Resume(bool) {}
func (r *FullscreenRenderer) Clear() {}
func (r *FullscreenRenderer) Refresh() {}
func (r *FullscreenRenderer) Close() {}
func (r *FullscreenRenderer) Init() {}
func (r *FullscreenRenderer) Pause(bool) {}
func (r *FullscreenRenderer) Resume(bool, bool) {}
func (r *FullscreenRenderer) Clear() {}
func (r *FullscreenRenderer) Refresh() {}
func (r *FullscreenRenderer) Close() {}

func (r *FullscreenRenderer) DoesAutoWrap() bool { return false }
func (r *FullscreenRenderer) GetChar() Event { return Event{} }
Expand Down
10 changes: 5 additions & 5 deletions src/tui/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ func (r *LightRenderer) Pause(clear bool) {
}
}

func (r *LightRenderer) Resume(clear bool) {
func (r *LightRenderer) Resume(clear bool, sigcont bool) {
r.setupTerminal()
if clear {
if r.fullscreen {
Expand All @@ -570,10 +570,10 @@ func (r *LightRenderer) Resume(clear bool) {
r.rmcup()
}
r.flush()
} else if !r.fullscreen && r.mouse {
// NOTE: Resume(false) is only called on SIGCONT after SIGSTOP.
// And It's highly likely that the offset we obtained at the beginning will
// no longer be correct, so we simply disable mouse input.
} else if sigcont && !r.fullscreen && r.mouse {
// NOTE: SIGCONT (Coming back from CTRL-Z):
// It's highly likely that the offset we obtained at the beginning is
// no longer correct, so we simply disable mouse input.
r.csi("?1000l")
r.mouse = false
}
Expand Down
2 changes: 1 addition & 1 deletion src/tui/tcell.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func (r *FullscreenRenderer) Pause(clear bool) {
}
}

func (r *FullscreenRenderer) Resume(clear bool) {
func (r *FullscreenRenderer) Resume(clear bool, sigcont bool) {
if clear {
r.initScreen()
}
Expand Down
2 changes: 1 addition & 1 deletion src/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func MakeTransparentBorder() BorderStyle {
type Renderer interface {
Init()
Pause(clear bool)
Resume(clear bool)
Resume(clear bool, sigcont bool)
Clear()
RefreshWindows(windows []Window)
Refresh()
Expand Down

0 comments on commit 97a725f

Please sign in to comment.