diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-29 21:55:22 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-29 21:55:22 +0000 |
commit | d8fc5c0b999204f47efd7702502b41ead11948a4 (patch) | |
tree | 35c332fe05654b768a8126fc3de893eef95eac2c /src/getchar.c | |
parent | 8ea9123258804d6199c79789af295bb3ca3db296 (diff) |
updated for version 7.0f05
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 32 |
1 files changed, 32 insertions, 0 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(). |