diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-05-20 06:15:58 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-05-20 20:50:08 +0800 |
commit | d89144626e7429d9c499875ed426a6223f9013be (patch) | |
tree | 0c4fb90f1862e63c84dbd366ac45d577d9ed16f8 /src/nvim/eval.lua | |
parent | 5c2616846aa4d85ba96adefea98ed50f46f7a291 (diff) | |
download | rneovim-d89144626e7429d9c499875ed426a6223f9013be.tar.gz rneovim-d89144626e7429d9c499875ed426a6223f9013be.tar.bz2 rneovim-d89144626e7429d9c499875ed426a6223f9013be.zip |
vim-patch:9.1.0394: Cannot get a list of positions describing a region
Problem: Cannot get a list of positions describing a region
(Justin M. Keyes, after v9.1.0120)
Solution: Add the getregionpos() function
(Shougo Matsushita)
fixes: vim/vim#14609
closes: vim/vim#14617
https://github.com/vim/vim/commit/b4757e627e6c83d1c8e5535d4887a82d6a5efdd0
Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Diffstat (limited to 'src/nvim/eval.lua')
-rw-r--r-- | src/nvim/eval.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index f0eeca2f10..0653a51f96 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -4414,6 +4414,31 @@ M.funcs = { returns = 'string[]', signature = 'getregion({pos1}, {pos2} [, {opts}])', }, + getregionpos = { + args = { 2, 3 }, + base = 1, + desc = [=[ + Same as |getregion()|, but returns a list of positions + describing the buffer text segments bound by {pos1} and + {pos2}. + The segments are a pair of positions for every line: > + [[{start_pos}, {end_pos}], ...] + < + The position is a |List| with four numbers: + [bufnum, lnum, col, off] + "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. + ]=], + name = 'getregionpos', + params = { { 'pos1', 'table' }, { 'pos2', 'table' }, { 'opts', 'table' } }, + returns = 'integer[][][]', + signature = 'getregionpos({pos1}, {pos2} [, {opts}])', + }, getregtype = { args = { 0, 1 }, base = 1, |