Skip to content
Myr

Reenable mouse mode when coming back from an external program

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #3141

authored by Junegunn Choi · committed by Junegunn Choi · parent aa73613 · Browse files · 1 file+22 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+22 added−15 removed

  • other:+22 added−15 removed

1 file+22 added−15 removed

modified:src/tui/light.go+22 added-15 removed
172 unmodified lines
173 r.makeSpace()174 }175 }176177 if r.mouse {178 r.csi("?1000h")179 r.csi("?1002h")180 r.csi("?1006h")181 }177 r.enableMouse()178 r.csi(fmt.Sprintf("%dA", r.MaxY()-1))179 r.csi("G")180 r.csi("K")181 if !r.clearOnExit && !r.fullscreen {
434 unmodified lines
616 r.flush()617 }618}619620func (r *LightRenderer) enableMouse() {621 if r.mouse {622 r.csi("?1000h")623 r.csi("?1002h")624 r.csi("?1006h")625 }626}627628func (r *LightRenderer) disableMouse() {629 if r.mouse {630 r.csi("?1000l")631 r.csi("?1002l")632 r.csi("?1006l")633 r.mouse = false634 }635}636637func (r *LightRenderer) Resume(clear bool, sigcont bool) {638 r.setupTerminal()639 if clear {640 if r.fullscreen {641 r.smcup()642 } else {643 r.rmcup()644 }645 r.enableMouse()646 r.flush()633 } else if sigcont && !r.fullscreen && r.mouse {647 } else if sigcont && !r.fullscreen {648 // NOTE: SIGCONT (Coming back from CTRL-Z):649 // It's highly likely that the offset we obtained at the beginning is650 // no longer correct, so we simply disable mouse input.637 r.csi("?1000l")638 r.csi("?1002l")639 r.csi("?1006l")640 r.mouse = false651 r.disableMouse()652 }653}654655func (r *LightRenderer) Clear() {
32 unmodified lines
688 }689 } else if !r.fullscreen {690 r.csi("u")691 }681 if r.mouse {682 r.csi("?1000l")683 r.csi("?1002l")684 r.csi("?1006l")685 }692 r.disableMouse()693 r.flush()694 r.closePlatform()695 r.restoreTerminal()696}
372 unmodified lines