Avoid scrolling entry to cursor position in unwanted situations #6044
+50
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
As currently coded, the
Entrywidget callsentryContentRenderer.moveCursor()every timeentryContentRenderer.Refresh()is invoked. In turn,moveCursor()always callsensureCursorVisible(). In other words, whenever the entry content renderer refreshes, the contents of the entry are automatically scrolled to put the current cursor position on screen. This may cause a multiline entry to scroll back to the cursor position even when this is not warranted -- as demonstrated in #6042, unfocusing or focusing an entry may lead to unexpected scroll jumps.I have changed the code of the
moveCursorfunction so that it only callsensureCursorVisiblewhen necessary instead of every time (my superficial understanding is that themoveCursorfunction should probably be renamed torefreshCursoror something like that based on how it is used elsewhere). Here "when necessary" is defined "whenever a piece of code (potentially) changesentry.CursorRoworentry.CursorColumn.Fixes #6042 .
Checklist: