mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
parent
01374446af
commit
5db076c7cc
@ -548,6 +548,9 @@ function vim.region(bufnr, pos1, pos2, regtype, inclusive)
|
||||
else
|
||||
c2 = #bufline + 1
|
||||
end
|
||||
elseif regtype == 'V' then -- linewise selection, always return whole line
|
||||
c1 = 0
|
||||
c2 = -1
|
||||
else
|
||||
c1 = (l == pos1[1]) and pos1[2] or 0
|
||||
c2 = (l == pos2[1]) and (pos2[2] + (inclusive and 1 or 0)) or -1
|
||||
|
@ -2401,6 +2401,14 @@ describe('lua stdlib', function()
|
||||
insert([[αα]])
|
||||
eq({0,5}, exec_lua[[ return vim.region(0,{0,0},{0,4},'3',true)[0] ]])
|
||||
end)
|
||||
it('linewise', function()
|
||||
insert(dedent( [[
|
||||
text tααt tααt text
|
||||
text tαxt txtα tex
|
||||
text tαxt tαxt
|
||||
]]))
|
||||
eq({0,-1}, exec_lua[[ return vim.region(0,{1,5},{1,14},'V',true)[1] ]])
|
||||
end)
|
||||
it('getpos() input', function()
|
||||
insert('getpos')
|
||||
eq({0,6}, exec_lua[[ return vim.region(0,{0,0},'.','v',true)[0] ]])
|
||||
|
Loading…
Reference in New Issue
Block a user