Merge pull request #21 from lewis6991/master

Don't call winrestview during cursorMoved
This commit is contained in:
Rom Grk 2020-12-30 20:09:08 -05:00 committed by GitHub
commit 8b124a6ec7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,12 +43,15 @@ local transform_line = function(line)
end
local get_gutter_width = function()
local saved_view = api.nvim_call_function('winsaveview', {})
-- Note when moving the cursor, we must ensure that the 'curswant' state is
-- restored (see #11). Functions like 'cursor()' and 'nvim_buf_set_cursor()'
-- clear this state.
local saved_cursor = api.nvim_call_function('getcurpos', {})
api.nvim_call_function('cursor', { 0, 1 })
local gutter_width = api.nvim_call_function('wincol', {}) - 1
api.nvim_call_function('winrestview', { saved_view })
api.nvim_call_function('setpos', { '.', saved_cursor })
return gutter_width
end
@ -127,8 +130,6 @@ function M.update_context()
else
M.close()
end
return { winid, get_gutter_width(), context }
end
function M.close()