mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
fix(api): update grid cursor in nvim_win_set_cursor()
Problem: Cursor position set by nvim_win_set_cursor() is not reflected on the screen when followed by a blocking call like getchar(). Solution: Immediately update the cursor position on the grid.
This commit is contained in:
parent
ca7dd33fa7
commit
c971f538ab
@ -148,7 +148,7 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
|
|||||||
switchwin_T switchwin;
|
switchwin_T switchwin;
|
||||||
switch_win(&switchwin, win, NULL, true);
|
switch_win(&switchwin, win, NULL, true);
|
||||||
update_topline(curwin);
|
update_topline(curwin);
|
||||||
validate_cursor(curwin);
|
setcursor_mayforce(true);
|
||||||
restore_win(&switchwin, true);
|
restore_win(&switchwin, true);
|
||||||
|
|
||||||
redraw_later(win, UPD_VALID);
|
redraw_later(win, UPD_VALID);
|
||||||
|
@ -219,6 +219,21 @@ describe('API/win', function()
|
|||||||
|
|
||||||
-- curwin didn't change back
|
-- curwin didn't change back
|
||||||
neq(win, curwin())
|
neq(win, curwin())
|
||||||
|
|
||||||
|
-- shows updated position after getchar() #20793
|
||||||
|
feed(':call getchar()<CR>')
|
||||||
|
api.nvim_win_set_cursor(win, { 1, 5 })
|
||||||
|
screen:expect {
|
||||||
|
grid = [[
|
||||||
|
|
|
||||||
|
{1:~ }|*2
|
||||||
|
{2:[No Name] }|
|
||||||
|
prolo^gue |
|
||||||
|
|*2
|
||||||
|
{3:[No Name] [+] }|
|
||||||
|
:call getchar() |
|
||||||
|
]],
|
||||||
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('remembers what column it wants to be in', function()
|
it('remembers what column it wants to be in', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user