1
0
forked from aniani/vim

updated for version 7.0f05

This commit is contained in:
Bram Moolenaar
2006-04-29 21:55:22 +00:00
parent 8ea9123258
commit d8fc5c0b99
8 changed files with 930 additions and 225 deletions

View File

@@ -1032,6 +1032,38 @@ ins_typebuf(str, noremap, offset, nottyped, silent)
return OK;
}
/*
* 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

View File

@@ -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 */
}

View File

@@ -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

View File

@@ -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;
{