From 8ba9f19961d8573dc851d3d5f2ec217ad2fb7b28 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Feb 2022 04:46:16 +0800 Subject: vim-patch:8.2.1727: a popup created with "cursorline" will ignore "firstline" Problem: A popup created with "cursorline" will ignore "firstline". Solution: When both "cursorline" and "firstline" are present put the cursor on "firstline". (closes vim/vim#7000) Add the "winid" argument to getcurpos(). https://github.com/vim/vim/commit/99ca9c4868bb1669706b9e3de9a9218bd11cc459 Skip popup window related code. Cherry-pick all of Test_getcurpos_setpos() from patch 8.2.0610. --- runtime/doc/builtin.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 327b8dc4d9..4f6104c602 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -178,7 +178,7 @@ getcmdtype() String return current command-line type getcmdwintype() String return current command-line window type getcompletion({pat}, {type} [, {filtered}]) List list of cmdline completion matches -getcurpos() List position of the cursor +getcurpos([{winnr}]) List position of the cursor getcwd([{winnr} [, {tabnr}]]) String get the current working directory getenv({name}) String return environment variable getfontname([{name}]) String name of font being used @@ -2786,13 +2786,20 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* GetPattern()->getcompletion('color') < *getcurpos()* -getcurpos() Get the position of the cursor. This is like getpos('.'), but +getcurpos([{winid}]) + Get the position of the cursor. This is like getpos('.'), but includes an extra "curswant" in the list: [0, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the cursor vertically. Also see |getpos()|. The first "bufnum" item is always zero. + The optional {winid} argument can specify the window. It can + be the window number or the |window-ID|. The last known + cursor position is returned, this may be invalid for the + current value of the buffer if it is not the current window. + If {winid} is invalid a list with zeroes is returned. + This can be used to save and restore the cursor position: > let save_cursor = getcurpos() MoveTheCursorAround -- cgit