diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-05-20 20:50:32 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-05-20 20:59:54 +0800 |
commit | e0259b9466a0dd62b74d4aa195b3c5e6c7a183d0 (patch) | |
tree | 225a99d08431a6f295c01e60f17ccbe65075a57a /runtime | |
parent | 3383603c134944d374eb0814a2f707a7e3e89b43 (diff) | |
download | rneovim-e0259b9466a0dd62b74d4aa195b3c5e6c7a183d0.tar.gz rneovim-e0259b9466a0dd62b74d4aa195b3c5e6c7a183d0.tar.bz2 rneovim-e0259b9466a0dd62b74d4aa195b3c5e6c7a183d0.zip |
vim-patch:9.1.0423: getregionpos() wrong with blockwise mode and multibyte
Problem: getregionpos() wrong with blockwise mode and multibyte.
Solution: Use textcol and textlen instead of start_vcol and end_vcol.
Handle coladd properly (zeertzjq).
Also remove unnecessary buflist_findnr() in add_regionpos_range(), as
getregionpos() has already switched buffer.
closes: vim/vim#14805
https://github.com/vim/vim/commit/c95e64f41f7f6d1bdc95b047ae9b369743c8637b
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/builtin.txt | 10 | ||||
-rw-r--r-- | runtime/lua/vim/_meta/vimfn.lua | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 0f0e33b54e..e0921cf477 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2981,10 +2981,12 @@ getregionpos({pos1}, {pos2} [, {opts}]) *getregionpos()* "bufnum" is the buffer number. "lnum" and "col" are the position in the buffer. The first column is 1. - The "off" number is zero, unless 'virtualedit' is used. Then - it is the offset in screen columns from the start of the - character. E.g., a position within a <Tab> or after the last - character. + If the "off" number of a starting position is non-zero, it is + the offset in screen columns from the start of the character. + E.g., a position within a <Tab> or after the last character. + If the "off" number of an ending position is non-zero, it is + the character's number of cells included in the selection, + otherwise the whole character is included. getregtype([{regname}]) *getregtype()* The result is a String, which is type of register {regname}. diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index fbcdd52116..dee65a40c7 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3592,10 +3592,12 @@ function vim.fn.getregion(pos1, pos2, opts) end --- "bufnum" is the buffer number. --- "lnum" and "col" are the position in the buffer. The first --- column is 1. ---- The "off" number is zero, unless 'virtualedit' is used. Then ---- it is the offset in screen columns from the start of the ---- character. E.g., a position within a <Tab> or after the last ---- character. +--- If the "off" number of a starting position is non-zero, it is +--- the offset in screen columns from the start of the character. +--- E.g., a position within a <Tab> or after the last character. +--- If the "off" number of an ending position is non-zero, it is +--- the character's number of cells included in the selection, +--- otherwise the whole character is included. --- --- @param pos1 table --- @param pos2 table |