Mercurial > vim
diff src/term.c @ 2672:6a2e4860134b v7.3.091
updated for version 7.3.091
Problem: "vim -w foo" writes special key codes for removed escape
sequences. (Josh Triplett)
Solution: Don't write K_IGNORE codes.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 30 Dec 2010 12:30:31 +0100 |
parents | 0ca06a92adfb |
children | 5a1fe35a6eaf |
line wrap: on
line diff
--- a/src/term.c +++ b/src/term.c @@ -3828,6 +3828,7 @@ set_mouse_topline(wp) * Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off * + max_offset]. * Return 0 for no match, -1 for partial match, > 0 for full match. + * Return KEYLEN_REMOVED when a key code was deleted. * With a match, the match is removed, the replacement code is inserted in * typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is * returned. @@ -3845,6 +3846,7 @@ check_termcode(max_offset, buf, buflen) int slen = 0; /* init for GCC */ int modslen; int len; + int retval = 0; int offset; char_u key_name[2]; int modifiers; @@ -4940,6 +4942,13 @@ check_termcode(max_offset, buf, buflen) #endif string[new_slen++] = key_name[1]; } + else if (new_slen == 0 && key_name[0] == KS_EXTRA + && key_name[1] == KE_IGNORE) + { + /* Do not put K_IGNORE into the buffer, do return KEYLEN_REMOVED + * to indicate what happened. */ + retval = KEYLEN_REMOVED; + } else { string[new_slen++] = K_SPECIAL; @@ -4976,7 +4985,7 @@ check_termcode(max_offset, buf, buflen) (size_t)(buflen - offset)); mch_memmove(buf + offset, string, (size_t)new_slen); } - return (len + extra + offset); + return retval == 0 ? (len + extra + offset) : retval; } return 0; /* no match found */