[vim/vim] Ctrl-S mapping broken in Windows (#6175)

25 views
Skip to first unread message

li-ruijie

unread,
May 31, 2020, 8:12:13 PM5/31/20
to vim/vim, Subscribed

Platform: Windows 10 Professional x64
vim version: v8.2.0869
last vim version without bug: v8.2.0834

Reproduce:

  1. gvim -u NONE
  2. type something
  3. (I am not sure if mswin.vim is loaded by default. I think it is. If not, just sources mswin.vim here.)
  4. Try to save with Ctrl-S
  5. In insert mode, it inserts the ^S character. Doesn't save in Normal or Visual modes.

Simlar problems exist for Ctrl-V and Ctrl-C mappings.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

K.Takata

unread,
May 31, 2020, 9:46:49 PM5/31/20
to vim/vim, Subscribed

Please select "Remap a few keys" in the installer.

gvim-installer-mappings

This is not the default now, but once you select it and install Vim, the selection will be remembered when you update Vim.

Or add runtime mswin.vim in your .vimrc.

K.Takata

unread,
May 31, 2020, 9:46:51 PM5/31/20
to vim/vim, Subscribed

Closed #6175.

li-ruijie

unread,
Jun 1, 2020, 2:35:51 AM6/1/20
to vim/vim, Subscribed

Sorry, I cannot seem to get this working in gvim.
It works as exepected in vim but not gvim.

No matter how I map , it does not get picked up.

Axel Bender

unread,
Jun 1, 2020, 3:16:04 AM6/1/20
to vim_dev
Me don't.

Bisecting, I found that 851 broke a lot of my mappings. Please, fix this regression ASAP!

mattn

unread,
Jun 1, 2020, 3:19:04 AM6/1/20
to vim/vim, Subscribed

ca5bc74 break <c-s> mappings.

mattn

unread,
Jun 1, 2020, 3:31:33 AM6/1/20
to vim/vim, Subscribed

diff --git a/src/gui.c b/src/gui.c
index 3df992148..b700bf22a 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -803,8 +803,11 @@ gui_init(void)
 	if (!p_beval)
 	    gui_mch_disable_beval_area(balloonEval);
 #endif
+
+# ifndef FEAT_GUI_MSWIN
 	// In the GUI modifiers are prepended to keys.
 	seenModifyOtherKeys = TRUE;
+# endif
 
 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
 	if (!im_xim_isvalid_imactivate())

Probably this fixes the issues.

K.Takata

unread,
Jun 1, 2020, 6:16:21 AM6/1/20
to vim/vim, Subscribed

Reopened #6175.

Bram Moolenaar

unread,
Jun 1, 2020, 8:08:41 AM6/1/20
to vim/vim, Subscribed

Closed #6175 via ad772a6.

Bram Moolenaar

unread,
Jun 1, 2020, 8:09:41 AM6/1/20
to vim/vim, Subscribed


> ```diff

> diff --git a/src/gui.c b/src/gui.c
> index 3df992148..b700bf22a 100644
> --- a/src/gui.c
> +++ b/src/gui.c
> @@ -803,8 +803,11 @@ gui_init(void)
> if (!p_beval)
> gui_mch_disable_beval_area(balloonEval);
> #endif
> +
> +# ifndef FEAT_GUI_MSWIN
> // In the GUI modifiers are prepended to keys.
> seenModifyOtherKeys = TRUE;
> +# endif
>
> #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
> if (!im_xim_isvalid_imactivate())
> ```
>
> Probably this fixes the issues.

It's more a workaround than a fix. The MS-Windows GUI should send
modifiers, instead of including them into the key. Because otherwise
you cannot make a difference between using a key with a modifier and
entering the resulting key directly. E.g. for the difference between
CTRL-H and Backspace.

I had a quick look, but I don't see the place where the CTRL modifier is
used to turn CTRL-S into a 0x13 byte.

Let me change seenModifyOtherKeys for now, but I hope someone can fix
the problem by passing the modifier, so that all GUIs behave the same
way.

--
hundred-and-one symptoms of being an internet addict:
239. You think "surfing" is something you do on dry land.

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///

K.Takata

unread,
Jun 1, 2020, 11:24:51 AM6/1/20
to vim/vim, Subscribed

The MS-Windows GUI versions can make a difference between CTRL-H and Backspace even before seenModifyOtherKeys was introduced.

Bram Moolenaar

unread,
Jun 1, 2020, 11:35:11 AM6/1/20
to vim/vim, Subscribed


Ken Takata wrote:

> The MS-Windows GUI versions can make a difference between CTRL-H and
> Backspace even before seenModifyOtherKeys was introduced.

How/where is that implemented?

--
If you're sending someone Styrofoam, what do you pack it in?


/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///

Reply all
Reply to author
Forward
0 new messages