summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-29 21:55:22 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-29 21:55:22 +0000
commitd8fc5c0b999204f47efd7702502b41ead11948a4 (patch)
tree35c332fe05654b768a8126fc3de893eef95eac2c /src
parent8ea9123258804d6199c79789af295bb3ca3db296 (diff)
updated for version 7.0f05
Diffstat (limited to 'src')
-rw-r--r--src/getchar.c32
-rw-r--r--src/message.c6
-rw-r--r--src/normal.c12
-rw-r--r--src/window.c3
4 files changed, 35 insertions, 18 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 7b1cf875cb..3b9d42014b 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1033,6 +1033,38 @@ ins_typebuf(str, noremap, offset, nottyped, silent)
}
/*
+ * Put character "c" back into the typeahead buffer.
+ * Can be used for a character obtained by vgetc() that needs to be put back.
+ */
+ void
+ins_char_typebuf(c)
+ int c;
+{
+#ifdef FEAT_MBYTE
+ char_u buf[MB_MAXBYTES];
+#else
+ char_u buf[4];
+#endif
+ if (IS_SPECIAL(c))
+ {
+ buf[0] = K_SPECIAL;
+ buf[1] = K_SECOND(c);
+ buf[2] = K_THIRD(c);
+ buf[3] = NUL;
+ }
+ else
+ {
+#ifdef FEAT_MBYTE
+ buf[(*mb_char2bytes)(c, buf)] = NUL;
+#else
+ buf[0] = c;
+ buf[1] = NUL;
+#endif
+ }
+ (void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
+}
+
+/*
* Return TRUE if the typeahead buffer was changed (while waiting for a
* character to arrive). Happens when a message was received from a client or
* from feedkeys().
diff --git a/src/message.c b/src/message.c
index 08810ad827..c67d47d984 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1004,13 +1004,9 @@ wait_return(redraw)
#endif
if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C)
{
- char_u buf[2];
-
/* Put the character back in the typeahead buffer. Don't use the
* stuff buffer, because lmaps wouldn't work. */
- buf[0] = c;
- buf[1] = NUL;
- ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
+ ins_char_typebuf(c);
do_redraw = TRUE; /* need a redraw even though there is
typeahead */
}
diff --git a/src/normal.c b/src/normal.c
index 966bb3219d..db6c66a597 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -648,23 +648,13 @@ normal_cmd(oap, toplevel)
&& VIsual_select
&& (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER))
{
-# ifdef FEAT_MBYTE
- char_u buf[MB_MAXBYTES + 1];
-
- buf[(*mb_char2bytes)(c, buf)] = NUL;
-# else
- char_u buf[2];
-
- buf[0] = c;
- buf[1] = NUL;
-# endif
/* Fake a "c"hange command. When "restart_edit" is set (e.g., because
* 'insertmode' is set) fake a "d"elete command, Insert mode will
* restart automatically.
* Insert the typed character in the typeahead buffer, so that it will
* be mapped in Insert mode. Required for ":lmap" to work. May cause
* mapping a character from ":vnoremap"... */
- (void)ins_typebuf(buf, REMAP_YES, 0, !KeyTyped, FALSE);
+ ins_char_typebuf(c);
if (restart_edit != 0)
c = 'd';
else
diff --git a/src/window.c b/src/window.c
index 8c031bf625..718ce2e8c8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -47,7 +47,6 @@ static void frame_fix_width __ARGS((win_T *wp));
static int win_alloc_firstwin __ARGS((win_T *oldwin));
#if defined(FEAT_WINDOWS) || defined(PROTO)
static tabpage_T *alloc_tabpage __ARGS((void));
-static void free_tabpage __ARGS((tabpage_T *tp));
static int leave_tabpage __ARGS((buf_T *new_curbuf));
static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf));
static void frame_fix_height __ARGS((win_T *wp));
@@ -3184,7 +3183,7 @@ alloc_tabpage()
return tp;
}
- static void
+ void
free_tabpage(tp)
tabpage_T *tp;
{