On 11/12/13 02:21, Andre Sihera wrote:
On 10/12/13 19:01, mattn wrote:
Windows console version doesn't switch to alternate-file with CTRL-^.
Currently, os_win32.c has workaround for this. But it's not correct way.

diff -r 79df7d17b859 src/os_win32.c
--- a/src/os_win32.c    Sat Dec 07 14:48:10 2013 +0100
+++ b/src/os_win32.c    Tue Dec 10 18:47:43 2013 +0900
@@ -860,29 +860,6 @@
      break;
      }

-    /* special cases */
-    if ((nModifs&  CTRL) != 0&&  (nModifs&  ~CTRL) == 0&&
pker->AChar == NUL)
-    {
-    /* Ctrl-6 is Ctrl-^ */
-    if (pker->wVirtualKeyCode == '6')
-    {
-        *pch = Ctrl_HAT;
-        return TRUE;
-    }
-    /* Ctrl-2 is Ctrl-@ */
-    else if (pker->wVirtualKeyCode == '2')
-    {
-        *pch = NUL;
-        return TRUE;
-    }
-    /* Ctrl-- is Ctrl-_ */
-    else if (pker->wVirtualKeyCode == 0xBD)
-    {
-        *pch = Ctrl__;
-        return TRUE;
-    }
-    }
-
      /* Shift-TAB */
      if (pker->wVirtualKeyCode == VK_TAB&&  (nModifs&  SHIFT_PRESSED))
      {
@@ -943,6 +920,19 @@
          if ((nModifs&  CTRL) != 0&&  (nModifs&  ALT) == 0
                      &&  *pch>= 0x20&&  *pch<  0x80)
          *pmodifiers |= MOD_MASK_CTRL;
+
+        if ((nModifs&  CTRL)&&  *pch == '^') {
+        *pch = Ctrl_HAT;
+        return TRUE;

This patch is wrong.

This above case should not be CTRL+'6' not CTRL+'^'. The original source
code is
correct and does not need changing.

Your patch will break everything as to get '^' on most western keyboards
you
also have to press SHIFT (i.e. your patch makes Ctrl_HAT equal to
CTRL+SHIFT+'6').

If someone else could confirm this.

Cheers,

+        }
+        if ((nModifs&  CTRL)&&  *pch == 28) {
+        *pch = Ctrl__;
+        return TRUE;
+        }
+        if ((nModifs&  CTRL)&&  *pch == '@') {
+        *pch = Ctrl_AT;
+        return TRUE;
+        }
      }
      }

```



On most non-English keyboards, hitting the ^ _key_ together with Ctrl does not produce the Ctrl-^ _code_.

See in the vim_use thread "Ctrl-] doesn't work ?" the original post and my answer, both dated 2013-12-04. As a summary, you can solve this problem the easy way or the hard way, but neither requires modification of the source code:

- The hard way: Find which key or key-combination produces the Ctrl-^ code on your keyboard. Maybe there isn't any, or maybe it requires some unlikely combination like AltGr+Ctrl+something. On my Belgian keyboard, used on a Linux OS, it is AltGr+Ctrl+§ (where § is "unshifted 6" and AltGr+§ produces non-dead-key ^).

- The easy way: Use a mapping, for instance (for use in all modes)

        :map  <F8> <C-^>
        :map! <F8> <C-^>

They are not incompatible: if you use "the easy way" first, and later find out which key combo does it, you may use whichever of these you prefer. For commands or characters that I use often, I prefer a single-key mapping to a three-key combo with AltGr+Ctrl, while OTOH for stuff that I rarely use (such as the copyright mark, which is AltGr+Shift+c here) a three-key combo is OK.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
50. The last girl you picked up was only a jpeg.

--
--
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].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui