New submission from Terry J. Reedy <tjre...@udel.edu>: 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 #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 #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 ("text.index("@0,0").split('.')[0]") and the desired top line ("round(fraction * text.index('end').split('.')[0]"). Experiments should show if we need to adjust the rounded value 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. ---------- assignee: terry.reedy components: IDLE messages: 317819 nosy: cheryl.sabella, terry.reedy priority: normal severity: normal stage: test needed status: open title: IDLE: scroll text by lines, not pixels. type: behavior versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33664> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com