diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-13 08:29:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-13 08:29:05 +0800 |
commit | 849394e4e26f487586761a3640475c27ceca30b9 (patch) | |
tree | 9d77b58ace60d150dd42c617cdab2af0495c2a5e /runtime | |
parent | ec449c27fdad6cc907a6f4835ce28f31990ad519 (diff) | |
download | rneovim-849394e4e26f487586761a3640475c27ceca30b9.tar.gz rneovim-849394e4e26f487586761a3640475c27ceca30b9.tar.bz2 rneovim-849394e4e26f487586761a3640475c27ceca30b9.zip |
vim-patch:9.0.0863: col() and charcol() only work for the current window (#21038)
Problem: col() and charcol() only work for the current window.
Solution: Add an optional winid argument. (Yegappan Lakshmanan,
closes vim/vim#11466, closes vim/vim#11461)
https://github.com/vim/vim/commit/4c8d2f02b3ce037bbe1d5ee12887e343c6bde88f
Cherry-pick test_functions.vim change from patch 8.2.0633.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 50faa612b3..fa9fb286ae 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -78,13 +78,13 @@ chanclose({id} [, {stream}]) Number Closes a channel or one of its streams chansend({id}, {data}) Number Writes {data} to channel char2nr({expr} [, {utf8}]) Number ASCII/UTF-8 value of first char in {expr} charclass({string}) Number character class of {string} -charcol({expr}) Number column number of cursor or mark +charcol({expr} [, {winid}]) Number column number of cursor or mark charidx({string}, {idx} [, {countcc}]) Number char index of byte {idx} in {string} chdir({dir}) String change current working directory cindent({lnum}) Number C indent for line {lnum} clearmatches([{win}]) none clear all matches -col({expr}) Number column byte index of cursor or mark +col({expr} [, {winid}]) Number column byte index of cursor or mark complete({startcol}, {matches}) none set Insert mode completion complete_add({expr}) Number add completion match complete_check() Number check for key typed during completion @@ -1089,8 +1089,8 @@ charclass({string}) *charclass()* Returns 0 if {string} is not a |String|. - *charcol()* -charcol({expr}) Same as |col()| but returns the character index of the column +charcol({expr} [, {winid}]) *charcol()* + Same as |col()| but returns the character index of the column position given with {expr} instead of the byte position. Example: @@ -1172,8 +1172,8 @@ clearmatches([{win}]) *clearmatches()* Can also be used as a |method|: > GetWin()->clearmatches() < - *col()* -col({expr}) The result is a Number, which is the byte index of the column +col({expr} [, {winid}) *col()* + The result is a Number, which is the byte index of the column position given with {expr}. The accepted positions are: . the cursor position $ the end of the cursor line (the result is the @@ -1188,6 +1188,8 @@ col({expr}) The result is a Number, which is the byte index of the column and column number. Most useful when the column is "$", to get the last column of a specific line. When "lnum" or "col" is out of range then col() returns zero. + With the optional {winid} argument the values are obtained for + that window instead of the current window. To get the line number use |line()|. To get both use |getpos()|. For the screen column position use |virtcol()|. For the @@ -1198,7 +1200,8 @@ col({expr}) The result is a Number, which is the byte index of the column col("$") length of cursor line plus one col("'t") column of mark t col("'" .. markname) column of mark markname -< The first column is 1. Returns 0 if {expr} is invalid. +< The first column is 1. Returns 0 if {expr} is invalid or when + the window with ID {winid} is not found. For an uppercase mark the column may actually be in another buffer. For the cursor position, when 'virtualedit' is active, the |