Skip to content

Commit fc93505

Browse files
committed
fix: cgv
1 parent 356250b commit fc93505

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lua/vbi.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ local attach = function(ev)
5656
local nov2i = ev.match == 'no\022:i' -- c<c-q>xx can never append to eol
5757
local no2i = ev.match == 'no:i'
5858
local eol = not no2i and not nov2i and is_eol() and append -- `<c-q>$jjjc` is not "eol"
59-
if no2i and last_key ~= 'v' or is_delete() or vsrow == 0 then return detach() end -- cgv
59+
if no2i and (last_key ~= 'v' or fn.visualmode() ~= '\022') or is_delete() or vsrow == 0 then -- cgv
60+
return detach()
61+
end
6062
local change = is_change() or nov2i or no2i
6163
local icol ---@type integer
6264
if eol then -- <c-q>j$Axx

test/vbi_spec.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,16 @@ describe('main', function()
359359
{2:-- INSERT --} |
360360
]],
361361
})
362+
n.feed('<esc>Vj<esc>cgvabc')
363+
screen:expect {
364+
grid = [[
365+
abc^ |
366+
ccc |
367+
dddddddxyz |
368+
{4:~ }|
369+
{2:-- INSERT --} |
370+
]],
371+
}
362372
end)
363373

364374
it('<c-w>', function()

0 commit comments

Comments
 (0)