term: don't mess with cursor when unfocused

This commit is contained in:
Drew DeVault 2019-03-21 21:28:51 -04:00
parent 960d11c4bc
commit a602891768

View file

@ -297,17 +297,26 @@ func (term *Terminal) Draw(ctx *ui.Context) {
} }
} }
if !term.cursorShown { if term.focus {
ctx.HideCursor() if !term.cursorShown {
} else { ctx.HideCursor()
state := term.vterm.ObtainState() } else {
row, col := state.GetCursorPos() state := term.vterm.ObtainState()
ctx.SetCursor(col, row) row, col := state.GetCursorPos()
ctx.SetCursor(col, row)
}
} }
} }
func (term *Terminal) Focus(focus bool) { func (term *Terminal) Focus(focus bool) {
term.focus = focus term.focus = focus
if !term.focus {
term.ctx.HideCursor()
} else {
state := term.vterm.ObtainState()
row, col := state.GetCursorPos()
term.ctx.SetCursor(col, row)
}
} }
func convertMods(mods tcell.ModMask) vterm.Modifier { func convertMods(mods tcell.ModMask) vterm.Modifier {