Patch 8.2.0851 (after 8.2.0833)
Problem:    Can't distinguish <M-a> from accented "a" in the GUI.
Solution:   Use another way to make mapping <C-bslash> work. (closes #6163)
Files:      src/gui.c, src/gui_gtk_x11.c, src/getchar.c


*** ../vim-8.2.0850/src/gui.c   2020-05-27 22:08:30.127660296 +0200
--- src/gui.c   2020-05-30 18:57:56.502816840 +0200
***************
*** 803,810 ****
        if (!p_beval)
            gui_mch_disable_beval_area(balloonEval);
  #endif
!       // In case the terminal was used before ":gui".
!       seenModifyOtherKeys = FALSE;
  
  #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
        if (!im_xim_isvalid_imactivate())
--- 803,810 ----
        if (!p_beval)
            gui_mch_disable_beval_area(balloonEval);
  #endif
!       // In the GUI modifiers are prepended to keys.
!       seenModifyOtherKeys = TRUE;
  
  #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
        if (!im_xim_isvalid_imactivate())
*** ../vim-8.2.0850/src/gui_gtk_x11.c   2020-05-16 18:57:48.041181143 +0200
--- src/gui_gtk_x11.c   2020-05-30 19:37:33.785807170 +0200
***************
*** 1018,1029 ****
   * The output is written to string, which must have room for at least 6 bytes
   * plus the NUL terminator.  Returns the length in bytes.
   *
!  * This function is used in the GTK+ 2 GUI only.  The GTK+ 1 code makes use
!  * of GdkEventKey::string instead.  But event->string is evil; see here why:
   * 
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventKey
   */
      static int
! keyval_to_string(unsigned int keyval, unsigned int *state, char_u *string)
  {
      int           len;
      guint32 uc;
--- 1018,1028 ----
   * The output is written to string, which must have room for at least 6 bytes
   * plus the NUL terminator.  Returns the length in bytes.
   *
!  * event->string is evil; see here why:
   * 
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventKey
   */
      static int
! keyval_to_string(unsigned int keyval, char_u *string)
  {
      int           len;
      guint32 uc;
***************
*** 1031,1067 ****
      uc = gdk_keyval_to_unicode(keyval);
      if (uc != 0)
      {
!       // Check for CTRL-char
!       if ((*state & GDK_CONTROL_MASK) && uc >= 0x20 && uc < 0x80)
!       {
!           // These mappings look arbitrary at the first glance, but in fact
!           // resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my
!           // machine.  The only difference is BS vs. DEL for CTRL-8 (makes
!           // more sense and is consistent with usual terminal behaviour).
!           if (uc >= '@')
!               string[0] = uc & 0x1F;
!           else if (uc == '2')
!               string[0] = NUL;
!           else if (uc >= '3' && uc <= '7')
!               string[0] = uc ^ 0x28;
!           else if (uc == '8')
!               string[0] = BS;
!           else if (uc == '?')
!               string[0] = DEL;
!           else
!               string[0] = uc;
!           len = 1;
! 
!           if (string[0] != uc)
!               // The modifier was used, remove it.
!               *state = *state & ~GDK_CONTROL_MASK;
!       }
!       else
!       {
!           // Translate a normal key to UTF-8.  This doesn't work for dead
!           // keys of course, you _have_ to use an input method for that.
!           len = utf_char2bytes((int)uc, string);
!       }
      }
      else
      {
--- 1030,1038 ----
      uc = gdk_keyval_to_unicode(keyval);
      if (uc != 0)
      {
!       // Translate a normal key to UTF-8.  This doesn't work for dead
!       // keys of course, you _have_ to use an input method for that.
!       len = utf_char2bytes((int)uc, string);
      }
      else
      {
***************
*** 1173,1179 ****
      else
  #endif
      {
!       len = keyval_to_string(key_sym, &state, string2);
  
        // Careful: convert_input() doesn't handle the NUL character.
        // No need to convert pure ASCII anyway, thus the len > 1 check.
--- 1144,1150 ----
      else
  #endif
      {
!       len = keyval_to_string(key_sym, string2);
  
        // Careful: convert_input() doesn't handle the NUL character.
        // No need to convert pure ASCII anyway, thus the len > 1 check.
***************
*** 1261,1266 ****
--- 1232,1240 ----
      }
      else
      {
+       // <C-H> and <C-h> mean the same thing, always use "H"
+       if ((modifiers & MOD_MASK_CTRL) && ASCII_ISALPHA(key))
+           key = TOUPPER_ASC(key);
        string[0] = key;
        len = 1;
      }
*** ../vim-8.2.0850/src/getchar.c       2020-05-29 22:41:36.925691046 +0200
--- src/getchar.c       2020-05-30 19:15:53.770759263 +0200
***************
*** 1593,1608 ****
      if (mod_mask & MOD_MASK_CTRL)
      {
        if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_'))
-       {
            c &= 0x1f;
-           mod_mask &= ~MOD_MASK_CTRL;
-       }
        else if (c == '6')
-       {
            // CTRL-6 is equivalent to CTRL-^
            c = 0x1e;
            mod_mask &= ~MOD_MASK_CTRL;
-       }
      }
      if ((mod_mask & (MOD_MASK_META | MOD_MASK_ALT))
            && c >= 0 && c <= 127)
--- 1593,1618 ----
      if (mod_mask & MOD_MASK_CTRL)
      {
        if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_'))
            c &= 0x1f;
        else if (c == '6')
            // CTRL-6 is equivalent to CTRL-^
            c = 0x1e;
+ #ifdef FEAT_GUI_GTK
+       // These mappings look arbitrary at the first glance, but in fact
+       // resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my
+       // machine.  The only difference is BS vs. DEL for CTRL-8 (makes
+       // more sense and is consistent with usual terminal behaviour).
+       else if (c == '2')
+           c = NUL;
+       else if (c >= '3' && c <= '7')
+           c = c ^ 0x28;
+       else if (c == '8')
+           c = BS;
+       else if (c == '?')
+           c = DEL;
+ #endif
+       if (c != c_arg)
            mod_mask &= ~MOD_MASK_CTRL;
      }
      if ((mod_mask & (MOD_MASK_META | MOD_MASK_ALT))
            && c >= 0 && c <= 127)
*** ../vim-8.2.0850/src/version.c       2020-05-30 18:37:51.031344270 +0200
--- src/version.c       2020-05-30 19:51:57.558511382 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     851,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
218. Your spouse hands you a gift wrapped magnet with your PC's name
     on it and you accuse him or her of genocide.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005301753.04UHrPD6413510%40masaka.moolenaar.net.

Raspunde prin e-mail lui