To: vim_dev@googlegroups.com Subject: Patch 8.2.0964 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0964 Problem: TextYankPost does not provide info about Visual selection. Solution: Add the 'visual' key in v:event. (closes #6249) Files: runtime/doc/autocmd.txt, src/register.c, src/testdir/test_autocmd.vim *** ../vim-8.2.0963/runtime/doc/autocmd.txt 2020-06-10 20:56:55.021354582 +0200 --- runtime/doc/autocmd.txt 2020-06-12 22:05:15.964105018 +0200 *************** *** 1154,1159 **** --- 1154,1161 ---- register. regtype Type of the register, see |getregtype()|. + visual True if the operation is + performed on a |Visual| area. Not triggered when |quote_| is used nor when called recursively. It is not allowed to change the buffer text, *** ../vim-8.2.0963/src/register.c 2020-06-07 18:16:31.311293288 +0200 --- src/register.c 2020-06-12 22:05:15.964105018 +0200 *************** *** 928,933 **** --- 928,935 ---- } dict_add_string(v_event, "regtype", buf); + dict_add_bool(v_event, "visual", oap->is_VIsual); + // Lock the dictionary and its keys dict_set_items_ro(v_event); *** ../vim-8.2.0963/src/testdir/test_autocmd.vim 2020-06-10 20:56:55.025354576 +0200 --- src/testdir/test_autocmd.vim 2020-06-12 22:05:15.964105018 +0200 *************** *** 1712,1734 **** norm "ayiw call assert_equal( ! \{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v'}, \g:event) norm y_ call assert_equal( ! \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V'}, \g:event) call feedkeys("\y", 'x') call assert_equal( ! \{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': "\x161"}, \g:event) norm "xciwbar call assert_equal( ! \{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v'}, \g:event) norm "bdiw call assert_equal( ! \{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v'}, \g:event) call assert_equal({}, v:event) --- 1712,1738 ---- norm "ayiw call assert_equal( ! \{'regcontents': ['foo'], 'regname': 'a', 'operator': 'y', 'regtype': 'v', 'visual': v:false}, \g:event) norm y_ call assert_equal( ! \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V', 'visual': v:false}, ! \g:event) ! norm Vy ! call assert_equal( ! \{'regcontents': ['foo'], 'regname': '', 'operator': 'y', 'regtype': 'V', 'visual': v:true}, \g:event) call feedkeys("\y", 'x') call assert_equal( ! \{'regcontents': ['f'], 'regname': '', 'operator': 'y', 'regtype': "\x161", 'visual': v:true}, \g:event) norm "xciwbar call assert_equal( ! \{'regcontents': ['foo'], 'regname': 'x', 'operator': 'c', 'regtype': 'v', 'visual': v:false}, \g:event) norm "bdiw call assert_equal( ! \{'regcontents': ['bar'], 'regname': 'b', 'operator': 'd', 'regtype': 'v', 'visual': v:false}, \g:event) call assert_equal({}, v:event) *** ../vim-8.2.0963/src/version.c 2020-06-12 20:19:37.976526305 +0200 --- src/version.c 2020-06-12 22:06:37.995676235 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 964, /**/ -- DEAD PERSON: I'm getting better! CUSTOMER: No, you're not -- you'll be stone dead in a moment. MORTICIAN: Oh, I can't take him like that -- it's against regulations. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///