Re: [vim/vim] Support left/right mouse wheel in terminal emulators (#6363)

8 views
Skip to first unread message

Trygve Aaberge

unread,
Jun 30, 2020, 3:33:30 PM6/30/20
to vim/vim, Subscribed

@trygveaa commented on this pull request.


In src/testdir/test_termcodes.vim:

> @@ -220,10 +221,23 @@ func Test_1xterm_mouse_wheel()
     call MouseWheelUp(1, 1)
     call assert_equal(1, line('w0'), msg)
     call assert_equal([0, 7, 1, 0], getpos('.'), msg)
+
+    call MouseWheelRight(1, 1)

I wanted to test the window column position too here, like the asserts above for mouse wheel up/down, but I didn't find any function to report the current window column position. Is there any?


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

Yegappan Lakshmanan

unread,
Jun 30, 2020, 4:02:10 PM6/30/20
to vim_dev, reply+ACY5DGBYJ7MCLONKLD...@reply.github.com, vim/vim, Subscribed
Hi,

On Tue, Jun 30, 2020 at 12:33 PM Trygve Aaberge <vim-dev...@256bit.org> wrote:

@trygveaa commented on this pull request.


In src/testdir/test_termcodes.vim:

> @@ -220,10 +221,23 @@ func Test_1xterm_mouse_wheel()
     call MouseWheelUp(1, 1)
     call assert_equal(1, line('w0'), msg)
     call assert_equal([0, 7, 1, 0], getpos('.'), msg)
+
+    call MouseWheelRight(1, 1)

I wanted to test the window column position too here, like the asserts above for mouse wheel up/down, but I didn't find any function to report the current window column position. Is there any?



Depending on what you are checking for, you can use one of the following functions:
col(), virtcol(), getpos(), getcurpos(), getmousepos(), screencol(), screenpos() and wincol()

- Yegappan

Trygve Aaberge

unread,
Jun 30, 2020, 6:31:21 PM6/30/20
to vim/vim, vim-dev ML, Comment

Hm, I see that the tests I added are failing on freebsd and mac, while they are passing on linux. Do you have any tips on debugging this? (I don't have freebsd or mac available)


You are receiving this because you commented.

Trygve Aaberge

unread,
Jun 30, 2020, 7:16:09 PM6/30/20
to vim/vim, vim-dev ML, Push

@trygveaa pushed 2 commits.

  • ff5c14a Fix support for right mouse wheel in non-SGR protocols
  • 35b3205 Support left/right mouse wheel in :terminal


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

View it on GitHub or unsubscribe.

Trygve Aaberge

unread,
Jun 30, 2020, 7:16:18 PM6/30/20
to vim/vim, vim-dev ML, Comment

Depending on what you are checking for, you can use one of the following functions: col(), virtcol(), getpos(), getcurpos(), getmousepos(), screencol(), screenpos() and wincol() - Yegappan

Ah, I found this post which said to use 1 + virtcol(".") - wincol(). That seems to work. I've added the asserts to the test.

vim-dev ML

unread,
Jun 30, 2020, 7:35:16 PM6/30/20
to vim/vim, vim-dev ML, Your activity

Hi,

On Tue, Jun 30, 2020 at 12:33 PM Trygve Aaberge <vim-dev...@256bit.org>
wrote:

> *@trygveaa* commented on this pull request.
> ------------------------------
>
> In src/testdir/test_termcodes.vim
> <https://github.com/vim/vim/pull/6363#discussion_r447930251>:

>
> > @@ -220,10 +221,23 @@ func Test_1xterm_mouse_wheel()
> call MouseWheelUp(1, 1)
> call assert_equal(1, line('w0'), msg)
> call assert_equal([0, 7, 1, 0], getpos('.'), msg)
> +
> + call MouseWheelRight(1, 1)
>
> I wanted to test the window column position too here, like the asserts
> above for mouse wheel up/down, but I didn't find any function to report the
> current window column position. Is there any?
>
>
>
Depending on what you are checking for, you can use one of the following
functions:
col(), virtcol(), getpos(), getcurpos(), getmousepos(), screencol(),
screenpos() and wincol()

- Yegappan


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

Trygve Aaberge

unread,
Jun 30, 2020, 7:51:34 PM6/30/20
to vim/vim, vim-dev ML, Push

@trygveaa pushed 3 commits.

  • d45885d Support left/right mouse wheel when running in a terminal
  • 1a207bb Fix support for right mouse wheel in non-SGR protocols
  • 336de4a Support left/right mouse wheel in :terminal


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

Trygve Aaberge

unread,
Jun 30, 2020, 8:13:34 PM6/30/20
to vim/vim, Subscribed

This adds support for left/right mouse wheel when running in a terminal emulator, for terminal emulators that supports it (e.g. xterm and urxvt).

The support is the same as in gvim, i.e.:

  • When nowrap is set, they will scroll the window sideways.
  • They can be mapped with <ScrollWheelLeft> and <ScrollWheelRight>.

Additionally, they are now supported as mouse events in :terminal, when an application running in it enables mouse.


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

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

Commit Summary

  • Keep mouse release state in a separate variable
  • Support left/right mouse wheel when running in a terminal
  • Fix support for right mouse wheel in non-SGR protocols
  • Support left/right mouse wheel in :terminal

    File Changes

    Patch Links:


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

    Trygve Aaberge

    unread,
    Jun 30, 2020, 8:24:45 PM6/30/20
    to vim/vim, vim-dev ML, Comment

    Hm, I see that the tests I added are failing on freebsd and mac, while they are passing on linux. Do you have any tips on debugging this? (I don't have freebsd or mac available)

    This is fixed now. It turns out that horizontal scrolling is done by the gui feature, even when running in a terminal emulator, and it seems that is disabled in the freebsd and mac tests. So I changed the new tests to only run when gui is enabled.

    A further improvement could be to implement horizontal scrolling when the gui feature is disabled.

    The two remaining failing builds (huge/gcc-s390x and huge-testgui+coverage/gcc) didn't seem to run properly. I don't think it's related to the changes in this PR.


    You are receiving this because you commented.

    Bram Moolenaar

    unread,
    Jul 1, 2020, 9:50:02 AM7/1/20
    to vim/vim, vim-dev ML, Comment

    Closed #6363 via d58d4f9.


    You are receiving this because you commented.

    Reply all
    Reply to author
    Forward
    0 new messages