To: vim_dev@googlegroups.com Subject: Patch 8.2.5002 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5002 Problem: deletebufline() may change Visual selection. Solution: Disable Visual mode when using another buffer. (closes #10469) Files: src/evalbuffer.c, src/testdir/test_bufline.vim *** ../vim-8.2.5001/src/evalbuffer.c 2022-05-22 11:59:20.527602615 +0100 --- src/evalbuffer.c 2022-05-22 15:33:16.994234776 +0100 *************** *** 510,515 **** --- 510,516 ---- tabpage_T *tp; win_T *wp; int did_emsg_before = did_emsg; + int save_VIsual_active = VIsual_active; rettv->vval.v_number = 1; // FAIL by default *************** *** 538,543 **** --- 539,545 ---- if (!is_curbuf) { + VIsual_active = FALSE; curbuf_save = curbuf; curwin_save = curwin; curbuf = buf; *************** *** 582,587 **** --- 584,590 ---- { curbuf = curbuf_save; curwin = curwin_save; + VIsual_active = save_VIsual_active; } rettv->vval.v_number = 0; // OK } *** ../vim-8.2.5001/src/testdir/test_bufline.vim 2022-05-22 11:59:20.527602615 +0100 --- src/testdir/test_bufline.vim 2022-05-22 15:33:16.998234772 +0100 *************** *** 238,241 **** --- 238,258 ---- bwipe! endfunc + func Test_deletebufline_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', 'def']) + call deletebufline(bufnr, 1) + + 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.5001/src/version.c 2022-05-22 15:28:27.590322519 +0100 --- src/version.c 2022-05-22 15:35:33.982195876 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5002, /**/ -- hundred-and-one symptoms of being an internet addict: 263. You have more e-mail addresses than shorts. /// 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 ///