-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
IDLE: scroll text by lines, not pixels. #77845
Comments
When tk and hence, IDLE, opens a text window, it contains an integral number of lines of text in the base font. Clicking a vertical scrollbar arrow button moves text up or down exactly one line. Clicking in the trough between the buttons and and the slider moves text up or down one 'page', a page being the number of lines in the window -2. The text and window can be de-synchronized with the slider and mouse wheel. (If the window size is changes to a non-integral number of lines, 'synchronized' means a complete line at the top.) By default, the wheel moves text about 3 lines per 'click'. Apparently, it is exactly 50 pixels at a time. This is discussed on bpo-25015. For that issue, the focus was on '3' (or 50) being too small. This issue is about changing 'about' to 'exactly', so that synchronized text remains so when using the wheel or slider. For both, the solution should be to use Text.xview_scroll(n, units). For the wheel, we can replace the default tk wheel handler. While we are at it, we could make the wheel effect be +- 5 lines, which would solve bpo-25015, which I will close. I don't think a configuration setting is needed. For the slider, we can replace xview as the scrollbar command with a function that maps command('moveto', fraction) to xview_scroll(n, 'units'). The number n should be the difference between the current top line We should not need to adjust for the fact that the last <window-size> lines of text cannot become top lines. A request to scroll 'too far' goes as far as possible without raising an exception. |
I checked that with the patch, the wwindow top stayed synchronized with the text after multiple movement operations of different types. The minimum requirement for correct operation of the scrollbar slider is that moving the slider to the top and bottom of its trough moves the text to the top and bottom of the file. Before merging, I checked with editor.py, about 3000 lines, and a new editor with just a couple more lines than the window size. It is desireable that each pixel movement of the slider move the text. This requires that there be at least as many hidden lines in the text as there are exposed pixel in the slider trough. I don't know that this will always be true on all systems. As near as I could tell with editor.py, which meets this requirement, moving the slider a pixel away from top or bottom also moved the text. (I can't move a single pixel, so it was more a matter that moving 2 or 3 pixels made 2 or 3 jumps ;-) I considered these tests enough for now to merge. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: