mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-patch:9.0.0765: with a Visual block a put command column may go negative (#20676)
Problem: With a Visual block a put command column may go negative.
Solution: Check that the column does not become negative.
36343ae0fb
This commit is contained in:
@@ -3370,6 +3370,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
|||||||
// adjust '] mark
|
// adjust '] mark
|
||||||
curbuf->b_op_end.lnum = curwin->w_cursor.lnum - 1;
|
curbuf->b_op_end.lnum = curwin->w_cursor.lnum - 1;
|
||||||
curbuf->b_op_end.col = bd.textcol + (colnr_T)totlen - 1;
|
curbuf->b_op_end.col = bd.textcol + (colnr_T)totlen - 1;
|
||||||
|
if (curbuf->b_op_end.col < 0) {
|
||||||
|
curbuf->b_op_end.col = 0;
|
||||||
|
}
|
||||||
curbuf->b_op_end.coladd = 0;
|
curbuf->b_op_end.coladd = 0;
|
||||||
if (flags & PUT_CURSEND) {
|
if (flags & PUT_CURSEND) {
|
||||||
colnr_T len;
|
colnr_T len;
|
||||||
|
@@ -474,6 +474,18 @@ func Test_visual_block_put()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_visual_block_put_invalid()
|
||||||
|
enew!
|
||||||
|
behave mswin
|
||||||
|
norm yy
|
||||||
|
norm v)Ps/^/
|
||||||
|
" this was causing the column to become negative
|
||||||
|
silent norm ggv)P
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
behave xterm
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Visual modes (v V CTRL-V) followed by an operator; count; repeating
|
" Visual modes (v V CTRL-V) followed by an operator; count; repeating
|
||||||
func Test_visual_mode_op()
|
func Test_visual_mode_op()
|
||||||
new
|
new
|
||||||
|
Reference in New Issue
Block a user