The Windows conpty layer now allows terminal emulators other
than the classic conhost.exe to host win32 console applications that
use mouse events.
For mouse events to function correctly, mouse input needs to be
enabled and quick edit mode needs to be disabled.
This commit teaches vim to make this change when it enables mouse
mode.
I have no special knowledge of vim, and this patch is roughly based
on the suggested changes in this discussion:
https://groups.google.com/g/vim_dev/c/bQ7jfMwa8Zg
The intent is to enable mouse input and disable quickedit when
enabling mouse mode, and to disable mouse input and restore the
prior quickedit mode state when mouse mode is disabled.
refs: microsoft/terminal#9970
https://github.com/vim/vim/pull/8280
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
@k-takata commented on this pull request.
In src/os_win32.c:
> @@ -1165,6 +1165,7 @@ decode_key_event( #endif // FEAT_GUI_MSWIN +static DWORD g_cmodein = 0;
This line should be moved to near line 1184 because this variable is not needed for the GUI.
In src/os_win32.c:
> @@ -2782,7 +2789,6 @@ SaveConsoleTitleAndIcon(void) static int g_fWindInitCalled = FALSE; static int g_fTermcapMode = FALSE; static CONSOLE_CURSOR_INFO g_cci; -static DWORD g_cmodein = 0; static DWORD g_cmodeout = 0;
I think it's better to move g_cmodeout together with g_cmodein for readability.
Doesn't the line cmodein |= g_cmodein & ENABLE_QUICK_EDIT_MODE; need to be added after here? https://github.com/vim/vim/pull/8280/files#diff-6e09d275741ed4a17372f6e64995645e818d605e41a0591b2c20741f4878d3c1R3778-R3779
Doesn't the line
cmodein |= g_cmodein & ENABLE_QUICK_EDIT_MODE;need to be added after here? https://github.com/vim/vim/pull/8280/files#diff-6e09d275741ed4a17372f6e64995645e818d605e41a0591b2c20741f4878d3c1R3778-R3779
Yeah, good catch! I've restructured this a bit to always set the extended flags when setting the input mode so that it is harder to overlook this again!
Merging #8280 (c4d83e8) into master (dc3275a) will decrease coverage by
87.03%.
The diff coverage isn/a.
@@ Coverage Diff @@ ## master #8280 +/- ## =========================================== - Coverage 89.53% 2.50% -87.04% =========================================== Files 148 146 -2 Lines 167020 161877 -5143 =========================================== - Hits 149544 4050 -145494 - Misses 17476 157827 +140351
| Flag | Coverage Δ | |
|---|---|---|
| huge-clang-none | ? |
|
| huge-gcc-none | ? |
|
| huge-gcc-testgui | ? |
|
| huge-gcc-unittests | 2.50% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/sha256.c | 0.00% <0.00%> (-97.96%) |
⬇️ |
| src/digraph.c | 0.00% <0.00%> (-97.78%) |
⬇️ |
| src/gui_gtk_f.c | 0.00% <0.00%> (-97.54%) |
⬇️ |
| src/match.c | 0.00% <0.00%> (-97.13%) |
⬇️ |
| src/crypt_zip.c | 0.00% <0.00%> (-97.06%) |
⬇️ |
| src/evalbuffer.c | 0.00% <0.00%> (-96.83%) |
⬇️ |
| src/debugger.c | 0.00% <0.00%> (-96.62%) |
⬇️ |
| src/libvterm/src/rect.h | 0.00% <0.00%> (-96.56%) |
⬇️ |
| src/evalfunc.c | 0.00% <0.00%> (-96.51%) |
⬇️ |
| src/textprop.c | 0.00% <0.00%> (-96.45%) |
⬇️ |
| ... and 134 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 dc3275a...c4d83e8. Read the comment docs.
Can some people try this out and give feedback?
If someone wants to give it a try, my manual test plan for this is:
Windows Terminal Preview (from the MS Store, or download from GitHub) or the Nightly WezTerm build (https://wezfurlong.org/wezterm/install/windows.html):set mouse=aWithout this change, the mouse won't function.
After exiting vim, run a vim.exe without this change: mouse shouldn't work there because quickedit status should have been restored to its default enabled state when vim exited.
Also: in regular cmd.exe, mouse should work without having to manually change "Quick Edit Mode" in command prompt properties.
I have already used a similar patch based on the old patch in the vim_dev mailing list.
So, I think this should be okay, but I will try this later.
> @@ -1165,7 +1165,6 @@ decode_key_event( #endif // FEAT_GUI_MSWIN -
This change is unnecessary.
@wez commented on this pull request.
fixed!
The following item can be removed from the todo.txt:
Win32: Patch for enabling quick edit mode in console. (Craig Barkhouse, 2010
Sep 1)
Oh, it looks that it's a mistake of the todo item.
Craig's patch actually disabled the QE mode: https://groups.google.com/g/vim_dev/c/bQ7jfMwa8Zg/m/KTEu7WkUAvIJ .