Karsten Hopp fc3208
To: vim_dev@googlegroups.com
Karsten Hopp fc3208
Subject: Patch 7.4.413
Karsten Hopp fc3208
Fcc: outbox
Karsten Hopp fc3208
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp fc3208
Mime-Version: 1.0
Karsten Hopp fc3208
Content-Type: text/plain; charset=UTF-8
Karsten Hopp fc3208
Content-Transfer-Encoding: 8bit
Karsten Hopp fc3208
------------
Karsten Hopp fc3208
Karsten Hopp fc3208
Patch 7.4.413
Karsten Hopp fc3208
Problem:    MS-Windows: Using US international keyboard layout, inserting dead
Karsten Hopp fc3208
	    key by pressing space does not always work.  Issue 250.
Karsten Hopp fc3208
Solution:   Let MS-Windows translate the message. (John Wellesz)
Karsten Hopp fc3208
Files:	    src/gui_w48.c
Karsten Hopp fc3208
Karsten Hopp fc3208
Karsten Hopp fc3208
*** ../vim-7.4.412/src/gui_w48.c	2014-08-06 14:52:05.043236174 +0200
Karsten Hopp fc3208
--- src/gui_w48.c	2014-08-22 18:41:09.151182571 +0200
Karsten Hopp fc3208
***************
Karsten Hopp fc3208
*** 614,619 ****
Karsten Hopp fc3208
--- 614,621 ----
Karsten Hopp fc3208
      char_u	string[40];
Karsten Hopp fc3208
      int		len = 0;
Karsten Hopp fc3208
  
Karsten Hopp fc3208
+     dead_key = 0;
Karsten Hopp fc3208
+ 
Karsten Hopp fc3208
      len = char_to_string(ch, string, 40, FALSE);
Karsten Hopp fc3208
      if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts)
Karsten Hopp fc3208
      {
Karsten Hopp fc3208
***************
Karsten Hopp fc3208
*** 1788,1811 ****
Karsten Hopp fc3208
      if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
Karsten Hopp fc3208
      {
Karsten Hopp fc3208
  	vk = (int) msg.wParam;
Karsten Hopp fc3208
! 	/* handle key after dead key, but ignore shift, alt and control */
Karsten Hopp fc3208
! 	if (dead_key && vk != VK_SHIFT && vk != VK_MENU && vk != VK_CONTROL)
Karsten Hopp fc3208
  	{
Karsten Hopp fc3208
  	    dead_key = 0;
Karsten Hopp fc3208
! 	    /* handle non-alphabetic keys (ones that hopefully cannot generate
Karsten Hopp fc3208
! 	     * umlaut-characters), unless when control is down */
Karsten Hopp fc3208
! 	    if (vk < 'A' || vk > 'Z' || (GetKeyState(VK_CONTROL) & 0x8000))
Karsten Hopp fc3208
! 	    {
Karsten Hopp fc3208
! 		MSG dm;
Karsten Hopp fc3208
! 
Karsten Hopp fc3208
! 		dm.message = msg.message;
Karsten Hopp fc3208
! 		dm.hwnd = msg.hwnd;
Karsten Hopp fc3208
! 		dm.wParam = VK_SPACE;
Karsten Hopp fc3208
! 		MyTranslateMessage(&dm;;	/* generate dead character */
Karsten Hopp fc3208
! 		if (vk != VK_SPACE) /* and send current character once more */
Karsten Hopp fc3208
! 		    PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam);
Karsten Hopp fc3208
! 		return;
Karsten Hopp fc3208
! 	    }
Karsten Hopp fc3208
  	}
Karsten Hopp fc3208
  
Karsten Hopp fc3208
  	/* Check for CTRL-BREAK */
Karsten Hopp fc3208
--- 1790,1810 ----
Karsten Hopp fc3208
      if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN)
Karsten Hopp fc3208
      {
Karsten Hopp fc3208
  	vk = (int) msg.wParam;
Karsten Hopp fc3208
! 	/*
Karsten Hopp fc3208
! 	 * If a dead key was pressed and the user presses VK_SPACE, VK_BACK, or
Karsten Hopp fc3208
! 	 * VK_ESCAPE it means that he actually wants to deal with the dead char
Karsten Hopp fc3208
! 	 * now, so do nothing special and let Windows handle it.
Karsten Hopp fc3208
! 	 *
Karsten Hopp fc3208
! 	 * Note that VK_SPACE combines with the dead_key's character and only
Karsten Hopp fc3208
! 	 * one WM_CHAR will be generated by TranslateMessage(), in the two
Karsten Hopp fc3208
! 	 * other cases two WM_CHAR will be generated: the dead char and VK_BACK
Karsten Hopp fc3208
! 	 * or VK_ESCAPE.  That is most likely what the user expects.
Karsten Hopp fc3208
! 	 */
Karsten Hopp fc3208
! 	if (dead_key && (vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE))
Karsten Hopp fc3208
  	{
Karsten Hopp fc3208
  	    dead_key = 0;
Karsten Hopp fc3208
! 	    MyTranslateMessage(&msg;;
Karsten Hopp fc3208
! 	    return;
Karsten Hopp fc3208
  	}
Karsten Hopp fc3208
  
Karsten Hopp fc3208
  	/* Check for CTRL-BREAK */
Karsten Hopp fc3208
*** ../vim-7.4.412/src/version.c	2014-08-22 18:12:53.999244049 +0200
Karsten Hopp fc3208
--- src/version.c	2014-08-22 18:39:03.915187113 +0200
Karsten Hopp fc3208
***************
Karsten Hopp fc3208
*** 743,744 ****
Karsten Hopp fc3208
--- 743,746 ----
Karsten Hopp fc3208
  {   /* Add new patch number below this line */
Karsten Hopp fc3208
+ /**/
Karsten Hopp fc3208
+     413,
Karsten Hopp fc3208
  /**/
Karsten Hopp fc3208
Karsten Hopp fc3208
-- 
Karsten Hopp fc3208
hundred-and-one symptoms of being an internet addict:
Karsten Hopp fc3208
43. You tell the kids they can't use the computer because "Daddy's got work to
Karsten Hopp fc3208
    do" and you don't even have a job.
Karsten Hopp fc3208
Karsten Hopp fc3208
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp fc3208
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp fc3208
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp fc3208
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///