To: vim-dev@vim.org Subject: Patch 5.6.074 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.074 (extra) Problem: Entering CSI directly doesn't always work, because it's recognized as the start of a special key. Mostly a problem with multi-byte in the GUI. Solution: Use K_CSI for a typed CSI character. Use for a normal CSI, for a CSI typed in the GUI. Files: runtime/doc/intro.txt, src/getchar.c, src/gui_amiga.c, src/gui_gtk_x11.c, src/gui_mac.c, src/gui_riscos.c, src/gui_w32.c, src/keymap.h, src/misc2.c *** ../vim-5.6.73/runtime/doc/intro.txt Sun Jan 16 14:12:56 2000 --- runtime/doc/intro.txt Tue Apr 18 21:16:32 2000 *************** *** 1,4 **** ! *intro.txt* For Vim version 5.6. Last change: 2000 Jan 10 VIM REFERENCE MANUAL by Bram Moolenaar --- 1,4 ---- ! *intro.txt* For Vim version 5.6. Last change: 2000 Apr 18 VIM REFERENCE MANUAL by Bram Moolenaar *************** *** 370,375 **** --- 377,384 ---- backslash \ 92 *backslash* ** vertical bar | 124 ** delete 127 + command sequence intro ALT-Esc 155 ** + CSI when typed in the GUI ** end-of-line (can be , or , depends on system and 'fileformat') ** *** ../vim-5.6.73/src/getchar.c Sat Mar 25 21:29:50 2000 --- src/getchar.c Sun Apr 16 11:28:20 2000 *************** *** 1114,1119 **** --- 1114,1125 ---- continue; } #endif + #ifdef USE_GUI + /* Translate K_CSI to CSI. The special key is only used to avoid + * it being recognized as the start of a special key. */ + if (c == K_CSI) + c = CSI; + #endif } #ifdef MSDOS /* *** ../vim-5.6.73/src/gui_amiga.c Sat Dec 4 19:51:22 1999 --- src/gui_amiga.c Sun Apr 16 11:47:11 2000 *************** *** 379,388 **** break; case IDCMP_VANILLAKEY: { ! char_u string[1]; string[0] = (char_u)code; returnEvent = ev_KeyStroke; - add_to_input_buf(string,1); break; case IDCMP_RAWKEY: if (msg->Qualifier & IEQUALIFIER_LSHIFT) --- 379,397 ---- break; case IDCMP_VANILLAKEY: { ! char_u string[3]; ! string[0] = (char_u)code; + if (code == CSI) + { + /* Insert CSI as K_CSI. Untested! */ + string[1] = KS_EXTRA; + string[2] = KE_CSI; + add_to_input_buf(string, 3); + } + else + add_to_input_buf(string, 1); returnEvent = ev_KeyStroke; break; case IDCMP_RAWKEY: if (msg->Qualifier & IEQUALIFIER_LSHIFT) *** ../vim-5.6.73/src/gui_gtk_x11.c Tue Mar 28 11:58:41 2000 --- src/gui_gtk_x11.c Fri May 19 21:17:39 2000 *************** *** 633,638 **** --- 633,647 ---- trash_input_buf(); got_int = TRUE; } + + if (len == 1 && string[0] == CSI) + { + /* Turn CSI into K_CSI. */ + string[1] = KS_EXTRA; + string[2] = KE_CSI; + len = 3; + } + add_to_input_buf(string, len); /* blank out the pointer if necessary */ *************** *** 700,706 **** for (i = 0; i < count; i++) g_string_append(str, list[i]); ! p = str->str; len = str->len; g_string_free(str, FALSE); gdk_free_text_list(list); --- 709,715 ---- for (i = 0; i < count; i++) g_string_append(str, list[i]); ! p = (char_u *)str->str; len = str->len; g_string_free(str, FALSE); gdk_free_text_list(list); *** ../vim-5.6.73/src/gui_mac.c Thu Dec 30 10:07:36 1999 --- src/gui_mac.c Sun Apr 30 11:35:48 2000 *************** *** 1293,1298 **** --- 1403,1416 ---- add_to_input_buf(string2, 3); } + if (num == 1 && string[0] == CSI) + { + /* Insert CSI as K_CSI. Not tested! */ + string[1] = KS_EXTRA; + string[2] = KE_CSI; + num = 3; + } + add_to_input_buf(string, num); } *** ../vim-5.6.73/src/gui_riscos.c Fri May 14 15:59:20 1999 --- src/gui_riscos.c Sun Apr 16 11:58:05 2000 *************** *** 1613,1624 **** switch (a) { case 0x1e: ! return ro_press('k','h', 0); /* Home */ case 0x7f: ! return ro_press('k','D', 0); /* Delete */ default: add_to_input_buf(code, 1); ! return; } case 1: if ((a & 0xcf) == 0xcc) --- 1614,1635 ---- switch (a) { case 0x1e: ! ro_press('k','h', 0); /* Home */ ! return; case 0x7f: ! ro_press('k','D', 0); /* Delete */ ! return; ! case CSI: ! { ! /* Turn CSI into K_CSI. Untested! */ ! char_u string[3] = {CSI, KS_EXTRA, KE_CSI}; ! ! add_to_input_buf(string, 3); ! return; ! } default: add_to_input_buf(code, 1); ! return; } case 1: if ((a & 0xcf) == 0xcc) *** ../vim-5.6.73/src/gui_w32.c Wed Apr 5 16:30:51 2000 --- src/gui_w32.c Tue Apr 18 10:36:37 2000 *************** *** 10,16 **** * * GUI support for Microsoft Windows. Win32 initially; maybe Win16 later * ! * George V. Reilly wrote the original Win32 GUI. * Robert Webb reworked it to use the existing GUI stuff and added menu, * scrollbars, etc. * --- 10,16 ---- * * GUI support for Microsoft Windows. Win32 initially; maybe Win16 later * ! * George V. Reilly wrote the original Win32 GUI. * Robert Webb reworked it to use the existing GUI stuff and added menu, * scrollbars, etc. * *************** *** 813,822 **** static void _OnChar( HWND hwnd, ! UINT ch, int cRepeat) { ! char_u string[1]; /* TRACE("OnChar(%d, %c)\n", ch, ch); */ --- 813,822 ---- static void _OnChar( HWND hwnd, ! UINT ch, /* Careful: CSI arrives as 0xffffff9b */ int cRepeat) { ! char_u string[3]; /* TRACE("OnChar(%d, %c)\n", ch, ch); */ *************** *** 826,832 **** trash_input_buf(); got_int = TRUE; } ! add_to_input_buf(string, 1); } static void --- 826,841 ---- trash_input_buf(); got_int = TRUE; } ! ! if (string[0] == CSI) ! { ! /* Insert CSI as K_CSI. */ ! string[1] = KS_EXTRA; ! string[2] = KE_CSI; ! add_to_input_buf(string, 3); ! } ! else ! add_to_input_buf(string, 1); } static void *************** *** 871,884 **** --- 880,901 ---- string[len++] = KS_MODIFIER; string[len++] = modifiers; } + if (IS_SPECIAL(ch)) { string[len++] = CSI; string[len++] = K_SECOND(ch); string[len++] = K_THIRD(ch); } + else if (ch == CSI) + { + string[len++] = CSI; + string[len++] = KS_EXTRA; + string[len++] = KE_CSI; + } else string[len++] = ch; + add_to_input_buf(string, len); } *** ../vim-5.6.73/src/keymap.h Thu Mar 23 17:46:04 2000 --- src/keymap.h Sun Apr 16 11:24:45 2000 *************** *** 206,212 **** KE_MOUSEUP, /* scroll wheel pseudo-button Up */ KE_KINS, /* keypad Insert key */ ! KE_KDEL /* keypad Delete key */ }; /* --- 206,214 ---- KE_MOUSEUP, /* scroll wheel pseudo-button Up */ KE_KINS, /* keypad Insert key */ ! KE_KDEL, /* keypad Delete key */ ! ! KE_CSI /* CSI typed directly */ }; /* *************** *** 350,355 **** --- 352,359 ---- #define K_SELECT TERMCAP2KEY(KS_SELECT, K_FILLER) #define K_TEAROFF TERMCAP2KEY(KS_TEAROFF, K_FILLER) + + #define K_CSI TERMCAP2KEY(KS_EXTRA, KE_CSI) /* * Symbols for pseudo keys which are translated from the real key symbols *** ../vim-5.6.73/src/misc2.c Thu Mar 23 17:46:04 2000 --- src/misc2.c Sun Apr 16 12:04:07 2000 *************** *** 1335,1340 **** --- 1335,1342 ---- {K_BS, (char_u *)"BS"}, {K_BS, (char_u *)"BackSpace"}, /* Alternative name */ {ESC, (char_u *)"Esc"}, + {CSI, (char_u *)"CSI"}, + {K_CSI, (char_u *)"xCSI"}, {'|', (char_u *)"Bar"}, {'\\', (char_u *)"Bslash"}, {K_DEL, (char_u *)"Del"}, *** ../vim-5.6.73/src/version.c Thu Jun 1 19:39:20 2000 --- src/version.c Thu Jun 1 19:43:35 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 74, /**/ -- A special cleaning ordinance bans housewives from hiding dirt and dust under a rug in a dwelling. [real standing law in Pennsylvania, United States of America] /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/