To: vim_dev@googlegroups.com Subject: Patch 8.0.1090 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1090 Problem: cannot get the text under the cursor like v:beval_text Solution: Add . Files: src/ex_docmd.c, src/testdir/test_normal.vim, runtime/doc/cmdline.txt *** ../vim-8.0.1089/src/ex_docmd.c 2017-09-10 17:34:30.378823252 +0200 --- src/ex_docmd.c 2017-09-10 17:50:58.748842944 +0200 *************** *** 10650,10680 **** "%", #define SPEC_PERC 0 "#", ! #define SPEC_HASH 1 "", /* cursor word */ ! #define SPEC_CWORD 2 "", /* cursor WORD */ ! #define SPEC_CCWORD 3 "", /* cursor path name */ ! #define SPEC_CFILE 4 "", /* ":so" file name */ ! #define SPEC_SFILE 5 "", /* ":so" file line number */ ! #define SPEC_SLNUM 6 #ifdef FEAT_AUTOCMD "", /* autocommand file name */ ! # define SPEC_AFILE 7 "", /* autocommand buffer number */ ! # define SPEC_ABUF 8 "", /* autocommand match name */ ! # define SPEC_AMATCH 9 #endif #ifdef FEAT_CLIENTSERVER "" # ifdef FEAT_AUTOCMD ! # define SPEC_CLIENT 10 # else ! # define SPEC_CLIENT 7 # endif #endif }; --- 10650,10682 ---- "%", #define SPEC_PERC 0 "#", ! #define SPEC_HASH (SPEC_PERC + 1) "", /* cursor word */ ! #define SPEC_CWORD (SPEC_HASH + 1) "", /* cursor WORD */ ! #define SPEC_CCWORD (SPEC_CWORD + 1) ! "", /* expr under cursor */ ! #define SPEC_CEXPR (SPEC_CCWORD + 1) "", /* cursor path name */ ! #define SPEC_CFILE (SPEC_CEXPR + 1) "", /* ":so" file name */ ! #define SPEC_SFILE (SPEC_CFILE + 1) "", /* ":so" file line number */ ! #define SPEC_SLNUM (SPEC_SFILE + 1) #ifdef FEAT_AUTOCMD "", /* autocommand file name */ ! # define SPEC_AFILE (SPEC_SLNUM + 1) "", /* autocommand buffer number */ ! # define SPEC_ABUF (SPEC_AFILE + 1) "", /* autocommand match name */ ! # define SPEC_AMATCH (SPEC_ABUF + 1) #endif #ifdef FEAT_CLIENTSERVER "" # ifdef FEAT_AUTOCMD ! # define SPEC_CLIENT (SPEC_AMATCH + 1) # else ! # define SPEC_CLIENT (SPEC_SLNUM + 1) # endif #endif }; *************** *** 10762,10771 **** /* * word or WORD under cursor */ ! if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD) { ! resultlen = find_ident_under_cursor(&result, spec_idx == SPEC_CWORD ? ! (FIND_IDENT|FIND_STRING) : FIND_STRING); if (resultlen == 0) { *errormsg = (char_u *)""; --- 10764,10776 ---- /* * word or WORD under cursor */ ! if (spec_idx == SPEC_CWORD || spec_idx == SPEC_CCWORD ! || spec_idx == SPEC_CEXPR) { ! resultlen = find_ident_under_cursor(&result, ! spec_idx == SPEC_CWORD ? (FIND_IDENT | FIND_STRING) ! : spec_idx == SPEC_CEXPR ? (FIND_IDENT | FIND_STRING | FIND_EVAL) ! : FIND_STRING); if (resultlen == 0) { *errormsg = (char_u *)""; *** ../vim-8.0.1089/src/testdir/test_normal.vim 2017-04-09 14:58:11.653002677 +0200 --- src/testdir/test_normal.vim 2017-09-10 18:01:48.185005534 +0200 *************** *** 389,398 **** call setline(1, ['1', 'ifooar,,cbar']) 2 norm! $ ! let a=expand('') ! let b=expand('') ! call assert_equal('cbar', a) ! call assert_equal('ifooar,,cbar', b) " clean up bw! endfunc --- 389,410 ---- call setline(1, ['1', 'ifooar,,cbar']) 2 norm! $ ! call assert_equal('cbar', expand('')) ! call assert_equal('ifooar,,cbar', expand('')) ! ! call setline(1, ['prx = list[idx];']) ! 1 ! let expected = ['', 'prx', 'prx', 'prx', ! \ 'list', 'list', 'list', 'list', 'list', 'list', 'list', ! \ 'idx', 'idx', 'idx', 'idx', ! \ 'list[idx]', ! \ '];', ! \ ] ! for i in range(1, 16) ! exe 'norm ' . i . '|' ! call assert_equal(expected[i], expand(''), 'i == ' . i) ! endfor ! " clean up bw! endfunc *** ../vim-8.0.1089/runtime/doc/cmdline.txt 2016-12-01 17:57:40.779167445 +0100 --- runtime/doc/cmdline.txt 2017-09-10 18:14:01.624553911 +0200 *************** *** 826,831 **** --- 830,840 ---- Note: these are typed literally, they are not special keys! is replaced with the word under the cursor (like |star|) is replaced with the WORD under the cursor (see |WORD|) + is replaced with the word under the cursor, including more + to form a C expression. E.g., when the cursor is on "arg" + of "ptr->arg" then the result is "ptr->arg"; when the + cursor is on "]" of "list[idx]" then the result is + "list[idx]". This is used for |v:beval_text|. is replaced with the path name under the cursor (like what |gf| uses) When executing autocommands, is replaced with the file name *** ../vim-8.0.1089/src/version.c 2017-09-10 17:34:30.378823252 +0200 --- src/version.c 2017-09-10 17:45:28.862768973 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1090, /**/ -- From "know your smileys": <|-) Chinese <|-( Chinese and doesn't like these kind of jokes /// 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 ///