Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(terminal): correctly forward mouse events #16373

Merged
merged 1 commit into from Dec 28, 2021

Conversation

zeertzjq
Copy link
Member

Fix #16371.

@github-actions github-actions bot added the terminal built-in :terminal or :shell label Nov 20, 2021
@zeertzjq zeertzjq force-pushed the terminal-mouse-release-forward branch 2 times, most recently from ffd0054 to 796a864 Compare November 20, 2021 09:49
@zeertzjq zeertzjq marked this pull request as ready for review November 20, 2021 09:50
@zeertzjq
Copy link
Member Author

zeertzjq commented Nov 20, 2021

Tests fail if I revert the change:

[  FAILED  ] 2 tests, listed below:
[  FAILED  ] test/functional/terminal/mouse_spec.lua @ 63: :terminal mouse when the terminal has focus with mouse events enabled by the program will forward mouse press, drag and release to the program
test/functional/terminal/mouse_spec.lua:96: Row 6 did not match.
Expected:
  |line27                                            |
  |line28                                            |
  |line29                                            |
  |line30                                            |
  |mouse enabled                                     |
  |*         #$#{1: }                                     |
  |{3:-- TERMINAL --}                                    |
Actual:
  |line27                                            |
  |line28                                            |
  |line29                                            |
  |line30                                            |
  |mouse enabled                                     |
  |*      @$#{1: }                                        |
  |{3:-- TERMINAL --}                                    |

To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.  

stack traceback:
	test/functional/ui/screen.lua:595: in function '_wait'
	test/functional/ui/screen.lua:362: in function 'expect'
	test/functional/terminal/mouse_spec.lua:96: in function <test/functional/terminal/mouse_spec.lua:63>

[  FAILED  ] test/functional/terminal/mouse_spec.lua @ 121: :terminal mouse when the terminal has focus with mouse events enabled by the program dragging and scrolling do not interfere with each other
test/functional/terminal/mouse_spec.lua:134: Row 6 did not match.
Expected:
  |line27                                            |
  |line28                                            |
  |line29                                            |
  |line30                                            |
  |mouse enabled                                     |
  |*   `"#{1: }                                           |
  |{3:-- TERMINAL --}                                    |
Actual:
  |line27                                            |
  |line28                                            |
  |line29                                            |
  |line30                                            |
  |mouse enabled                                     |
  |*      `"#{1: }                                        |
  |{3:-- TERMINAL --}                                    |

To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.  

stack traceback:
	test/functional/ui/screen.lua:595: in function '_wait'
	test/functional/ui/screen.lua:362: in function 'expect'
	test/functional/terminal/mouse_spec.lua:134: in function <test/functional/terminal/mouse_spec.lua:121>


 2 FAILED TESTS

@zeertzjq zeertzjq force-pushed the terminal-mouse-release-forward branch 2 times, most recently from cc575e6 to 95e928b Compare November 20, 2021 11:21
Copy link
Contributor

@erw7 erw7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked terminal.c of vim and found the same process, so I think this change is fine.

@zeertzjq zeertzjq added this to the 0.7 milestone Dec 20, 2021
@bfredl
Copy link
Member

bfredl commented Dec 26, 2021

@zeertzjq LGTM, rebase?

@zeertzjq zeertzjq force-pushed the terminal-mouse-release-forward branch 2 times, most recently from 1d0f4c7 to 0d44448 Compare December 26, 2021 21:29
@zeertzjq
Copy link
Member Author

Hmm, CI seems to be encountering some Internet problems.

@zeertzjq zeertzjq force-pushed the terminal-mouse-release-forward branch 2 times, most recently from 56bc518 to 9439928 Compare December 26, 2021 21:59
@zeertzjq zeertzjq force-pushed the terminal-mouse-release-forward branch from 9439928 to e0956f7 Compare December 26, 2021 22:08
@zeertzjq
Copy link
Member Author

Oh, CI passed.

@Kavantix
Copy link

Would be nice to have a build with this fix 😇

@zeertzjq
Copy link
Member Author

ping @bfredl

@bfredl bfredl merged commit c46f7ca into neovim:master Dec 28, 2021
@bfredl
Copy link
Member

bfredl commented Dec 28, 2021

Thanks!

@zeertzjq zeertzjq deleted the terminal-mouse-release-forward branch December 28, 2021 22:48
@zeertzjq zeertzjq modified the milestones: 0.8, 0.7 Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
terminal built-in :terminal or :shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No mouse release events in terminal mode
4 participants