comparison src/edit.c @ 28893:aa44d5842d6c v8.2.4969

patch 8.2.4969: changing text in Visual mode may cause invalid memory access Commit: https://github.com/vim/vim/commit/7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 16 19:40:59 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Mon, 16 May 2022 20:45:03 +0200
parents 948877671c54
children 6cdf55afaae9
comparison
equal deleted inserted replaced
28892:4df932719c00 28893:aa44d5842d6c
2539 ++curwin->w_cursor.col; // put cursor back on the NUL 2539 ++curwin->w_cursor.col; // put cursor back on the NUL
2540 } 2540 }
2541 2541
2542 // <C-S-Right> may have started Visual mode, adjust the position for 2542 // <C-S-Right> may have started Visual mode, adjust the position for
2543 // deleted characters. 2543 // deleted characters.
2544 if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum) 2544 if (VIsual_active)
2545 { 2545 check_visual_pos();
2546 int len = (int)STRLEN(ml_get_curline());
2547
2548 if (VIsual.col > len)
2549 {
2550 VIsual.col = len;
2551 VIsual.coladd = 0;
2552 }
2553 }
2554 } 2546 }
2555 } 2547 }
2556 did_ai = FALSE; 2548 did_ai = FALSE;
2557 #ifdef FEAT_SMARTINDENT 2549 #ifdef FEAT_SMARTINDENT
2558 did_si = FALSE; 2550 did_si = FALSE;