Mercurial > vim
diff src/ex_getln.c @ 13933:bea665293ea0 v8.0.1837
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
commit https://github.com/vim/vim/commit/5e3423d192bfa502c6704f731fa2ec6821f9a2f0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 13 18:36:27 2018 +0200
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>
Problem: One character cmdline abbreviation not triggered after '<,'>.
Solution: Skip over the special range. (Christian Brabandt, closes https://github.com/vim/vim/issues/2320)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 13 May 2018 18:45:05 +0200 |
parents | 1f95ec5de238 |
children | c3f9c37160e7 |
line wrap: on
line diff
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3572,10 +3572,25 @@ gotocmdline(int clr) static int ccheck_abbr(int c) { + int spos = 0; + if (p_paste || no_abbr) /* no abbreviations or in paste mode */ return FALSE; - return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, 0); + /* 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)