mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
e475476d10
commit
1cbc830189
@ -93,6 +93,9 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
|
|||||||
// When column is out of range silently correct it.
|
// When column is out of range silently correct it.
|
||||||
check_cursor_col_win(win);
|
check_cursor_col_win(win);
|
||||||
|
|
||||||
|
// Make sure we stick in this column.
|
||||||
|
win->w_curswant = (colnr_T)col;
|
||||||
|
|
||||||
// make sure cursor is in visible range even if win != curwin
|
// make sure cursor is in visible range even if win != curwin
|
||||||
update_topline_win(win);
|
update_topline_win(win);
|
||||||
|
|
||||||
|
@ -108,6 +108,29 @@ describe('api/win', function()
|
|||||||
neq(win, curwin())
|
neq(win, curwin())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('remembers what column it wants to be in', function()
|
||||||
|
insert("first line")
|
||||||
|
feed('o<esc>')
|
||||||
|
insert("second line")
|
||||||
|
|
||||||
|
feed('gg')
|
||||||
|
wait() -- let nvim process the 'gg' command
|
||||||
|
|
||||||
|
-- cursor position is at beginning
|
||||||
|
local win = curwin()
|
||||||
|
eq({1, 0}, window('get_cursor', win))
|
||||||
|
|
||||||
|
-- move cursor to column 5
|
||||||
|
window('set_cursor', win, {1, 5})
|
||||||
|
|
||||||
|
-- move down a line
|
||||||
|
feed('j')
|
||||||
|
wait() -- let nvim process the 'j' command
|
||||||
|
|
||||||
|
-- cursor is still in column 5
|
||||||
|
eq({2, 5}, window('get_cursor', win))
|
||||||
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('{get,set}_height', function()
|
describe('{get,set}_height', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user