To: vim_dev@googlegroups.com Subject: Patch 8.0.1837 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1837 Problem: One character cmdline abbreviation not triggered after '<,'>. Solution: Skip over the special range. (Christian Brabandt, closes #2320) Files: src/ex_getln.c, src/testdir/test_mapping.vim *** ../vim-8.0.1836/src/ex_getln.c 2018-05-01 19:23:40.777975258 +0200 --- src/ex_getln.c 2018-05-13 18:28:45.448938982 +0200 *************** *** 3572,3581 **** static int ccheck_abbr(int c) { if (p_paste || no_abbr) /* no abbreviations or in paste mode */ return FALSE; ! return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, 0); } #if defined(FEAT_CMDL_COMPL) || defined(PROTO) --- 3572,3596 ---- static int ccheck_abbr(int c) { + int spos = 0; + if (p_paste || no_abbr) /* no abbreviations or in paste mode */ return FALSE; ! /* Do not consider '<,'> be part of the mapping, skip leading whitespace. ! * Actually accepts any mark. */ ! while (VIM_ISWHITE(ccline.cmdbuff[spos]) && spos < ccline.cmdlen) ! spos++; ! if (ccline.cmdlen - spos > 5 ! && ccline.cmdbuff[spos] == '\'' ! && ccline.cmdbuff[spos + 2] == ',' ! && ccline.cmdbuff[spos + 3] == '\'') ! spos += 5; ! else ! /* check abbreviation from the beginning of the commandline */ ! spos = 0; ! ! return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, spos); } #if defined(FEAT_CMDL_COMPL) || defined(PROTO) *** ../vim-8.0.1836/src/testdir/test_mapping.vim 2018-04-26 22:30:29.226565612 +0200 --- src/testdir/test_mapping.vim 2018-05-13 18:29:43.180569116 +0200 *************** *** 214,216 **** --- 214,232 ---- delfunc Eatchar bw! endfunc + + func Test_cabbr_visual_mode() + cabbr s su + call feedkeys(":s \\"\", 'itx') + call assert_equal('"su ', getreg(':')) + call feedkeys(":'<,'>s \\"\", 'itx') + let expected = '"'. "'<,'>su " + call assert_equal(expected, getreg(':')) + call feedkeys(": '<,'>s \\"\", 'itx') + let expected = '" '. "'<,'>su " + call assert_equal(expected, getreg(':')) + call feedkeys(":'a,'bs \\"\", 'itx') + let expected = '"'. "'a,'bsu " + call assert_equal(expected, getreg(':')) + cunabbr s + endfunc *** ../vim-8.0.1836/src/version.c 2018-05-13 18:05:29.357089513 +0200 --- src/version.c 2018-05-13 18:36:07.934087971 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1837, /**/ -- Q: Why does /dev/null accept only integers? A: You can't sink a float. /// 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 ///