Win multilinetext scroll to bottom#4276
Conversation
|
The test failed on (windows-latest, 3.12) due to "Unable to download artifact(s)". I don't think it is related to the changes of the code. |
freakboy3742
left a comment
There was a problem hiding this comment.
Thanks for the PR - this looks great as an implementation.
I've flagged one minor problem inline; the other issue is the lack of a test. We need to have a test for this behavior to make sure it doesn't reoccur.
The testbed folder already contains a test that exercises scroll_to_bottom(); as part of this change, we need to add an extra piece to that test so that the call to scroll_to_bottom() is done twice in a row, confirming that the scroll position doesn't change between the two calls. This test should fail on the current main code; but will pass with your change applied.
The testbed suite is currently failing on Linux machines - that's unrelated to your changes. GitHub has changed something recently; we're still trying to work out what that is.
| ): # pragma: nocover | ||
| parent.OnMouseWheel(e) | ||
| e.Handled = True | ||
| e.Handled = True |
There was a problem hiding this comment.
This line is a duplicate.
| e.Handled = True |
|
FYI: I've just resolved the issue with Linux testing, and re-run the tests that were failing. |
|
I found out that the current test case in the testbed will not fail with consecutive |
That's what the calls to |
|
I have added an additional test case for the |
freakboy3742
left a comment
There was a problem hiding this comment.
Thanks for the test update! I've pushed a couple of minor tweaks, but otherwise, this looks great - thanks for the PR!
changes/3872.bugfix.md
Outdated
| @@ -0,0 +1 @@ | |||
| `scroll_to_bottom()` now behave correctly and consistently for MultilineTextInput in Windows, and new test case is added. | |||
There was a problem hiding this comment.
The change note should be a user-facing description of the feature/bugfix, not a description of the code change:
| `scroll_to_bottom()` now behave correctly and consistently for MultilineTextInput in Windows, and new test case is added. | |
| Calling `scroll_to_bottom()` on a `MultilineTextInput` that is already at the bottom of the scroll area no longer causes a "bounce" in the scroll position. |
| # Invoke the scroll_to_bottom again while the vertical scroll position of the | ||
| # document stay at the bottom. This is to make sure repeated call of | ||
| # scroll_to_bottom method would not make the vertical scroll position change up and | ||
| # down. |
There was a problem hiding this comment.
If there's a specific bug involved, it can be helpful to reference that bug.
| # scroll_to_bottom method would not make the vertical scroll position change up and | ||
| # down. | ||
| widget.scroll_to_bottom() | ||
| assert probe.vertical_scroll_position == first_vertical_scroll_pos |
There was a problem hiding this comment.
It's worth adding a "wait for scroll position" here to make sure any scroll that does occur actually completes:
| assert probe.vertical_scroll_position == first_vertical_scroll_pos | |
| await probe.wait_for_scroll_position() | |
| assert probe.vertical_scroll_position == first_vertical_scroll_pos |
Implemented a workaround using the underlying Win32 SendMessage method. Currently, the
scroll_to_bottom()method in the MultilineTextInput sends the explicit low-level message to scroll, rather than ScrollToCaret, based on the solution suggested here.The scroll_to_bottom will no longer jump up and down in MultilineTextInput running on Windows; it will consistently move to the bottom of the widget.
Fixes #3872
PR Checklist: