Do not move the cursor if buffer isn't focused. Fixes issue #1429

This commit is contained in:
Cameron 2024-07-23 09:07:12 +02:00
parent a232e38512
commit 56c31c4603
No known key found for this signature in database
GPG key ID: 7998CB3EA6CE5CBC
2 changed files with 3 additions and 3 deletions

View file

@ -288,7 +288,7 @@ function M:redraw(cursor, view)
logger.debug("[STATUS] Rendering UI")
self.buffer.ui:render(unpack(ui.Status(self.state, self.config)))
if cursor and view then
if cursor and view and self.buffer:is_focused() then
self.buffer:restore_view(view, self.buffer.ui:resolve_cursor_location(cursor))
end
end

View file

@ -158,7 +158,7 @@ end
---@param line nil|number|number[]
function Buffer:move_cursor(line)
if not line then
if not line or not self:is_focused() then
return
end
@ -174,7 +174,7 @@ end
---@param line nil|number|number[]
function Buffer:move_top_line(line)
if not line then
if not line or not self:is_focused() then
return
end