Skip to content

Commit

Permalink
Use nvim_win_set_cursor instead of 'normal! gg'. #96
Browse files Browse the repository at this point in the history
  • Loading branch information
dstein64 committed Jun 7, 2023
1 parent 7cd4313 commit 8995767
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/scrollview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,8 @@ local should_show = function(winid)
if not always_show then
-- Don't show when all lines can fit on screen.
local all_lines_fit = with_win_workspace(winid, function()
vim.cmd('keepjumps normal! gg')
-- Use nvim_win_set_cursor to avoid 'normal! gg'. #96
vim.cmd('keepjumps call nvim_win_set_cursor(0, [1, 0])')
local topline, botline = line_range(api.nvim_get_current_win())
local line_count = api.nvim_buf_line_count(api.nvim_get_current_buf())
return botline - topline + 1 == line_count
Expand Down

0 comments on commit 8995767

Please sign in to comment.