=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/vim/Attic/term.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/vim/Attic/term.c 1996/09/07 21:40:24 1.1 +++ src/usr.bin/vim/Attic/term.c 1996/09/21 06:23:22 1.2 @@ -1,4 +1,4 @@ -/* $OpenBSD: term.c,v 1.1 1996/09/07 21:40:24 downsj Exp $ */ +/* $OpenBSD: term.c,v 1.2 1996/09/21 06:23:22 downsj Exp $ */ /* vi:set ts=4 sw=4: * * VIM - Vi IMproved by Bram Moolenaar @@ -365,6 +365,10 @@ {KS_MD, "\033|63m"}, {KS_SE, "\033|0m"}, {KS_SO, "\033|31m"}, + {KS_CZH, "\033|225m"}, /* italic mode: blue text on yellow */ + {KS_CZR, "\033|0m"}, /* italic mode end */ + {KS_US, "\033|67m"}, /* underscore mode: cyan text on red */ + {KS_UE, "\033|0m"}, /* underscore mode end */ {KS_MS, "\001"}, # ifdef TERMINFO {KS_CM, "\033|%i%p1%d;%p2%dH"}, @@ -633,8 +637,10 @@ {K_HELP, "\033[28~"}, {K_UNDO, "\033[26~"}, {K_INS, "\033[2~"}, - {K_HOME, "\033[7~"}, /* also seen: "\033[1~" */ - {K_END, "\033[8~"}, /* also seen: "\033[4~" */ + {K_HOME, "\033[7~"}, + {K_KHOME, "\033[1~"}, + {K_END, "\033[8~"}, + {K_KEND, "\033[4~"}, {K_PAGEUP, "\033[5~"}, {K_PAGEDOWN, "\033[6~"}, /* {K_DEL, "\033[3~"}, not used */ @@ -832,6 +838,10 @@ {K_END, "[END]"}, {K_PAGEUP, "[PAGEUP]"}, {K_PAGEDOWN, "[PAGEDOWN]"}, + {K_KHOME, "[KHOME]"}, + {K_KEND, "[KEND]"}, + {K_KPAGEUP, "[KPAGEUP]"}, + {K_KPAGEDOWN, "[KPAGEDOWN]"}, {K_MOUSE, "[MOUSE]"}, # endif @@ -1015,7 +1025,7 @@ "k1", "k2", "k3", "k4", "k5", "k6", "k7", "k8", "k9", "k;", "F1", "F2", "%1", "&8", "kb", "kI", "kD", "kh", - "@7", "kP", "kN", + "@7", "kP", "kN", "K1", "K3", "K4", "K5", NULL }; static struct { @@ -1051,9 +1061,9 @@ for (i = 0; string_names[i].name != NULL; ++i) { if (term_strings[string_names[i].dest] == NULL || - term_strings[string_names[i].dest] == empty_option) + term_strings[string_names[i].dest] == empty_option) term_strings[string_names[i].dest] = - TGETSTR(string_names[i].name, &tp); + TGETSTR(string_names[i].name, &tp); } if ((T_MS == NULL || T_MS == empty_option) && tgetflag("ms")) @@ -1070,7 +1080,7 @@ { if (find_termcode((char_u *)key_names[i]) == NULL) add_termcode((char_u *)key_names[i], - TGETSTR(key_names[i], &tp)); + TGETSTR(key_names[i], &tp)); } /* if cursor-left == backspace, ignore it (televideo 925) */ @@ -1569,8 +1579,10 @@ termcapinit(term) char_u *term; { +#ifndef WIN32 if (!term || !*term) term = vim_getenv((char_u *)"TERM"); +#endif if (!term || !*term) term = DEFAULT_TERM; set_string_option((char_u *)"term", -1, term, TRUE); @@ -1755,7 +1767,7 @@ ttest(pairs) int pairs; { - char *t = NULL; + char *t = NULL; check_options(); /* make sure no options are NULL */ @@ -1974,6 +1986,7 @@ if (!starting) { comp_Botline_all(); + maketitle(); if (State == ASKMORE || State == EXTERNCMD) { screenalloc(FALSE); /* don't redraw, just adjust screen size */ @@ -2212,7 +2225,7 @@ #ifdef HAVE_TGETENT BC = (char *)empty_option; UP = (char *)empty_option; - PC = ' '; /* set pad character to space */ + PC = NUL; /* set pad character to NUL */ ospeed = 0; #endif @@ -2368,7 +2381,7 @@ int new_slen; int extra; char_u string[MAX_KEY_CODE_LEN + 1]; - int i; + int i, j; #ifdef USE_GUI long_u val; #endif @@ -2475,6 +2488,25 @@ { if (len < slen) /* got a partial sequence */ return -1; /* need to get more chars */ + + /* + * When found a keypad key, check if there is another key + * that matches and use that one. This makes to be + * found instead of when they produce the same + * key code. + */ + if (termcodes[i].name[0] == 'K' && + isdigit(termcodes[i].name[1])) + { + for (j = i + 1; j < tc_len; ++j) + if (termcodes[j].len == slen && + STRNCMP(termcodes[i].code, + termcodes[j].code, slen) == 0) + { + i = j; + break; + } + } key_name[0] = termcodes[i].name[0]; key_name[1] = termcodes[i].name[1];