add Special option to Adv. Editor for Overscrolling Last Line to Top#2946
Closed
octaeder wants to merge 5 commits intotexstudio-org:masterfrom
Closed
add Special option to Adv. Editor for Overscrolling Last Line to Top#2946octaeder wants to merge 5 commits intotexstudio-org:masterfrom
octaeder wants to merge 5 commits intotexstudio-org:masterfrom
Conversation
then we can add a new option below Vertical Overscroll
optimize verticalScrollBar settings
Member
|
Looking at the code, it is not worth to have an extra option for "overscrolling to the top" |
Contributor
Author
|
new PR follows |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR closes #2944 by adding a new Option to Adv. Editor Config. This option allows the editor to scroll down over the last line until the line reaches the top of the editor. Please check the option text and the tooltip.
Please make CHANGELOG.html
Description of Commits
reorder some Special options as depicted in following image (row numbers to the left):
The final result to the right shows 3 options concerned with parentheses/brackets, two with scrolling and the rest with mouse actions (including option Triple-Click Selection below lower edge of the image). Not visible options to the right are not touched.
Since the new option should be in row 6 rows 3 to 6 are renumbered from 2 to 5.
Add new option and optimize vertical scrollbar settings (discussed below):
The new option is not set by default. This together with the usage of two checkboxes ensures that the old setting can be reproduced exactly as it was. Option Vertical Overscroll shows following tooltip:

Be aware that the two options concerning monitoring of open files use two related checkboxes in a similar way as it is here.
Enhancing Vertical Scroll Bar Settings
The old formulae used have two drawbacks: 1. Page scrolling may omit rows and 2. Scrolling doesn't exactly stop in the middle of the editor.
Page scrolling may omit rows
Old formula
setPageStep(qCeil(1.* viewportSize.height() / ls))applies qCeil to the number of lines visible in the editor. This number is not an integer when the lower edge of the editor covers some fraction of a line. Thus this line is part of the pageStep and the line after it will be the line presented at the top after scrolling one page.Example. In this case the editor shows almost nothing of line 14:
Now scroll down one page with the old formula:
No one (except me) can tell what is written in line 14. And this will happen every time scrolling down one page. The new formula
setPageStep(qFloor(viewportSize.height() / ls + 0.3))guarantees that the covered line will be presented again at top after scrolling as long as more than 30% of the line are covered by the edge:Now we know the contents of line 14. The following image shows the exact limit when line 14 will not be presented again at top:
Scrolling doesn't exactly stop in the middle of the editor
In this case (the dashed line divides the editor into equal parts)
overscrolling should show the last 7 lines. This is not the case when using the old formula
but with the new one:
When the number of visible lines is odd then there is one line in the middle of the editor. So overscrolling should show the last line at this place. But with the old formula this place is empty, but not with the new one. I leave it to the reader to check this.