diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-05-17 08:10:34 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-05-17 08:16:37 +0800 |
commit | 527e861cbb9c47411c4ba86dbdb9fc79bde47452 (patch) | |
tree | 55b36c6b2f52b6f192fdbe36d47bb0469473bede /src/nvim/edit.c | |
parent | 26c906f54dafb37f7bc63e136a7a9373d1053fe1 (diff) | |
download | rneovim-527e861cbb9c47411c4ba86dbdb9fc79bde47452.tar.gz rneovim-527e861cbb9c47411c4ba86dbdb9fc79bde47452.tar.bz2 rneovim-527e861cbb9c47411c4ba86dbdb9fc79bde47452.zip |
vim-patch:8.2.4969: changing text in Visual mode may cause invalid memory access
Problem: Changing text in Visual mode may cause invalid memory access.
Solution: Check the Visual position after making a change.
https://github.com/vim/vim/commit/7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 357e9184d7..aa77c03b48 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -6770,13 +6770,8 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove) // <C-S-Right> may have started Visual mode, adjust the position for // deleted characters. - if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum) { - int len = (int)STRLEN(get_cursor_line_ptr()); - - if (VIsual.col > len) { - VIsual.col = len; - VIsual.coladd = 0; - } + if (VIsual_active) { + check_visual_pos(); } } } |