To: vim_dev@googlegroups.com Subject: Patch 8.2.4996 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4996 (after 8.2.4969) Problem: setbufline() may change Visual selection. (Qiming Zhao) Solution: Disable Visual mode when using another buffer. (closes #10466) Files: src/evalbuffer.c, src/testdir/test_bufline.vim *** ../vim-8.2.4995/src/evalbuffer.c 2022-01-08 12:41:12.200795557 +0000 --- src/evalbuffer.c 2022-05-22 11:57:53.955631833 +0100 *************** *** 144,149 **** --- 144,150 ---- buf_T *curbuf_save = NULL; win_T *curwin_save = NULL; int is_curbuf = buf == curbuf; + int save_VIsual_active = VIsual_active; // When using the current buffer ml_mfp will be set if needed. Useful when // setline() is used on startup. For other buffers the buffer must be *************** *** 158,163 **** --- 159,165 ---- if (!is_curbuf) { + VIsual_active = FALSE; curbuf_save = curbuf; curwin_save = curwin; curbuf = buf; *************** *** 264,269 **** --- 266,272 ---- { curbuf = curbuf_save; curwin = curwin_save; + VIsual_active = save_VIsual_active; } } *** ../vim-8.2.4995/src/testdir/test_bufline.vim 2022-02-10 19:51:42.545569904 +0000 --- src/testdir/test_bufline.vim 2022-05-22 11:56:46.223653705 +0100 *************** *** 222,225 **** --- 222,241 ---- call delete('XscriptMatchCommon') endfunc + func Test_setbufline_select_mode() + new + call setline(1, ['foo', 'bar']) + call feedkeys("j^v2l\", 'nx') + + let bufnr = bufadd('Xdummy') + call bufload(bufnr) + call setbufline(bufnr, 1, ['abc']) + + call feedkeys("x", 'nx') + call assert_equal(['foo', 'x'], getline(1, 2)) + + exe "bwipe! " .. bufnr + bwipe! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4995/src/version.c 2022-05-21 21:55:49.456619728 +0100 --- src/version.c 2022-05-22 11:57:04.555647850 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 4996, /**/ -- hundred-and-one symptoms of being an internet addict: 253. You wait for a slow loading web page before going to the toilet. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///