To: vim-dev@vim.org Subject: Patch 6.2.397 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.397 Problem: When using a double-byte 'encoding' mapping doesn't work. (Yasuhiro Matsumoto) Solution: Do not set the 8th bit of the character but use a modifier. Files: src/gui_gtk_x11.c, src/gui_x11.c, src/misc2.c *** ../vim-6.2.396/src/gui_gtk_x11.c Mon Mar 22 14:41:00 2004 --- src/gui_gtk_x11.c Sat Mar 20 13:21:41 2004 *************** *** 1038,1049 **** /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character * that already has the 8th bit set. ! * Don't do this for , that should become K_S_TAB with ALT. */ if (len == 1 && (state & GDK_MOD1_MASK) && !(key_sym == GDK_BackSpace || key_sym == GDK_Delete) && (string[0] & 0x80) == 0 ! && !(key_sym == GDK_Tab && (state & GDK_SHIFT_MASK))) { string[0] |= 0x80; state &= ~GDK_MOD1_MASK; /* don't use it again */ --- 1038,1055 ---- /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character * that already has the 8th bit set. ! * Don't do this for , that should become K_S_TAB with ALT. ! * Don't do this for double-byte encodings, it turns the char into a lead ! * byte. */ if (len == 1 && (state & GDK_MOD1_MASK) && !(key_sym == GDK_BackSpace || key_sym == GDK_Delete) && (string[0] & 0x80) == 0 ! && !(key_sym == GDK_Tab && (state & GDK_SHIFT_MASK)) ! #ifdef FEAT_MBYTE ! && !enc_dbcs ! #endif ! ) { string[0] |= 0x80; state &= ~GDK_MOD1_MASK; /* don't use it again */ *************** *** 1084,1094 **** if (len == 0) /* Unrecognized key */ return TRUE; ! /* Special keys (and a few others) may have modifiers */ if (len == -3 || key_sym == GDK_space || key_sym == GDK_Tab || key_sym == GDK_Return || key_sym == GDK_Linefeed || key_sym == GDK_Escape || key_sym == GDK_KP_Tab ! || key_sym == GDK_ISO_Enter || key_sym == GDK_3270_Enter) { modifiers = 0; if (state & GDK_SHIFT_MASK) --- 1090,1105 ---- if (len == 0) /* Unrecognized key */ return TRUE; ! /* Special keys (and a few others) may have modifiers. Also when using a ! * double-byte encoding (can't set the 8th bit). */ if (len == -3 || key_sym == GDK_space || key_sym == GDK_Tab || key_sym == GDK_Return || key_sym == GDK_Linefeed || key_sym == GDK_Escape || key_sym == GDK_KP_Tab ! || key_sym == GDK_ISO_Enter || key_sym == GDK_3270_Enter ! #ifdef FEAT_MBYTE ! || (enc_dbcs && len == 1 && (state & GDK_MOD1_MASK)) ! #endif ! ) { modifiers = 0; if (state & GDK_SHIFT_MASK) *** ../vim-6.2.396/src/gui_x11.c Thu Feb 26 15:42:54 2004 --- src/gui_x11.c Sat Mar 20 13:09:23 2004 *************** *** 897,907 **** #endif /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character ! * that already has the 8th bit set. */ if (len == 1 && (ev_press->state & Mod1Mask) && !(key_sym == XK_BackSpace || key_sym == XK_Delete) ! && (string[0] & 0x80) == 0) { #if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF) /* Ignore ALT keys when they are used for the menu only */ --- 897,913 ---- #endif /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character ! * that already has the 8th bit set. And not when using a double-byte ! * encoding, setting the 8th bit may make it the lead byte of a ! * double-byte character. */ if (len == 1 && (ev_press->state & Mod1Mask) && !(key_sym == XK_BackSpace || key_sym == XK_Delete) ! && (string[0] & 0x80) == 0 ! #ifdef FEAT_MBYTE ! && !enc_dbcs ! #endif ! ) { #if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF) /* Ignore ALT keys when they are used for the menu only */ *************** *** 975,984 **** if (len == 0) goto theend; ! /* Special keys (and a few others) may have modifiers */ if (len == -3 || key_sym == XK_space || key_sym == XK_Tab ! || key_sym == XK_Return || key_sym == XK_Linefeed ! || key_sym == XK_Escape) { modifiers = 0; if (ev_press->state & ShiftMask) --- 981,995 ---- if (len == 0) goto theend; ! /* Special keys (and a few others) may have modifiers. Also when using a ! * double-byte encoding (can't set the 8th bit). */ if (len == -3 || key_sym == XK_space || key_sym == XK_Tab ! || key_sym == XK_Return || key_sym == XK_Linefeed ! || key_sym == XK_Escape ! #ifdef FEAT_MBYTE ! || (enc_dbcs && len == 1 && (ev_press->state & Mod1Mask)) ! #endif ! ) { modifiers = 0; if (ev_press->state & ShiftMask) *** ../vim-6.2.396/src/misc2.c Wed Mar 17 14:08:56 2004 --- src/misc2.c Sat Mar 20 13:17:45 2004 *************** *** 2316,2322 **** /* Command-key really special, No fancynest */ if (!(modifiers & MOD_MASK_CMD)) #endif ! if ((modifiers & MOD_MASK_ALT) && key < 0x80) { key |= 0x80; modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */ --- 2316,2326 ---- /* Command-key really special, No fancynest */ if (!(modifiers & MOD_MASK_CMD)) #endif ! if ((modifiers & MOD_MASK_ALT) && key < 0x80 ! #ifdef FEAT_MBYTE ! && !enc_dbcs /* avoid creating a lead byte */ ! #endif ! ) { key |= 0x80; modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */ *** ../vim-6.2.396/src/version.c Tue Mar 23 14:08:00 2004 --- src/version.c Tue Mar 23 21:01:46 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 397, /**/ -- I'm writing a book. I've got the page numbers done. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///