[vim/vim] fix SHIFT-Insert on Windows command prompt (#2381)

52 views
Skip to first unread message

mattn

unread,
Nov 28, 2017, 6:24:29 AM11/28/17
to vim/vim, Subscribed

This is fixing for a bug which vim.exe doesn't accept SHIFT-INSERT.

https://groups.google.com/forum/#!topic/vim_use/G1hB7FJbyAo/discussion

When patch 7.4.852 is included, combination of K_NUL & ANSI keys was not handled. And it was converted to unicode.

https://groups.google.com/forum/#!topic/vim_dev/Gu7pDIjS1UE/discussion

		if (ch2 != NUL)
		{
		    typeahead[typeaheadlen + n] = 3;
		    typeahead[typeaheadlen + n + 1] = (char_u)ch2;
		    n += 2;
		}

For example, following part use K_NUL & ANSI key to handle SHIFT-INSERT.

vim/src/os_win32.c

Lines 989 to 1013 in bdb8139

for (i = sizeof(VirtKeyMap) / sizeof(VirtKeyMap[0]); --i >= 0; )
{
if (VirtKeyMap[i].wVirtKey == pker->wVirtualKeyCode)
{
if (nModifs == 0)
*pch = VirtKeyMap[i].chAlone;
else if ((nModifs & SHIFT) != 0 && (nModifs & ~SHIFT) == 0)
*pch = VirtKeyMap[i].chShift;
else if ((nModifs & CTRL) != 0 && (nModifs & ~CTRL) == 0)
*pch = VirtKeyMap[i].chCtrl;
else if ((nModifs & ALT) != 0 && (nModifs & ~ALT) == 0)
*pch = VirtKeyMap[i].chAlt;
if (*pch != 0)
{
if (VirtKeyMap[i].fAnsiKey)
{
*pch2 = *pch;
*pch = K_NUL;
}
return TRUE;
}
}
}

This change handle K_NUL in leading-character.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/2381

Commit Summary

  • fix SHIFT-Insert on Windows command prompt

File Changes

Patch Links:


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

Codecov

unread,
Nov 28, 2017, 7:04:28 AM11/28/17
to vim/vim, Subscribed

Codecov Report

Merging #2381 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2381      +/-   ##
==========================================
+ Coverage   74.52%   74.53%   +<.01%     
==========================================
  Files          91       91              
  Lines      132415   132416       +1     
  Branches    29083    29083              
==========================================
+ Hits        98686    98695       +9     
+ Misses      33700    33696       -4     
+ Partials       29       25       -4
Impacted Files Coverage Δ
src/gui_beval.c 62.66% <0%> (-0.43%) ⬇️
src/gui.c 47.45% <0%> (-0.21%) ⬇️
src/terminal.c 64.85% <0%> (-0.07%) ⬇️
src/term.c 50.72% <0%> (-0.06%) ⬇️
src/message.c 68.67% <0%> (-0.05%) ⬇️
src/syntax.c 77.51% <0%> (-0.03%) ⬇️
src/libvterm/src/screen.c 72.79% <0%> (-0.03%) ⬇️
src/ex_docmd.c 75.58% <0%> (+0.02%) ⬆️
src/os_unix.c 54.28% <0%> (+0.04%) ⬆️
src/channel.c 82.44% <0%> (+0.08%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bdb8139...3a1aa51. Read the comment docs.

mattn

unread,
Nov 28, 2017, 10:47:34 AM11/28/17
to vim/vim, Subscribed

Sorry, this break something. For example, <up> key doesn't work.

Bram Moolenaar

unread,
Nov 28, 2017, 12:08:45 PM11/28/17
to vim/vim, Subscribed

Closed #2381 via 3660a10.

mattn

unread,
Nov 28, 2017, 12:11:24 PM11/28/17
to vim/vim, Subscribed

@brammool This should not be merged since this PR is still wrong. As I mentioned in above, <Up> doesn't work.

mattn

unread,
Nov 28, 2017, 7:57:21 PM11/28/17
to vim/vim, Subscribed

@chrisbra @k-takata Could please reopen this?

K.Takata

unread,
Nov 28, 2017, 8:07:28 PM11/28/17
to vim/vim, Subscribed

Reopened #2381.

mattn

unread,
Nov 28, 2017, 10:58:26 PM11/28/17
to vim/vim, Push

@mattn pushed 10 commits.

  • f38c86e patch 8.0.1352: dead URLs in the help go unnoticed
  • 1ed2276 patch 8.0.1353: QuickFixCmdPost is not used consistently
  • 3660a10 patch 8.0.1354: Shift-Insert doesn't always work in MS-Windows console
  • a45ff6c patch 8.0.1355: cursor keys don't work in MS-Windows console
  • c5aa55d patch 8.0.1356: using simalt in a GUIEnter autocommand inserts characters
  • 1a2ab99 patch 8.0.1357: startup test fails on OpenBSD
  • 8b9e20a patch 8.0.1358: undercurl is not used in the terminal
  • 66c1ea0 fix SHIFT-Insert on Windows command prompt
  • 3e4ac13 handle K_NUL only when pressing with modifier keys
  • aeae41d Merge branch 'fix-shift-insert-win32con' of github.com:mattn/vim into fix-shift-insert-win32con


You are receiving this because you are subscribed to this thread.

View it on GitHub

mattn

unread,
Nov 29, 2017, 2:29:19 AM11/29/17
to vim/vim, Subscribed

Fixed. I checked this on vim.exe with utf-8 and cp932.

Bram Moolenaar

unread,
Dec 5, 2017, 9:15:28 AM12/5/17
to vim/vim, Subscribed

Closed #2381 via feeb4d0.

Reply all
Reply to author
Forward
0 new messages