Restore emulation of ich with insert mode.

This commit is contained in:
Nicholas Marriott 2009-01-10 22:28:40 +00:00
parent 736117e4e9
commit ee0a7cda88
3 changed files with 22 additions and 6 deletions

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.219 2009-01-10 19:37:35 nicm Exp $ */ /* $Id: tmux.h,v 1.220 2009-01-10 22:28:40 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -289,12 +289,14 @@ enum tty_code_code {
TTYC_RI, /* scroll_reverse, sr */ TTYC_RI, /* scroll_reverse, sr */
TTYC_RMACS, /* exit_alt_charset_mode */ TTYC_RMACS, /* exit_alt_charset_mode */
TTYC_RMCUP, /* exit_ca_mode, te */ TTYC_RMCUP, /* exit_ca_mode, te */
TTYC_RMIR, /* exit_insert_mode, ei */
TTYC_RMKX, /* keypad_local, ke */ TTYC_RMKX, /* keypad_local, ke */
TTYC_SETAB, /* set_a_background, AB */ TTYC_SETAB, /* set_a_background, AB */
TTYC_SETAF, /* set_a_foreground, AF */ TTYC_SETAF, /* set_a_foreground, AF */
TTYC_SGR0, /* exit_attribute_mode, me */ TTYC_SGR0, /* exit_attribute_mode, me */
TTYC_SMACS, /* enter_alt_charset_mode, as */ TTYC_SMACS, /* enter_alt_charset_mode, as */
TTYC_SMCUP, /* enter_ca_mode, ti */ TTYC_SMCUP, /* enter_ca_mode, ti */
TTYC_SMIR, /* enter_insert_mode, im */
TTYC_SMKX, /* keypad_xmit, ks */ TTYC_SMKX, /* keypad_xmit, ks */
TTYC_SMSO, /* enter_standout_mode, so */ TTYC_SMSO, /* enter_standout_mode, so */
TTYC_SMUL, /* enter_underline_mode, us */ TTYC_SMUL, /* enter_underline_mode, us */

View File

@ -1,4 +1,4 @@
/* $Id: tty-term.c,v 1.6 2009-01-10 22:26:08 nicm Exp $ */ /* $Id: tty-term.c,v 1.7 2009-01-10 22:28:40 nicm Exp $ */
/* /*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -96,12 +96,14 @@ struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
{ TTYC_RI, TTYCODE_STRING, "ri" }, { TTYC_RI, TTYCODE_STRING, "ri" },
{ TTYC_RMACS, TTYCODE_STRING, "rmacs" }, { TTYC_RMACS, TTYCODE_STRING, "rmacs" },
{ TTYC_RMCUP, TTYCODE_STRING, "rmcup" }, { TTYC_RMCUP, TTYCODE_STRING, "rmcup" },
{ TTYC_RMIR, TTYCODE_STRING, "rmir" },
{ TTYC_RMKX, TTYCODE_STRING, "rmkx" }, { TTYC_RMKX, TTYCODE_STRING, "rmkx" },
{ TTYC_SETAB, TTYCODE_STRING, "setab" }, { TTYC_SETAB, TTYCODE_STRING, "setab" },
{ TTYC_SETAF, TTYCODE_STRING, "setaf" }, { TTYC_SETAF, TTYCODE_STRING, "setaf" },
{ TTYC_SGR0, TTYCODE_STRING, "sgr0" }, { TTYC_SGR0, TTYCODE_STRING, "sgr0" },
{ TTYC_SMACS, TTYCODE_STRING, "smacs" }, { TTYC_SMACS, TTYCODE_STRING, "smacs" },
{ TTYC_SMCUP, TTYCODE_STRING, "smcup" }, { TTYC_SMCUP, TTYCODE_STRING, "smcup" },
{ TTYC_SMIR, TTYCODE_STRING, "smir" },
{ TTYC_SMKX, TTYCODE_STRING, "smkx" }, { TTYC_SMKX, TTYCODE_STRING, "smkx" },
{ TTYC_SMSO, TTYCODE_STRING, "smso" }, { TTYC_SMSO, TTYCODE_STRING, "smso" },
{ TTYC_SMUL, TTYCODE_STRING, "smul" }, { TTYC_SMUL, TTYCODE_STRING, "smul" },
@ -290,8 +292,11 @@ tty_term_find(char *name, int fd, char **cause)
xasprintf(cause, "terminal does not support dl1 or dl"); xasprintf(cause, "terminal does not support dl1 or dl");
goto error; goto error;
} }
if (!tty_term_has(term, TTYC_ICH1) && !tty_term_has(term, TTYC_ICH)) { if (!tty_term_has(term, TTYC_ICH1) &&
xasprintf(cause, "terminal does not support ich1 or ich"); !tty_term_has(term, TTYC_ICH) && (!tty_term_has(term, TTYC_SMIR) ||
!tty_term_has(term, TTYC_RMIR))) {
xasprintf(cause,
"terminal does not support ich1 or ich or smir and rmir");
goto error; goto error;
} }
if (!tty_term_has(term, TTYC_DCH1) && !tty_term_has(term, TTYC_DCH)) { if (!tty_term_has(term, TTYC_DCH1) && !tty_term_has(term, TTYC_DCH)) {

13
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.56 2009-01-10 01:51:22 nicm Exp $ */ /* $Id: tty.c,v 1.57 2009-01-10 22:28:40 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -411,7 +411,16 @@ tty_cmd_insertcharacter(struct tty *tty, unused struct screen *s, va_list ap)
tty_reset(tty); tty_reset(tty);
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ua); if (tty_term_has(tty->term, TTYC_ICH) ||
tty_term_has(tty->term, TTYC_ICH1))
tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ua);
else {
tty_putcode(tty, TTYC_SMIR);
while (ua-- > 0)
tty_putc(tty, ' ');
tty_putcode(tty, TTYC_RMIR);
tty_putcode2(tty, TTYC_CUP, s->cy, s->cx);
}
} }
void void