diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-13 18:36:27 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-13 18:36:27 +0200 |
commit | 5e3423d192bfa502c6704f731fa2ec6821f9a2f0 (patch) | |
tree | c72c187dd7e1e06b252334d974d13282a77bf5f2 /src/ex_getln.c | |
parent | 25782a7ff4755daf16c2e1cb5e5f826b13b672ce (diff) |
patch 8.0.1837: one character cmdline abbreviation not triggered after '<,'>v8.0.1837
Problem: One character cmdline abbreviation not triggered after '<,'>.
Solution: Skip over the special range. (Christian Brabandt, closes #2320)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 0124098da5..acaaef4705 100644 --- 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) |