diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-16 19:40:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-16 19:40:59 +0100 |
commit | 7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97 (patch) | |
tree | d40856d0b0eb3723b94a0543db98cd8d96cb2d50 /src/edit.c | |
parent | 60ae0e71490c97f2871a6344aca61cacf220f813 (diff) | |
download | vim-git-7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97.tar.gz |
patch 8.2.4969: changing text in Visual mode may cause invalid memory accessv8.2.4969
Problem: Changing text in Visual mode may cause invalid memory access.
Solution: Check the Visual position after making a change.
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/edit.c b/src/edit.c index 5b06131f9..6e76971c3 100644 --- a/src/edit.c +++ b/src/edit.c @@ -2541,16 +2541,8 @@ stop_insert( // <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(ml_get_curline()); - - if (VIsual.col > len) - { - VIsual.col = len; - VIsual.coladd = 0; - } - } + if (VIsual_active) + check_visual_pos(); } } did_ai = FALSE; |