diff --git a/tmux.h b/tmux.h index cfd4973b..96e387e6 100644 --- a/tmux.h +++ b/tmux.h @@ -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 @@ -289,12 +289,14 @@ enum tty_code_code { TTYC_RI, /* scroll_reverse, sr */ TTYC_RMACS, /* exit_alt_charset_mode */ TTYC_RMCUP, /* exit_ca_mode, te */ + TTYC_RMIR, /* exit_insert_mode, ei */ TTYC_RMKX, /* keypad_local, ke */ TTYC_SETAB, /* set_a_background, AB */ TTYC_SETAF, /* set_a_foreground, AF */ TTYC_SGR0, /* exit_attribute_mode, me */ TTYC_SMACS, /* enter_alt_charset_mode, as */ TTYC_SMCUP, /* enter_ca_mode, ti */ + TTYC_SMIR, /* enter_insert_mode, im */ TTYC_SMKX, /* keypad_xmit, ks */ TTYC_SMSO, /* enter_standout_mode, so */ TTYC_SMUL, /* enter_underline_mode, us */ diff --git a/tty-term.c b/tty-term.c index c11e7565..e903d8ce 100644 --- a/tty-term.c +++ b/tty-term.c @@ -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 @@ -96,12 +96,14 @@ struct tty_term_code_entry tty_term_codes[NTTYCODE] = { { TTYC_RI, TTYCODE_STRING, "ri" }, { TTYC_RMACS, TTYCODE_STRING, "rmacs" }, { TTYC_RMCUP, TTYCODE_STRING, "rmcup" }, + { TTYC_RMIR, TTYCODE_STRING, "rmir" }, { TTYC_RMKX, TTYCODE_STRING, "rmkx" }, { TTYC_SETAB, TTYCODE_STRING, "setab" }, { TTYC_SETAF, TTYCODE_STRING, "setaf" }, { TTYC_SGR0, TTYCODE_STRING, "sgr0" }, { TTYC_SMACS, TTYCODE_STRING, "smacs" }, { TTYC_SMCUP, TTYCODE_STRING, "smcup" }, + { TTYC_SMIR, TTYCODE_STRING, "smir" }, { TTYC_SMKX, TTYCODE_STRING, "smkx" }, { TTYC_SMSO, TTYCODE_STRING, "smso" }, { 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"); goto error; } - if (!tty_term_has(term, TTYC_ICH1) && !tty_term_has(term, TTYC_ICH)) { - xasprintf(cause, "terminal does not support ich1 or ich"); + if (!tty_term_has(term, TTYC_ICH1) && + !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; } if (!tty_term_has(term, TTYC_DCH1) && !tty_term_has(term, TTYC_DCH)) { diff --git a/tty.c b/tty.c index aad33009..c3ae5b5c 100644 --- a/tty.c +++ b/tty.c @@ -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 @@ -411,7 +411,16 @@ tty_cmd_insertcharacter(struct tty *tty, unused struct screen *s, va_list ap) 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