summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-19 21:23:36 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-19 21:23:36 +0000
commit8424a624ce1c38716deabd47f4da23f1e81614bd (patch)
tree908266a65b60968cb3b662765198239944b2a365 /src/getchar.c
parentc1e37901fc8486c9960d7290e521ba51e292e94b (diff)
updated for version 7.0e03v7.0e03
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 0ba97b4065..88381b176e 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4294,22 +4294,40 @@ eval_map_expr(str)
char_u *str;
{
char_u *res;
- char_u *s;
- int len;
+ char_u *p;
+ char_u *s, *d;
- s = eval_to_string(str, NULL, FALSE);
- if (s == NULL)
+ p = eval_to_string(str, NULL, FALSE);
+ if (p == NULL)
return NULL;
/* Need a buffer to hold up to three times as much. */
- len = (int)STRLEN(s);
- res = alloc((unsigned)(len * 3) + 1);
+ res = alloc((unsigned)(STRLEN(p) * 3) + 1);
if (res != NULL)
{
- STRCPY(res, s);
- (void)fix_input_buffer(res, len, TRUE);
+ d = res;
+ for (s = p; *s != NUL; )
+ {
+ if (s[0] == K_SPECIAL && s[1] != NUL && s[2] != NUL)
+ {
+ /* Copy special key unmodified. */
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ }
+ else
+ {
+ /* Add character, possibly multi-byte to destination, escaping
+ * CSI and K_SPECIAL. */
+ d = add_char2buf(PTR2CHAR(s), d);
+ mb_ptr_adv(s);
+ }
+ }
+ *d = NUL;
}
- vim_free(s);
+
+ vim_free(p);
+
return res;
}
#endif