summaryrefslogtreecommitdiff
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-10-20 21:23:33 +0200
committerBram Moolenaar <Bram@vim.org>2010-10-20 21:23:33 +0200
commitbd743259603a5cda418a0c542b719dad0213e1a9 (patch)
treef61707a813b850930460aa0605c68037e31291c3 /src/message.c
parent727c876b7869050d5da4f4d3dba975350bdbd7d8 (diff)
downloadvim-git-bd743259603a5cda418a0c542b719dad0213e1a9.tar.gz
updated for version 7.3.032v7.3.032
Problem: maparg() doesn't return the flags, such as <buffer>, <script>, <silent>. These are needed to save and restore a mapping. Solution: Improve maparg(). (also by Christian Brabandt)
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
index c33b173b8..ac81948f2 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1477,6 +1477,27 @@ msg_outtrans_special(strstart, from)
return retval;
}
+#if defined(FEAT_EVAL) || defined(PROTO)
+/*
+ * Return the lhs or rhs of a mapping, with the key codes turned into printable
+ * strings, in an allocated string.
+ */
+ char_u *
+str2special_save(str, is_lhs)
+ char_u *str;
+ int is_lhs; /* TRUE for lhs, FALSE for rhs */
+{
+ garray_T ga;
+ char_u *p = str;
+
+ ga_init2(&ga, 1, 40);
+ while (*p != NUL)
+ ga_concat(&ga, str2special(&p, is_lhs));
+ ga_append(&ga, NUL);
+ return (char_u *)ga.ga_data;
+}
+#endif
+
/*
* Return the printable string for the key codes at "*sp".
* Used for translating the lhs or rhs of a mapping to printable chars.