mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 11:29:01 +00:00
Reenable mouse mode when coming back from an external program
Close #3141
This commit is contained in:
parent
aa7361337d
commit
91b9591b10
@ -174,11 +174,7 @@ func (r *LightRenderer) Init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.mouse {
|
r.enableMouse()
|
||||||
r.csi("?1000h")
|
|
||||||
r.csi("?1002h")
|
|
||||||
r.csi("?1006h")
|
|
||||||
}
|
|
||||||
r.csi(fmt.Sprintf("%dA", r.MaxY()-1))
|
r.csi(fmt.Sprintf("%dA", r.MaxY()-1))
|
||||||
r.csi("G")
|
r.csi("G")
|
||||||
r.csi("K")
|
r.csi("K")
|
||||||
@ -621,6 +617,23 @@ func (r *LightRenderer) Pause(clear bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *LightRenderer) enableMouse() {
|
||||||
|
if r.mouse {
|
||||||
|
r.csi("?1000h")
|
||||||
|
r.csi("?1002h")
|
||||||
|
r.csi("?1006h")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *LightRenderer) disableMouse() {
|
||||||
|
if r.mouse {
|
||||||
|
r.csi("?1000l")
|
||||||
|
r.csi("?1002l")
|
||||||
|
r.csi("?1006l")
|
||||||
|
r.mouse = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (r *LightRenderer) Resume(clear bool, sigcont bool) {
|
func (r *LightRenderer) Resume(clear bool, sigcont bool) {
|
||||||
r.setupTerminal()
|
r.setupTerminal()
|
||||||
if clear {
|
if clear {
|
||||||
@ -629,15 +642,13 @@ func (r *LightRenderer) Resume(clear bool, sigcont bool) {
|
|||||||
} else {
|
} else {
|
||||||
r.rmcup()
|
r.rmcup()
|
||||||
}
|
}
|
||||||
|
r.enableMouse()
|
||||||
r.flush()
|
r.flush()
|
||||||
} else if sigcont && !r.fullscreen && r.mouse {
|
} else if sigcont && !r.fullscreen {
|
||||||
// NOTE: SIGCONT (Coming back from CTRL-Z):
|
// NOTE: SIGCONT (Coming back from CTRL-Z):
|
||||||
// It's highly likely that the offset we obtained at the beginning is
|
// It's highly likely that the offset we obtained at the beginning is
|
||||||
// no longer correct, so we simply disable mouse input.
|
// no longer correct, so we simply disable mouse input.
|
||||||
r.csi("?1000l")
|
r.disableMouse()
|
||||||
r.csi("?1002l")
|
|
||||||
r.csi("?1006l")
|
|
||||||
r.mouse = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,11 +689,7 @@ func (r *LightRenderer) Close() {
|
|||||||
} else if !r.fullscreen {
|
} else if !r.fullscreen {
|
||||||
r.csi("u")
|
r.csi("u")
|
||||||
}
|
}
|
||||||
if r.mouse {
|
r.disableMouse()
|
||||||
r.csi("?1000l")
|
|
||||||
r.csi("?1002l")
|
|
||||||
r.csi("?1006l")
|
|
||||||
}
|
|
||||||
r.flush()
|
r.flush()
|
||||||
r.closePlatform()
|
r.closePlatform()
|
||||||
r.restoreTerminal()
|
r.restoreTerminal()
|
||||||
|
Loading…
Reference in New Issue
Block a user