terminal: properly handle cursor display
The terminal widget reports if the cursor should be displayed. Properly handle this output to report cursor display back to aerc. Reported-by: staceee Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
c3bb3aa2a8
commit
847c1cd3c3
1 changed files with 13 additions and 15 deletions
|
@ -16,7 +16,6 @@ type Terminal struct {
|
|||
closed bool
|
||||
cmd *exec.Cmd
|
||||
ctx *ui.Context
|
||||
cursorShown bool
|
||||
destroyed bool
|
||||
focus bool
|
||||
vterm *tcellterm.Terminal
|
||||
|
@ -30,10 +29,9 @@ type Terminal struct {
|
|||
|
||||
func NewTerminal(cmd *exec.Cmd) (*Terminal, error) {
|
||||
term := &Terminal{
|
||||
cursorShown: true,
|
||||
cmd: cmd,
|
||||
vterm: tcellterm.New(),
|
||||
}
|
||||
term.cmd = cmd
|
||||
term.vterm = tcellterm.New()
|
||||
return term, nil
|
||||
}
|
||||
|
||||
|
@ -98,12 +96,12 @@ func (term *Terminal) Draw(ctx *ui.Context) {
|
|||
func (term *Terminal) draw() {
|
||||
term.vterm.Draw()
|
||||
if term.focus && !term.closed && term.ctx != nil {
|
||||
if !term.cursorShown {
|
||||
term.ctx.HideCursor()
|
||||
} else {
|
||||
_, x, y, style := term.vterm.GetCursor()
|
||||
vis, x, y, style := term.vterm.GetCursor()
|
||||
if vis {
|
||||
term.ctx.SetCursor(x, y)
|
||||
term.ctx.SetCursorStyle(style)
|
||||
} else {
|
||||
term.ctx.HideCursor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue