Patch 8.2.1027
Problem:    GUI: multi-byte characters do not work in a terminal.
Solution:   Do not assume a key is one byte. (closes #6304)
Files:      src/gui_gtk_x11.c, src/gui_x11.c


*** ../vim-8.2.1026/src/gui_gtk_x11.c   2020-06-20 14:43:20.357653490 +0200
--- src/gui_gtk_x11.c   2020-06-21 15:04:43.426660584 +0200
***************
*** 1215,1221 ****
      if (len == -3)
        key = TO_SPECIAL(string[1], string[2]);
      else
!       key = string[0];
  
      // Handle modifiers.
      modifiers = modifiers_gdk2vim(state);
--- 1215,1224 ----
      if (len == -3)
        key = TO_SPECIAL(string[1], string[2]);
      else
!     {
!       string[len] = NUL;
!       key = mb_ptr2char(string);
!     }
  
      // Handle modifiers.
      modifiers = modifiers_gdk2vim(state);
***************
*** 1240,1247 ****
        // May remove the shift modifier if it's included in the key.
        modifiers = may_remove_shift_modifier(modifiers, key);
  
!       string[0] = key;
!       len = 1;
      }
  
      if (modifiers != 0)
--- 1243,1249 ----
        // May remove the shift modifier if it's included in the key.
        modifiers = may_remove_shift_modifier(modifiers, key);
  
!       len = mb_char2bytes(key, string);
      }
  
      if (modifiers != 0)
*** ../vim-8.2.1026/src/gui_x11.c       2020-05-28 21:03:49.505375147 +0200
--- src/gui_x11.c       2020-06-21 15:07:52.446146633 +0200
***************
*** 938,944 ****
      if (len == -3)
        key = TO_SPECIAL(string[1], string[2]);
      else
!       key = string[0];
      key = simplify_key(key, &modifiers);
      if (key == CSI)
        key = K_CSI;
--- 938,947 ----
      if (len == -3)
        key = TO_SPECIAL(string[1], string[2]);
      else
!     {
!       string[len] = NUL;
!       key = mb_ptr2char(string);
!     }
      key = simplify_key(key, &modifiers);
      if (key == CSI)
        key = K_CSI;
***************
*** 951,958 ****
      }
      else
      {
!       string[0] = key;
!       len = 1;
  
        // Remove the SHIFT modifier for keys where it's already included,
        // e.g., '(', '!' and '*'.
--- 954,960 ----
      }
      else
      {
!       len = mb_char2bytes(key, string);
  
        // Remove the SHIFT modifier for keys where it's already included,
        // e.g., '(', '!' and '*'.
*** ../vim-8.2.1026/src/version.c       2020-06-21 14:12:14.014668156 +0200
--- src/version.c       2020-06-21 15:04:00.426776947 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1027,
  /**/

-- 
I just planted an Algebra tree. It has square roots.

 /// 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/202006211309.05LD9kVo1146441%40masaka.moolenaar.net.

Raspunde prin e-mail lui