Mercurial > vim
changeset 5728:bb402c49379d v7.4.209
updated for version 7.4.209
Problem: When repeating a filter command "%" and "#" are expanded.
Solution: Escape the command when storing for redo. (Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 19 Mar 2014 17:41:23 +0100 |
parents | 0c6baa50f3ce |
children | b5cc3a0729b1 |
files | src/ex_cmds.c src/version.c |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1012,7 +1012,18 @@ do_bang(addr_count, eap, forceit, do_in, if (bangredo) /* put cmd in redo buffer for ! command */ { - AppendToRedobuffLit(prevcmd, -1); + /* If % or # appears in the command, it must have been escaped. + * Reescape them, so that redoing them does not substitute them by the + * buffername. */ + char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#"); + + if (cmd != NULL) + { + AppendToRedobuffLit(cmd, -1); + vim_free(cmd); + } + else + AppendToRedobuffLit(prevcmd, -1); AppendToRedobuff((char_u *)"\n"); bangredo = FALSE; }