[vim/vim] added mouse scroll wheel handling for win32 console (PR #11374)

32 views
Skip to first unread message

Christopher Plewright

unread,
Oct 15, 2022, 7:20:00 AM10/15/22
to vim/vim, Subscribed

tested in both the old command prompt conhost.exe as well as the new windows terminal wt.exe


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

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

Commit Summary

  • 03ba5af added mouse scroll wheel handling for win32 console

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374@github.com>

codecov[bot]

unread,
Oct 15, 2022, 8:01:25 AM10/15/22
to vim/vim, Subscribed

Codecov Report

Merging #11374 (03ba5af) into master (4ccaedf) will decrease coverage by 81.57%.
The diff coverage is n/a.

@@             Coverage Diff             @@

##           master   #11374       +/-   ##

===========================================

- Coverage   81.87%    0.29%   -81.58%     

===========================================

  Files         162      152       -10     

  Lines      189365   175086    -14279     

  Branches    43071    40295     -2776     

===========================================

- Hits       155041      520   -154521     

- Misses      21770   174509   +152739     

+ Partials    12554       57    -12497     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 0.29% <ø> (ø)
linux 0.29% <ø> (-82.25%) ⬇️
mingw-x64-HUGE ?
mingw-x86-HUGE ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/float.c 0.00% <0.00%> (-98.42%) ⬇️
src/sha256.c 0.00% <0.00%> (-96.45%) ⬇️
src/gui_gtk_f.c 0.00% <0.00%> (-94.72%) ⬇️
src/arabic.c 0.00% <0.00%> (-94.57%) ⬇️
src/crypt_zip.c 0.00% <0.00%> (-94.12%) ⬇️
src/testing.c 0.00% <0.00%> (-93.84%) ⬇️
src/typval.c 0.00% <0.00%> (-93.26%) ⬇️
src/blob.c 0.00% <0.00%> (-92.63%) ⬇️
src/debugger.c 0.00% <0.00%> (-92.31%) ⬇️
src/eval.c 0.00% <0.00%> (-92.18%) ⬇️
... and 146 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279730776@github.com>

Bram Moolenaar

unread,
Oct 15, 2022, 8:02:46 AM10/15/22
to vim/vim, Subscribed


> tested in both the old command prompt conhost.exe as well as the new
> windows terminal wt.exe

Thanks for working on this.

It might be too much to ask, but would it be possible to add a test for
this?

About the changes to .gitignore: Where does "/vim90/" come from?
Is "/src/.vscode/" something that is created when building Vim with
Visual Studio?

Please check the code formatting, it doesn't look like it's using Vim
style everywhere.

--
Arthur pulls Pin out. The MONK blesses the grenade as ...
ARTHUR: (quietly) One, two, five ...
GALAHAD: Three, sir!
ARTHUR: Three.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279731024@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 8:23:06 AM10/15/22
to vim/vim, Subscribed

Thanks for working on this. It might be too much to ask, but would it be possible to add a test for this? About the changes to .gitignore: Where does "/vim90/" come from? Is "/src/.vscode/" something that is created when building Vim with Visual Studio? Please check the code formatting, it doesn't look like it's using Vim style everywhere.

Thanks for taking the time to review my suggestion. I'm happy to get involved. I can look into writing some tests, but not sure if the existing automated test tools can capture what is going in - will find out.

The .gitignore changes are unimportant for the issue. The vim90 directory is just where my build scripts create my installer package, before deploying it to my Program FIles, and the .vscode directory is just from the tooling of Visual Studio Code. Let me know if its not worth sharing, and I think I can move these ignores out.

Sorry about the formatting, it looked different in Visual Studio Code (tabs and spaces have changed). I tried to follow the existing style in the source code. I havent seen the VIm style guide, but I will look it up, and am happy to clean it up.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279734711@github.com>

Bram Moolenaar

unread,
Oct 15, 2022, 12:09:48 PM10/15/22
to vim/vim, Subscribed


> > Thanks for working on this. It might be too much to ask, but would
> > it be possible to add a test for this? About the changes to
> > .gitignore: Where does "/vim90/" come from? Is "/src/.vscode/"
> > something that is created when building Vim with Visual Studio?
> > Please check the code formatting, it doesn't look like it's using
> > Vim style everywhere.
>
> Thanks for taking the time to review my suggestion. I'm happy to get
> involved. I can look into writing some tests, but not sure if the
> existing automated test tools can capture what is going in - will find
> out.
>
> The .gitignore changes are unimportant for the issue. The vim90
> directory is just where my build scripts create my installer package,
> before deploying it to my Program FIles, and the .vscode directory is
> just from the tooling of Visual Studio Code. Let me know if its not
> worth sharing, and I think I can move these ignores out.

The .vscode directory seems like something common, that others would
also run into. The vim90 directory seems to be specific for your tools,
thus I would not include that.


> Sorry about the formatting, it looked different in Visual Studio Code
> (tabs and spaces have changed). I tried to follow the existing style
> in the source code. I havent seen the VIm style guide, but I will
> look it up, and am happy to clean it up.

It should be obvious that using Vim for editing avoids lots of problems!
:-)

There isn't a complete style guide, just look in some other files to
find examples. E.g. we don't use "{" after "if" but put it in the next
line. Some OS specific files don't follow this (yet) though.

--
Dreams are free, but there's a small charge for alterations.


/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279774664@github.com>

K.Takata

unread,
Oct 15, 2022, 12:52:27 PM10/15/22
to vim/vim, Subscribed

@k-takata commented on this pull request.

Please also fix the indentation as already mentioned.


In src/os_win32.c:

> +     static void

+decode_mouse_wheel( MOUSE_EVENT_RECORD *pmer )

⬇️ Suggested change
-     static void

-decode_mouse_wheel( MOUSE_EVENT_RECORD *pmer )

+    static void

+decode_mouse_wheel(MOUSE_EVENT_RECORD *pmer)


In src/os_win32.c:

> +	int l_col;

+	int l_row;

+	l_col = g_xMouse;

+	l_row = g_yMouse;

+	wp = mouse_find_win(&l_row, &l_col, FAIL_POPUP);

+    if (wp != NULL && popup_is_popup(wp))

+    {

+		g_nMouseClick = -1;

+

+		cmdarg_T cap;

+		oparg_T oa;

+		CLEAR_FIELD(cap);

+		clear_oparg(&oa);

+		cap.oap = &oa;

+		

+		if ( horizontal ) 

⬇️ Suggested change
-		if ( horizontal ) 

+		if (horizontal)


In src/os_win32.c:

> +    if (horizontal)

+		direction = zDelta >= 0 ? KE_MOUSELEFT : KE_MOUSERIGHT;

+    else

+		direction = zDelta >= 0 ? KE_MOUSEDOWN : KE_MOUSEUP;

+

+

+	// Decode the win32 console key modifers into Vim mouse modifers. 

+	if (pmer->dwControlKeyState & SHIFT_PRESSED)

+		modifiers |= MOD_MASK_SHIFT; //MOUSE_SHIFT;

+    if (pmer->dwControlKeyState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))

+		modifiers |= MOD_MASK_CTRL; //MOUSE_CTRL;

+    if (pmer->dwControlKeyState & (RIGHT_ALT_PRESSED  | LEFT_ALT_PRESSED))

+		modifiers |= MOD_MASK_ALT; // MOUSE_ALT;

+

+	// add (bitwise or) the scroll direction and the key modifier chars together.

+	g_nMouseClick = ( (direction << 8) | modifiers );

⬇️ Suggested change
-	g_nMouseClick = ( (direction << 8) | modifiers );

+	g_nMouseClick = ((direction << 8) | modifiers);


In src/os_win32.c:

> @@ -1303,9 +1402,15 @@ decode_mouse_event(

     // unprocessed mouse click?

     if (g_nMouseClick != -1)

 	return TRUE;

+   

+    if (pmer->dwEventFlags == MOUSE_WHEELED || pmer->dwEventFlags == MOUSE_HWHEELED )

⬇️ Suggested change
-    if (pmer->dwEventFlags == MOUSE_WHEELED || pmer->dwEventFlags == MOUSE_HWHEELED )

+    if (pmer->dwEventFlags == MOUSE_WHEELED || pmer->dwEventFlags == MOUSE_HWHEELED)


In src/os_win32.c:

> @@ -1939,12 +2044,37 @@ mch_inchar(

 		fprintf(fdDump, "{%02x @ %d, %d}",

 			g_nMouseClick, g_xMouse, g_yMouse);

 # endif

-	    typeahead[typeaheadlen++] = ESC + 128;

-	    typeahead[typeaheadlen++] = 'M';

-	    typeahead[typeaheadlen++] = g_nMouseClick;

-	    typeahead[typeaheadlen++] = g_xMouse + '!';

-	    typeahead[typeaheadlen++] = g_yMouse + '!';

-	    g_nMouseClick = -1;

+		char_u modifiers = ((char_u *)(&g_nMouseClick))[0];

+		char_u scroll_dir = ((char_u *)(&g_nMouseClick))[1];

+

+		if( scroll_dir > 0 

⬇️ Suggested change
-		if( scroll_dir > 0 

+		if (scroll_dir > 0


In src/os_win32.c:

> +				scroll_dir==KE_MOUSEDOWN ||

+				scroll_dir==KE_MOUSEUP ||

+				scroll_dir==KE_MOUSELEFT ||

+				scroll_dir==KE_MOUSERIGHT ) 

⬇️ Suggested change
-				scroll_dir==KE_MOUSEDOWN ||

-				scroll_dir==KE_MOUSEUP ||

-				scroll_dir==KE_MOUSELEFT ||

-				scroll_dir==KE_MOUSERIGHT ) 

+				scroll_dir == KE_MOUSEDOWN ||

+				scroll_dir == KE_MOUSEUP ||

+				scroll_dir == KE_MOUSELEFT ||

+				scroll_dir == KE_MOUSERIGHT)


In src/os_win32.c:

> -	    typeahead[typeaheadlen++] = g_nMouseClick;

-	    typeahead[typeaheadlen++] = g_xMouse + '!';

-	    typeahead[typeaheadlen++] = g_yMouse + '!';

-	    g_nMouseClick = -1;

+		char_u modifiers = ((char_u *)(&g_nMouseClick))[0];

+		char_u scroll_dir = ((char_u *)(&g_nMouseClick))[1];

+

+		if( scroll_dir > 0 

+			&& (

+				scroll_dir==KE_MOUSEDOWN ||

+				scroll_dir==KE_MOUSEUP ||

+				scroll_dir==KE_MOUSELEFT ||

+				scroll_dir==KE_MOUSERIGHT ) 

+			)

+		{

+			if ( modifiers > 0 )

⬇️ Suggested change
-			if ( modifiers > 0 )

+			if (modifiers > 0)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/review/1143206869@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 6:55:04 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341270348@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 6:59:24 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341284553@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 6:59:35 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341285065@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 6:59:45 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341285712@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 6:59:57 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341286214@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 7:00:06 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341286670@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 7:00:13 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341287022@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 7:00:23 PM10/15/22
to vim/vim, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341287501@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 7:04:14 PM10/15/22
to vim/vim, Subscribed

thanks @k-takata

this is great help for me learning how it should be.

quick question, are tabs normally viewed as 4 spaces or 8 spaces. I think that caused me some confusion too. Is it OK, if I change most of the tabs to actual spaces in this file os_win32.c? I think that will help prevent that sort of confusion in the future.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279847900@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 7:30:13 PM10/15/22
to vim/vim, Subscribed

@brammool

The .vscode directory seems like something common, that others would also run into. The vim90 directory seems to be specific for your tools, thus I would not include that.

Oh, hang on, I should explain why I did it. It wasn't simply arbitrary for my tools. It actually comes from me following the general instructions supplied in ./src/INSTALLpc.txt. See section 17.

  1. Installing after building from sources
    ==========================================
    ...
    Go to the directory that contains the Vim "src" and "runtime"
    directories and create a new subdirectory named "vim82".
    ...

I just updated the directory name from vim82 to vim90 in my script. I think it might be useful for others also. Is it OK?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279851485@github.com>

Yegappan Lakshmanan

unread,
Oct 15, 2022, 7:33:00 PM10/15/22
to vim...@googlegroups.com, reply+ACY5DGDKQWPMT4M25C...@reply.github.com, vim/vim, Subscribed
Hi,

On Sat, Oct 15, 2022 at 4:04 PM Christopher Plewright <vim-dev...@256bit.org> wrote:

thanks @k-takata

this is great help for me learning how it should be.

quick question, are tabs normally viewed as 4 spaces or 8 spaces. I think that caused me some confusion too. Is it OK, if I change most of the tabs to actual spaces in this file os_win32.c? I think that will help prevent that sort of confusion in the future.



The Vim source code uses a mix of spaces and tabs. The following settings are used:

   set softtabstop=4
   set shiftwidth=4
   set tabstop=8
   set noexpandtab

- Yegappan

vim-dev ML

unread,
Oct 15, 2022, 7:33:15 PM10/15/22
to vim/vim, vim-dev ML, Your activity

Hi,

On Sat, Oct 15, 2022 at 4:04 PM Christopher Plewright <
***@***.***> wrote:

> thanks @k-takata <https://github.com/k-takata>

>
> this is great help for me learning how it should be.
>
> quick question, are tabs normally viewed as 4 spaces or 8 spaces. I think
> that caused me some confusion too. Is it OK, if I change most of the tabs
> to actual spaces in this file os_win32.c? I think that will help prevent
> that sort of confusion in the future.
>
>
>
The Vim source code uses a mix of spaces and tabs. The following settings
are used:

set softtabstop=4
set shiftwidth=4
set tabstop=8
set noexpandtab

- Yegappan


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279851991@github.com>

Yegappan Lakshmanan

unread,
Oct 15, 2022, 7:38:06 PM10/15/22
to vim...@googlegroups.com, reply+ACY5DGDKQWPMT4M25C...@reply.github.com, vim/vim, Subscribed
A mix of space characters and tabs are used to minimize the number of
characters used
for indentation.

- Yegappan

vim-dev ML

unread,
Oct 15, 2022, 7:38:20 PM10/15/22
to vim/vim, vim-dev ML, Your activity

On Sat, Oct 15, 2022 at 4:32 PM Yegappan Lakshmanan ***@***.***> wrote:
>
> Hi,
>
> On Sat, Oct 15, 2022 at 4:04 PM Christopher Plewright ***@***.***> wrote:
>>
>> thanks @k-takata
>>
>> this is great help for me learning how it should be.
>>
>> quick question, are tabs normally viewed as 4 spaces or 8 spaces. I think that caused me some confusion too. Is it OK, if I change most of the tabs to actual spaces in this file os_win32.c? I think that will help prevent that sort of confusion in the future.
>>
>>
>
> The Vim source code uses a mix of spaces and tabs. The following settings are used:
>
> set softtabstop=4
> set shiftwidth=4
> set tabstop=8
> set noexpandtab
>

A mix of space characters and tabs are used to minimize the number of
characters used
for indentation.

- Yegappan


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/c1279852481@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 7:50:50 PM10/15/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341454339@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 8:21:19 PM10/15/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341554882@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 8:29:31 PM10/15/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

  • 60155b2 Merge branch 'vim:master' into master

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341580022@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 9:35:59 PM10/15/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

  • faf9bf8 added a couple of gitignore entries under the windows section

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11341804124@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 11:20:10 PM10/15/22
to vim/vim, vim-dev ML, Comment

I've had a look into writing some tests for this. But, I cant find any existing functioning test scripts to work with mouse handling in the windows terminal. There is some termcode testing, but for unix only, although that seems to come close to what would be useful here. Making it work on windows is a lot bigger than just adding the scroll feature, so can this testing be done in a separate issue apart from this pull request?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1279881727@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 11:23:36 PM10/15/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11342163364@github.com>

Christopher Plewright

unread,
Oct 15, 2022, 11:24:27 PM10/15/22
to vim/vim, vim-dev ML, Comment

@zewpo commented on this pull request.

ready for review again, I think.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/review/1143247301@github.com>

Christopher Plewright

unread,
Oct 16, 2022, 7:51:37 AM10/16/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

  • ca714ce Merge branch 'vim:master' into master

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11344030347@github.com>

Bram Moolenaar

unread,
Oct 16, 2022, 8:03:52 AM10/16/22
to vim/vim, vim-dev ML, Comment


About tabstop: We always use a tabstop of 8. If you use another value
you'll run into trouble.


> @brammool
>
> > The .vscode directory seems like something common, that others would
> > also run into. The vim90 directory seems to be specific for your
> > tools, thus I would not include that.
>
> Oh, hang on, I should explain why I did it. It wasn't simply
> arbitrary for my tools. It actually comes from me following the
> general instructions supplied in ./src/INSTALLpc.txt. See section
> 17.
>
> > 17. Installing after building from sources
> > ==========================================
> > ...
> > Go to the directory that contains the Vim "src" and "runtime"
> > directories and create a new subdirectory named "vim82".
> > ...
>
> I just updated the directory name from vim82 to vim90 in my script.
> I think it might be useful for others also. Is it OK?

Aha, OK then.

--
There is no right or wrong, there is only your personal opinion.
(Bram Moolenaar)


/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1279955567@github.com>

Bram Moolenaar

unread,
Oct 16, 2022, 8:03:56 AM10/16/22
to vim/vim, vim-dev ML, Comment


> I've had a look into writing some tests for this. But, I cant find
> any existing functioning test scripts to work with mouse handling in
> the windows terminal. There is some termcode testing, but for unix
> only, although that seems to come close to what would be useful here.
> Making it work on windows is a lot bigger than just adding the scroll
> feature, so can this testing be done in a separate issue apart from
> this pull request?

Yes, testing at this level isn't easy. We may have to add some way to
inject messages specifically for testing purposes. Like we have
test_gui_event(). It's best if someone who knows the innards of the
MS-Windows code gives this a start. I hope that, since most of this is
message based, we can inject some messags at a low level and test the
code that deals with the messages. We probably need to add some code to
create each specific message.

--
It is illegal for a driver to be blindfolded while operating a vehicle.
[real standing law in Alabama, United States of America]


/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1279955582@github.com>

Christopher Plewright

unread,
Oct 16, 2022, 8:58:07 AM10/16/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11344335541@github.com>

Christopher Plewright

unread,
Oct 16, 2022, 9:10:27 AM10/16/22
to vim/vim, vim-dev ML, Push

@zewpo pushed 1 commit.

  • 6d73d74 Merge branch 'vim:master' into master

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11374/push/11344396378@github.com>

Bram Moolenaar

unread,
Oct 16, 2022, 2:48:11 PM10/16/22
to vim/vim, vim-dev ML, Comment

Closed #11374 via 2a46f81.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/issue_event/7596779271@github.com>

Shane-XB-Qian

unread,
Oct 16, 2022, 10:38:08 PM10/16/22
to vim/vim, vim-dev ML, Comment

actually not sure how many people like me tried much ways to temp disable the mouse (or specific to 'touchpad' of laptop) scrolling when in vim (and auto enabled when focus left vim), which would interrupt or miss-typing when editing in vim, e.g sometimes your hand miss touch the touchpad.
but so far au focusgain/foucslost (and others ways) seems did not work perfectly.
alternatively if there is a direct vim option to auto disable touchpad scrolling in vim would be great. <---------------
// NOTE: it is specific to touchpad 'scrolling', since tap to click or corner button can be disable by tb setting itself, vs scrolling probably is needed when Not in vim.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280196230@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 4:05:25 AM10/17/22
to vim/vim, vim-dev ML, Comment

@Shane-XB-Qian

Just checking if I understand correctly - and how it relates to this particular PR.

Do you mean to suggest that it would be great if we added a new feature to allow disabling mouse wheel scrolling in non-win32 TUI consoles?

Or, do you see a potential problem occuring now on win32 TUI consoles being caused caused by this PR? Since win32 TUI consoles never previously had scrolling, and enabling it may cause new issues?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280450691@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 4:14:31 AM10/17/22
to vim/vim, vim-dev ML, Comment

> Do you mean to suggest that it would be great if we added a new feature to allow disabling mouse wheel scrolling in non-win32 TUI consoles?

yes, i thought quite users actually didnot like the mouse (supposed same as 'touchpad' of laptop) scrolling when in vim which easily miss-typing or miss-touch.
but it's not specific to win32 tui consoles, but all tui consoles. wish there was a 'option' to disable such 'scrolling'.
// if i did not miss-understand this pr.

--
shane.xb.qian


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280461818@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 4:23:16 AM10/17/22
to vim/vim, vim-dev ML, Comment

This pr only effects win32 tui consoles, it brings them inline with other tui consoles.

Disabling the mouse in vim is available already,
set mouse=
in your rc file,

For more info;
:help 'mouse'

Does that answer your question, and does it actually work for you?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280473198@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 4:26:33 AM10/17/22
to vim/vim, vim-dev ML, Comment

note: i mean just when in vim, that 'option' just to disable mouse/touchpad scrolling in vim, but not system/os level mouse/touchpad scrolling.
since when switched out of vim e.g by alt-tab and/or checking pages in firefox, then mouse/touchpad scrolling is needed.
// so far by some tricky setting e.g by au foucusgained/foucuslost can mock this, but the foucs event is system level of windows' manger, not always worked perfectly.
// manually set mouse= or something like that is not a good solution, since users had to switched it everytime.

i knew your/this pr is just for win32 tui consoles, but if you can adding an option to disable it (let user to choose) as well as others tui consoles would be great.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280478330@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 4:29:56 AM10/17/22
to vim/vim, vim-dev ML, Comment

setting the set mouse= is permanent when you do it in your vimrc file.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280482708@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 4:37:53 AM10/17/22
to vim/vim, vim-dev ML, Comment

set mouse= worked for pure xterm(372), but unfortunately not worked for e.g xfce-term.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280492708@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 4:44:33 AM10/17/22
to vim/vim, vim-dev ML, Comment

Thats interesting, I just expected it was meant to work everywhere. You may have found a bug - and it might be worth creating a new issue for it - let me know if you create one. I'm happy to test it out and provide some help if I can. I am just installing xfce-xterm now to have a look :) but also FYI, I'm very, very new to developing in VIm codebase. This PR was me just dipping my toes into it for the very first time, so there probably are others who are more knowledgable than I am.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280500820@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 4:50:44 AM10/17/22
to vim/vim, vim-dev ML, Comment

haha. that's ok, this just a wish, and probably was a knew issue.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280508504@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 5:04:02 AM10/17/22
to vim/vim, vim-dev ML, Comment

its cool @Shane-XB-Qian I think its interesting.

I just did some quick testing, and found strange behaviour in the following console applications; XTerm(374), the new Windows Terminal, and in Alacritty. When mouse=(blank) then the terminal scrolls back, which is probably not good.

But it works properly as I would hope on Kitty 0.26.3, xfce4-terminal 1.0.4 (Xfce 4.16), and in the old windows conhost.exe.

Its all a bit weird.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280525692@github.com>

zeertzjq

unread,
Oct 17, 2022, 5:07:07 AM10/17/22
to vim/vim, vim-dev ML, Comment

Alternatively you can map <ScrollWheelUp> and <ScrollWheelDown> to <Nop> while still enabling mouse.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280529983@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 5:10:52 AM10/17/22
to vim/vim, vim-dev ML, Comment

cool, if you can dig into it would be great.
xfce4-terminal 0.8.10 (Xfce 4.16)
terminator 2.1.1
// above two did not work.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280534932@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 5:24:27 AM10/17/22
to vim/vim, vim-dev ML, Comment

@zeertzjq

yes, that seems to solve it in all of my linux terminals.

doesnt seem to work in my windows terminals


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280553208@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 5:31:22 AM10/17/22
to vim/vim, vim-dev ML, Comment

@Shane-XB-Qian

I just checked @zeertzjq suggestion. It solves it for terminator on my system also. (terminator 2.1.1)

map <ScrollWheelUp> <Nop>
map <ScrollWheelDown> <Nop>


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280562807@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 5:33:57 AM10/17/22
to vim/vim, vim-dev ML, Comment

yes, i tried too, but that's tricky, and not only map, but also imap etc....


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280566213@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 5:36:22 AM10/17/22
to vim/vim, vim-dev ML, Comment

I think that map covers all the [X]map modes.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280570979@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 5:43:11 AM10/17/22
to vim/vim, vim-dev ML, Comment

nope, if only map (but no imap etc) it still can scroll in such mode (e.g insert mode).
// unless just set mouse=n


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280583130@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 5:46:57 AM10/17/22
to vim/vim, vim-dev ML, Comment

OK, I see now. probably want both map and map! to cover all modes, I think.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280587571@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 5:51:21 AM10/17/22
to vim/vim, vim-dev ML, Comment

for a workaround, looks 'yes', but issue still there anyway... :-)


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280592985@github.com>

Bram Moolenaar

unread,
Oct 17, 2022, 6:22:08 AM10/17/22
to vim/vim, vim-dev ML, Comment


> Alternatively you can map `<ScrollWheelUp>` and `<ScrollWheelDown>` to
> `<Nop>` while still enabling mouse.

That works better, because in many terminals, if you disable the mouse
in Vim, the events are used by the terminal and will scroll the buffer.

How about adding this to the help:

*mouse-scrolling-off*
If you do not want the mouse to cause scrolling (e.g. because resting your
palm on the touchpad causes scroll events), you can disable that with: >
:map <ScrollWheelDown> <Nop>
:map! <ScrollWheelDown> <Nop>
:map <ScrollWheelUp> <Nop>
:map! <ScrollWheelUp> <Nop>
:map <ScrollWheelLeft> <Nop>
:map! <ScrollWheelLeft> <Nop>
:map <ScrollWheelRight> <Nop>
:map! <ScrollWheelRight> <Nop>

--
Biting someone with your natural teeth is "simple assault," while biting
someone with your false teeth is "aggravated assault."
[real standing law in Louisana, United States of America]


/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280631673@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 6:37:33 AM10/17/22
to vim/vim, vim-dev ML, Comment

IF that's better (vs mouse=), then it's ok.
anyway, i thought this is a very common demand if you are using vim in a laptop which had a touchpad. :-)


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280650968@github.com>

Shane-XB-Qian

unread,
Oct 17, 2022, 7:07:02 AM10/17/22
to vim/vim, vim-dev ML, Comment

but if saying a wish, then actually wish mouse= can really disable mouse/touchpad in all tui consoles,
since actually not only scroll, but e.g click would interrupt typing (by miss touching the touchpad) when in vim also.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1280686281@github.com>

Christopher Plewright

unread,
Oct 17, 2022, 7:12:39 PM10/17/22
to vim/vim, vim-dev ML, Comment

@Shane-XB-Qian @brammool

Shane, thanks for sharing your wish, it has revealed an issue with my patch - it doesnt handle mappings of scrollwheel, but everywhere else, the mappings seems to work as expected.

@brammool
My patch uses gui CSI codes to implement the mouse scroll event in the windows console, and that worked for scrolling the various vim_windows, but, I now see that any "mappings" for gui CSI events aren't matched the same way in the windows console as they are in the gui. When the compilation includes the gui, the mappings arent found if the "gui.in_use" is false - and scrolling just scrolls regardless of the mapping.

But, it gets even worse, when the dll is not included in the compilation, my patch then causes MouseScroll events to send spurious codes into the windows console, that arent handled at all and it just looks like bizarred characters are being keyed into the console. So thats a bug that I introduced. I'm having a go at investigating why this is the case. The various combinations of gui/dll/terminal-only makes getchar behave differentlly in the different windows based version. There is some legacy issues there for me to wrap my head around - but thats OK because I have time to work it out.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1281614474@github.com>

Shane-XB-Qian

unread,
Oct 18, 2022, 6:36:41 AM10/18/22
to vim/vim, vim-dev ML, Comment

ok, but i felt such mappings (while mouse=nvi) in insert mode with popup compl memu is visible, still would kick off click and/or scroll events (which would interrupt compl), though i donot know how to privide MRE.
// so i wish/felt just to make mouse=(black) would be more correct way.
// but anyway, those should be not your pr made it, vs was existing issue.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1282180078@github.com>

Christopher Plewright

unread,
Oct 18, 2022, 7:41:02 PM10/18/22
to vim/vim, vim-dev ML, Comment

my feeling on that suggestion, @Shane-XB-Qian is that I would guess mouse=(blank) already has an expected behaviour. Because, I think it already means that mouse events are not swallowed by vim, and are instead left for the outer host console to decide what to do with them.
So, I imagine that we would want an explicit setting for vim to swallow all mouse events. But, as pointed out, we can already do all the mappings explicitly. That "should" work everywhere. To simplify this for users, perhaps vim could include a mouse-off vim script (that just has all the MouseScroll events mapped to ), and then that can simply be sourced with one line in your vimrc to call that if you want.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1283141837@github.com>

Shane-XB-Qian

unread,
Oct 18, 2022, 11:26:35 PM10/18/22
to vim/vim, vim-dev ML, Comment

after mouse=nvi and above such mappings, seems looks fine except when popup compl menu is visible.
// at least so far i only noticed such one case.

i cannot provide the MRE, but following log:
1, the first line is when popup compl menu is visible, see -- Keyword completion (^N^P) The only match
2, then use your single finger press the laptop touchpad move a little (to kick of scroll)
3, the last line is: such scroll interrupt compl, see -- INSERT --
// i donot know how to mock the case further, but somehow the click and/or scroll interrupt compl still.
// i tried xterm(372) and xfce-term same.

  8.937521 : raw terminal output: "�[36;8H�[97m�[48;5;242m pos1�[m�[1m�[32m�[40m �[m��[97m�[48;5;242m           �[m�[70;1H�[1m-- Keyword completion (^N^P) The only match�[35;13H�[m�[2;9H�[48;5;237m �[m   �[3;9H�[93m�[48;5;237ma�[m�[2C �[4;9H�[48;5;237m �[m   �[5;9H�[93m�[48;5;237mr�[m�[2C(�[6;9H�[95m�[48;5;237m"�[m�[2C�[95mf�[m�[7;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[8;9H�[95m�[48;5;237m"�[m�[2C�[95mn�[m�[9;9H�[95m�[48;5;237m"�[m�[2C�[95ma�[m�[10;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[11;9H�[95m�[48;5;237m"�[m�[2C�[95m"�[m�[12;9H�[95m�[48;5;237m"�[m�[2C�[95m/�[m�[13;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[14;9H�[95m�[48;5;237m"�[m�[2C�[95mg�[m�[15;9H�[95m�[48;5;237m"�[m�[2C�[95mn�[m�[16;9H�[95m�[48;5;237m"�[m�[2C�[95mr�[m�[17;9H�[95m�[48;5;237m"�[m�[2C�[95mr�[m�[18;9H�[95m�[48;5;237m"�[m�[2C�[95mn�[m�[19;9H�[95m�[48;5;237m"�[m�[2C�[95mm�[m�[20;9H�[48;5;237m �[m   �[21;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[22;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[23;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[24;9H�[95m�[48;5;237m"�[m�[2C�[95mt�[m�[25;9H�[48;5;237m �[m   �[26;9H�[48;5;237m �[m   �[27;9H�[93m�[48;5;237mt�[m�[2C�[38;5;224ma�[m�[28;9H�[48;5;237m �[m   �[29;9H�[93m�[48;5;237mt�[m�[2C�[38;5;224me�[m�[30;9H�[48;5;237m �[m   �[31;9H�[38;5;224m�[48;5;237mr�[m�[2C�[38;5;224mi�[m�[32;9H�[48;5;237m �[m   �[33;9H�[48;5;237m �[m�[2C�[38;5;121mt�[m�[34;9H�[48;5;237mn�[mame�[37;9H�[48;5;237ms�[mele�[38;9H�[48;5;237mi�[mnde�[39;9H�[48;5;237m �[m   �[40;9H�[48;5;237m �[m   �[41;9H�[38;5;225m�[48;5;237m(�[m   �[42;9H�[38;5;224m�[48;5;237mc�[m�[2C�[38;5;240m-�[m�[43;9H�[38;5;224m�[48;5;237mr�[m�[2C�[38;5;224mt�[m�[44;9H�[38;5;224m�[48;5;237mi�[m�[2C�[38;5;224mu�[m�[45;9H�[48;5;237mf�[mile�[46;9H�[38;5;224m�[48;5;237ms�[m�[2C�[38;5;224me�[m�[47;9H�[38;5;224m�[48;5;237mh�[m�[2C�[38;5;224md�[m�[48;9H�[48;5;237mc�[murr�[49;9H�[48;5;237mc�[murs�[50;9H�[48;5;237mo�[mffs�[51;9H�[48;5;237mw�[midt�[52;9H�[48;5;237mm�[mute�[53;9H�[38;5;224m�[48;5;237md�[m�[2C�[38;5;224mt�[m�[54;9H�[38;5;224m�[48;5;237md�[m�[2C�[38;5;224ma"
  8.939039 : setting timeout timer to 2 sec 0 nsec
  8.944189 : setting timeout timer to 2 sec 0 nsec
  8.944727 : setting timeout timer to 0 sec 60000000 nsec
  8.946067 : raw terminal output: "�[m�[55;9H�[48;5;237mt�[mime�[56;9H�[38;5;224m�[48;5;237ms�[m�[2C�[38;5;224mn�[m�[57;9H�[48;5;237mi�[mgno�[58;9H�[48;5;237mf�[muzz�[59;9H�[48;5;237md�[mirO�[60;9H�[48;5;237mc�[murO�[61;9H�[48;5;237mm�[mruH�[62;9H�[48;5;237m �[m   �[63;9H�[48;5;237m �[m   �[64;9H�[93m�[48;5;237mt�[m�[2C �[65;9H�[38;5;224m�[48;5;237mm�[m�[2C�[38;5;224mM�[m�[66;9H�[38;5;224m�[48;5;237mm�[m�[2C�[38;5;224mS�[m�[67;9H�[38;5;224m�[48;5;237mm�[m�[2C�[38;5;224mT�[m�[69;94H�[1m�[97m�[41m[+] �[m�[30m�[42m [-][sy:ss:?] [Git(master)] [lsp:Y(r):A(t)]�[77C5-v2][0x70�[m�[36;8H�[1m�[32m�[40m pos1           �[35;13H�[?25h"
  8.946073 : looking for messages on channels
 10.071636 : raw key input: "�[<35;154;60M"
 10.078325 : raw key input: "�[<35;154;60M"
 10.079104 : setting timeout timer to 2 sec 0 nsec
 10.083328 : raw terminal output: "�[?25l�[m�[70;1H                                            
�[1m-- INSERT --�[m�[69;218H�[30m�[42m9-v6][0x2�[m�[2;9H    �[48;5;237m �[m�[3;9H�[93ma�[m�[3C�[48;5;237mm�[m�[4;9H    �[48;5;237m �[m�[5;9H�[93mr�[m�[3C�[48;5;237m �[m�[6;9H�[95m"�[m�[3C�[95m�[48;5;237mi�[m�[7;9H�[95m"�[m�[3C�[95m�[48;5;237me�[m�[8;9H�[95m"�[m�[3C�[95m�[48;5;237mt�[m�[9;9H�[95m"�[m�[3C�[95m�[48;5;237mg�[m�[10;9H�[95m"�[m�[3C�[95m�[48;5;237m"�[m�[11;9H�[95m"�[m�[3C�[48;5;237m �[m�[12;9H�[95m"�[m�[3C�[95m�[48;5;237me�[m�[13;9H�[95m"�[m�[3C�[95m�[48;5;237mh�[m�[14;9H�[95m"�[m�[3C�[95m�[48;5;237me�[m�[15;9H�[95m"�[m�[3C�[95m�[48;5;237mt�[m�[16;9H�[95m"�[m�[3C�[95m�[48;5;237mt�[m�[17;9H�[95m"�[m�[3C�[95m�[48;5;237mi�[m�[18;9H�[95m"�[m�[3C�[95m�[48;5;237mc�[m�[19;9H�[95m"�[m�[3C�[95m�[48;5;237me�[m�[20;9H    �[48;5;237m �[m�[21;9H�[95m"�[m�[3C�[95m�[48;5;237mh�[m�[22;9H�[95m"�[m�[3C�[95m�[48;5;237mh�[m�[23;9H�[95m"�[m�[3C�[95m�[48;5;237mh�[m�[24;9H�[95m"�[m�[3C�[95m�[48;5;237mh�[m�[25;9H    �[48;5;237m �[m�[26;9H    �[48;5;237m �[m�[27;9H�[93mt�[m�[3C�[38;5;224m�[48;5;237mm�[m�[28;9H    �[48;5;237m �[m�[29;9H�[93mt�[m�[3C�[38;5;224m�[48;5;237mr�[m�[30;9H    �[48;5;237m �[m�[31;9H�[38;5;224mr�[m�[3C�[38;5;224m�[48;5;237ms�[m�[32;9H    �[48;5;237m �[m�[33;9H �[3C�[38;5;121m�[48;5;237mc�[m�[34;9Hname�[38;5;240m�[48;5;237m-�[m�[36;8H�[38;5;240m-�[mpos2�[38;5;240m�[48;5;237m-�[m�[38;5;240m--+-�[m�[38;5;121mint�[m   �[37;9Hsele�[48;5;237mc�[m�[38;9Hinde�[48;5;237mx�[m�[39;9H    �[48;5;237m �[m�[40;9H    �[48;5;237m �[m�[41;9H�[38;5;225m(�[m   �[48;5;237m �[m�[42;9H�[38;5;224mc�[m�[3C�[38;5;240m�[48;5;237m-�[m�[43;9H�[38;5;224mr�[m�[3C�[38;5;240m�[48;5;237m-�[m�[44;9H�[38;5;224mi�[m�[3C�[38;5;224m�[48;5;237mt�[m�[45;9Hfile�[48;5;237ms�[m�[46;9H�[38;5;224ms�[m�[3C�[38;5;224m�[48;5;237mc�[m�[47;9H�[38;5;224mh�[m�[3C�[38;5;224m�[48;5;237mi�[m�[48;9Hcurr�[48;5;237me�[m�[49;9Hcurs�[48;5;237mo�[m�[50;9Hoffs�[48;5;237me�[m�[51;9Hwidt�[48;5;237mh�[m�[52;9Hmute�[48;5;237mx�[m�[53;9H"


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1283365500@github.com>

Silver Zachara

unread,
Oct 24, 2022, 11:54:25 AM10/24/22
to vim/vim, vim-dev ML, Comment

@zewpo I want to ask, vertical scrolling works just fine, but what about horizontal scrolling? If I correctly remember, the Windows terminal API also correctly reports events for horizontal scrolling and the PR you have created already somehow processes also horizontal scrolling in the decode_mouse_wheel() function.

But it doesn't work, I have a mouse with a horizontal wheel and we can enable word wrapping using set wrap / set nowrap vim commands.

Would be possible to fix the horizontal scrolling? If yes, it could be also mapped to the ALT+mouse up/down.

Current behavior:

  • ctrl+mouse up/down - is scrolling by page
  • shift+mouse up/down - is scrolling terminal screen buffer instead of vim screen buffer
  • alt+mouse up/down - does nothing, so it's free to use?


Reply to this email directly, view it on GitHub.
You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1289245519@github.com>

Christopher Plewright

unread,
Oct 24, 2022, 12:45:55 PM10/24/22
to vim/vim, vim-dev ML, Comment

@silverqx
Horizontal scrolling works fine in the old command prompt console. But, the new windows terminal console doesnt seem to pass through the horizontal events, as far as I can tell. I wrote a basic c program to simply catch input events, and print them to the screen - to try and test it out, it didnt work for horizontal mouse scroll events. See attached, let me know if you can test it on your windows terminal.
events.c.zip

With regards to mapping, I didnt get any mapping to be recognised if they included a modifier in them, so still some work to do on that end also. Vim recognises ctrl-scroll - as you mentioned, but if you try and create a custom mapping in your vim settings to map <ctrl-?scroll?> to do something else, it doesnt seem to work, and it just keeps scrolling.

basic mapping is working but not with modifier key <modifier-?scroll?>, so its incomplete there.

I think your shift+scroll is working because windows terminal has a keybinding to do that, rather than viming doing anything with it.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1289310725@github.com>

Silver Zachara

unread,
Oct 24, 2022, 1:15:03 PM10/24/22
to vim/vim, vim-dev ML, Comment

You are right, wterm doesn't handle horizontal scrolling correctly, I have tried your event.c (amazing 😁 test code).

The alt+mouse up/down was only a fast idea, it doesn't matter much.

cmd console correctly reports horizontal events using your event.c, but doesn't work for me in vim using the horizontal mouse scroll wheel, I have also tried to disable the Quick edit mode, I don't know why it doesn't work. It can also interfere with another cmd setting.

Anyway if it doesn't work in the wterm it doesn't matter much, because who will use cmd these days when we have wterm 😁, vertical scrolling is enough, horizontal is not so important.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1289344867@github.com>

Christopher Plewright

unread,
Oct 24, 2022, 6:58:02 PM10/24/22
to vim/vim, vim-dev ML, Comment

@silverqx hah, its a bit wierd.

Thanks again for the feedback. So, it turns out that the horizontal mouse scrolling only works in any console when VIm is compiled with GUI=yes flag configured.

Just checking if its a MS Windows only "feature", but its not. Same thing happens on linux. This behavior comes from the generic mouse.c code. So, even on linux, when Vim version says something like; "...version without GUI...", then horizontal mouse scroll doesnt work. And then, when for "...version with ... GUI", horizontal scrolling works in the console as well as the gui.

So, we can make it work without the gui, with some refactoring of the mouse and gui_ code. If I do that, it will impact more than just MS Windows. So, just being super careful at the moment, dipping my toes in as carefully as I can, since I'm a noob as a vim contributor.


Reply to this email directly, view it on GitHub.
You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1289735416@github.com>

Shane-XB-Qian

unread,
Oct 24, 2022, 10:23:37 PM10/24/22
to vim/vim, vim-dev ML, Comment

perhaps you mean <MouseMove> (and mousemoveevent), that always is false if vim in tui terminal.
// but if it can work at tui (and at linux) also, then maybe was a fully workaround.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1289889433@github.com>

Silver Zachara

unread,
Oct 25, 2022, 6:03:30 AM10/25/22
to vim/vim, vim-dev ML, Comment

Guys, you are right, horizontal scrolling works fine in the gvim but doesn't in vim.

So, we can make it work without the gui, with some refactoring of the mouse and gui_ code

If you feel you are able to fix it then I totally agree, I'm personally using horizontal scrolling all time, somebody maybe doesn't, but I'm using it.

If I do that, it will impact more than just MS Windows

That is a good thing, isn't it? 😁 I can help you test it, if you decide to issue PR.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1290299256@github.com>

Christopher Plewright

unread,
Oct 25, 2022, 6:56:30 AM10/25/22
to vim/vim, vim-dev ML, Comment

@silverqx To clarify, I dont mean just in gVim. it works also in vim as well, as long as vim was compiled with the correct flags, its a fortunate side-effect of sharing some code between vim and gvim, when they are both compiled together, it just starts to work.


Reply to this email directly, view it on GitHub.
You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1290358023@github.com>

Silver Zachara

unread,
Oct 25, 2022, 6:58:01 AM10/25/22
to vim/vim, vim-dev ML, Comment

I understand, thx


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1290359548@github.com>

Shane-XB-Qian

unread,
Oct 25, 2022, 7:09:21 AM10/25/22
to vim/vim, vim-dev ML, Comment

> I dont mean just in gVim. it works also in vim as well, as long as vim was compiled with the correct flags

seems req some trick to make `./configure --enable-gui` work in tui vim, or if it really worked?

anyway, i recall `mousemoveevent` aka `<MouseMove>` feature was added just some months ago,
// or i may miss-understood..
maybe you can contact & discuss with that author a bit...

--
shane.xb.qian


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1290371134@github.com>

Christopher Plewright

unread,
Oct 25, 2022, 7:24:35 AM10/25/22
to vim/vim, vim-dev ML, Comment

This was all about Where XXX is Up | Down | Left | Right
I dont think it is related to
I dont know what that is, tbh, perhaps useful for hover popups?


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1290395038@github.com>

Shane-XB-Qian

unread,
Oct 25, 2022, 7:33:12 AM10/25/22
to vim/vim, vim-dev ML, Comment

well, i never use gvim, so as the doc told me that detected mouse move event and got mouse position.
// i meant to me tui vim can do something upon that, though just a workaround still.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1290405292@github.com>

Christopher Plewright

unread,
Oct 26, 2022, 9:09:32 PM10/26/22
to vim/vim, vim-dev ML, Comment

@silverqx @Shane-XB-Qian

OK, I created separate branch for this mouse stuff. havent committed the changes yet, but want somehere to work with this.

#11448


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/11374/c1292837398@github.com>

Reply all
Reply to author
Forward
0 new messages