To: vim-dev@vim.org Subject: Patch 5.6.015 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.015 Problem: New xterm delete key sends [3~ by default. Solution: Added and to make the set of keypad keys complete. Files: src/edit.c, src/ex_getln.c, src/keymap.h, src/misc1.c, src/misc2.c, src/normal.c, src/os_unix.c, src/term.c *** ../vim-5.6.14/src/edit.c Wed Mar 22 10:54:40 2000 --- src/edit.c Thu Mar 23 17:25:01 2000 *************** *** 662,667 **** --- 662,668 ---- switch (c) { case K_INS: /* toggle insert/replace mode */ + case K_KINS: #ifdef FKMAP if (p_fkmap && p_ri) { *************** *** 809,814 **** --- 810,816 ---- /* delete character under the cursor */ case K_DEL: + case K_KDEL: ins_del(); need_redraw = TRUE; break; *** ../vim-5.6.14/src/ex_getln.c Wed Dec 29 10:47:03 1999 --- src/ex_getln.c Thu Mar 23 17:27:35 2000 *************** *** 629,639 **** --- 629,643 ---- case K_BS: case Ctrl('H'): case K_DEL: + case K_KDEL: case Ctrl('W'): #ifdef FKMAP if (cmd_fkmap && c == K_BS) c = K_DEL; #endif + if (c == K_KDEL) + c = K_DEL; + /* * delete current character is the same as backspace on next * character, except at end of line *************** *** 689,694 **** --- 693,699 ---- goto cmdline_changed; case K_INS: + case K_KINS: #ifdef FKMAP /* if Farsi mode set, we are in reverse insert mode - Do not change the mode */ *************** *** 1474,1480 **** if (c1 == '\r') c1 = '\n'; ! if (c1 == BS || c1 == K_BS || c1 == DEL || c1 == K_DEL) { if (line_ga.ga_len > 0) { --- 1479,1486 ---- if (c1 == '\r') c1 = '\n'; ! if (c1 == BS || c1 == K_BS ! || c1 == DEL || c1 == K_DEL || c1 == K_KDEL) { if (line_ga.ga_len > 0) { *** ../vim-5.6.14/src/keymap.h Thu Sep 9 17:06:35 1999 --- src/keymap.h Thu Mar 23 17:17:33 2000 *************** *** 203,209 **** KE_S_XF4, KE_MOUSEDOWN, /* scroll wheel pseudo-button Down */ ! KE_MOUSEUP /* scroll wheel pseudo-button Up */ }; /* --- 203,212 ---- KE_S_XF4, KE_MOUSEDOWN, /* scroll wheel pseudo-button Down */ ! KE_MOUSEUP, /* scroll wheel pseudo-button Up */ ! ! KE_KINS, /* keypad Insert key */ ! KE_KDEL /* keypad Delete key */ }; /* *************** *** 320,326 **** --- 323,331 ---- #define K_BS TERMCAP2KEY('k', 'b') #define K_INS TERMCAP2KEY('k', 'I') + #define K_KINS TERMCAP2KEY(KS_EXTRA, KE_KINS) #define K_DEL TERMCAP2KEY('k', 'D') + #define K_KDEL TERMCAP2KEY(KS_EXTRA, KE_KDEL) #define K_HOME TERMCAP2KEY('k', 'h') #define K_KHOME TERMCAP2KEY('K', '1') /* keypad home (upper left) */ #define K_XHOME TERMCAP2KEY(KS_EXTRA, KE_XHOME) *** ../vim-5.6.14/src/misc1.c Thu Nov 4 10:17:00 1999 --- src/misc1.c Thu Mar 23 17:28:23 2000 *************** *** 2101,2107 **** n = n * 10 + c - '0'; msg_putchar(c); } ! else if (c == K_DEL || c == K_BS || c == Ctrl('H')) { n /= 10; MSG_PUTS("\b \b"); --- 2101,2107 ---- n = n * 10 + c - '0'; msg_putchar(c); } ! else if (c == K_DEL || c == K_KDEL || c == K_BS || c == Ctrl('H')) { n /= 10; MSG_PUTS("\b \b"); *** ../vim-5.6.14/src/misc2.c Sat Jan 8 21:27:11 2000 --- src/misc2.c Thu Mar 23 17:28:50 2000 *************** *** 1339,1344 **** --- 1339,1345 ---- {'\\', (char_u *)"Bslash"}, {K_DEL, (char_u *)"Del"}, {K_DEL, (char_u *)"Delete"}, /* Alternative name */ + {K_KDEL, (char_u *)"kDel"}, {K_UP, (char_u *)"Up"}, {K_DOWN, (char_u *)"Down"}, {K_LEFT, (char_u *)"Left"}, *************** *** 1392,1397 **** --- 1393,1399 ---- {K_UNDO, (char_u *)"Undo"}, {K_INS, (char_u *)"Insert"}, {K_INS, (char_u *)"Ins"}, /* Alternative name */ + {K_KINS, (char_u *)"kInsert"}, {K_HOME, (char_u *)"Home"}, {K_KHOME, (char_u *)"kHome"}, {K_XHOME, (char_u *)"xHome"}, *************** *** 1747,1753 **** /* don't want keycode, use single byte code */ if (key == K_BS) key = BS; ! else if (key == K_DEL) key = DEL; } --- 1749,1755 ---- /* don't want keycode, use single byte code */ if (key == K_BS) key = BS; ! else if (key == K_DEL || key == K_KDEL) key = DEL; } *** ../vim-5.6.14/src/normal.c Mon Dec 20 09:45:46 1999 --- src/normal.c Thu Mar 23 17:32:08 2000 *************** *** 310,318 **** { /* Pick up any leading digits and compute ca.count0 */ while ( (c >= '1' && c <= '9') ! || (ca.count0 != 0 && (c == K_DEL || c == '0'))) { ! if (c == K_DEL) { ca.count0 /= 10; #ifdef CMDLINE_INFO --- 310,318 ---- { /* Pick up any leading digits and compute ca.count0 */ while ( (c >= '1' && c <= '9') ! || (ca.count0 != 0 && (c == K_DEL || c == K_KDEL || c == '0'))) { ! if (c == K_DEL || c == K_KDEL) { ca.count0 /= 10; #ifdef CMDLINE_INFO *************** *** 1023,1028 **** --- 1023,1029 ---- case 'I': case 'i': case K_INS: + case K_KINS: command_busy = nv_edit(&ca); break; *************** *** 1081,1092 **** } /* FALLTHROUGH */ case K_DEL: case 'Y': case 'D': case 'C': case 'x': case 'X': ! if (ca.cmdchar == K_DEL) ca.cmdchar = 'x'; /* DEL key behaves like 'x' */ /* with Visual these commands are operators */ --- 1082,1094 ---- } /* FALLTHROUGH */ case K_DEL: + case K_KDEL: case 'Y': case 'D': case 'C': case 'x': case 'X': ! if (ca.cmdchar == K_DEL || ca.cmdchar == K_KDEL) ca.cmdchar = 'x'; /* DEL key behaves like 'x' */ /* with Visual these commands are operators */ *************** *** 3366,3372 **** #ifdef CMDLINE_INFO (void)add_to_showcmd(nchar); #endif ! if (nchar == K_DEL) n /= 10; else if (vim_isdigit(nchar)) n = n * 10 + (nchar - '0'); --- 3368,3374 ---- #ifdef CMDLINE_INFO (void)add_to_showcmd(nchar); #endif ! if (nchar == K_DEL || nchar == K_KDEL) n /= 10; else if (vim_isdigit(nchar)) n = n * 10 + (nchar - '0'); *************** *** 5750,5756 **** CMDARG *cap; { /* is equal to "i" */ ! if (cap->cmdchar == K_INS) cap->cmdchar = 'i'; /* in Visual mode "A" and "I" are an operator */ --- 5752,5758 ---- CMDARG *cap; { /* is equal to "i" */ ! if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS) cap->cmdchar = 'i'; /* in Visual mode "A" and "I" are an operator */ *** ../vim-5.6.14/src/os_unix.c Fri Jan 14 22:27:22 2000 --- src/os_unix.c Thu Mar 23 17:30:16 2000 *************** *** 2548,2558 **** if (ta_buf[i] == CSI && len - i > 2) { c = TERMCAP2KEY(ta_buf[i + 1], ta_buf[i + 2]); ! if (c == K_DEL || c == K_BS) { mch_memmove(ta_buf + i + 1, ta_buf + i + 3, (size_t)(len - i - 2)); ! if (c == K_DEL) ta_buf[i] = DEL; else ta_buf[i] = Ctrl('H'); --- 2548,2558 ---- if (ta_buf[i] == CSI && len - i > 2) { c = TERMCAP2KEY(ta_buf[i + 1], ta_buf[i + 2]); ! if (c == K_DEL || c == K_KDEL || c == K_BS) { mch_memmove(ta_buf + i + 1, ta_buf + i + 3, (size_t)(len - i - 2)); ! if (c == K_DEL || c == K_KDEL) ta_buf[i] = DEL; else ta_buf[i] = Ctrl('H'); *** ../vim-5.6.14/src/term.c Mon Mar 20 18:21:42 2000 --- src/term.c Thu Mar 23 17:24:41 2000 *************** *** 882,888 **** {K_KDIVIDE, "\033Oo"}, /* keypad / */ {K_KMULTIPLY, "\033Oj"}, /* keypad * */ {K_KENTER, "\033OM"}, /* keypad Enter */ ! /* {K_DEL, "\033[3~"}, not used */ {BT_EXTRA_KEYS, ""}, {TERMCAP2KEY('k', '0'), "\033[10~"}, /* F0 */ --- 882,888 ---- {K_KDIVIDE, "\033Oo"}, /* keypad / */ {K_KMULTIPLY, "\033Oj"}, /* keypad * */ {K_KENTER, "\033OM"}, /* keypad Enter */ ! {K_KDEL, "\033[3~"}, /* keypad Del */ {BT_EXTRA_KEYS, ""}, {TERMCAP2KEY('k', '0'), "\033[10~"}, /* F0 */ *************** *** 1123,1129 **** --- 1123,1131 ---- {K_UNDO, "[UNDO]"}, {K_BS, "[BS]"}, {K_INS, "[INS]"}, + {K_KINS, "[KINS]"}, {K_DEL, "[DEL]"}, + {K_KDEL, "[KDEL]"}, {K_HOME, "[HOME]"}, {K_KHOME, "[KHOME]"}, {K_XHOME, "[XHOME]"}, *** ../vim-5.6.14/src/version.c Wed Mar 22 10:54:40 2000 --- src/version.c Thu Mar 23 17:39:38 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 15, /**/ -- hundred-and-one symptoms of being an internet addict: 246. You use up your free 100 hours in less than a week. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/