summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-27 00:02:13 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-27 00:02:13 +0000
commitf193fffd16563cfbe7c02a21e19c8bb11707581d (patch)
tree4bae3092421aa986103b8000b1012989a9ea49e6 /src/getchar.c
parent551dbcc9b604c2992f908fb475e797fcc116315b (diff)
updated for version 7.0f02v7.0f02
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/getchar.c b/src/getchar.c
index e6ba2485df..629ad770be 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4301,11 +4301,29 @@ eval_map_expr(str)
{
char_u *res;
char_u *p;
- char_u *s, *d;
p = eval_to_string(str, NULL, FALSE);
if (p == NULL)
return NULL;
+ res = vim_strsave_escape_csi(p);
+ vim_free(p);
+
+ return res;
+}
+#endif
+
+#if defined(FEAT_EVAL) || defined(PROTO)
+/*
+ * Copy "p" to allocated memory, escaping K_SPECIAL and CSI so that the result
+ * can be put in the typeahead buffer.
+ * Returns NULL when out of memory.
+ */
+ char_u *
+vim_strsave_escape_csi(p)
+ char_u *p;
+{
+ char_u *res;
+ char_u *s, *d;
/* Need a buffer to hold up to three times as much. */
res = alloc((unsigned)(STRLEN(p) * 3) + 1);
@@ -4331,9 +4349,6 @@ eval_map_expr(str)
}
*d = NUL;
}
-
- vim_free(p);
-
return res;
}
#endif