This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients cheryl.sabella, terry.reedy
Date 2018-05-28.00:46:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527468406.58.0.682650639539.issue33664@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-28 00:46:46terry.reedysetrecipients: + terry.reedy, cheryl.sabella
2018-05-28 00:46:46terry.reedysetmessageid: <1527468406.58.0.682650639539.issue33664@psf.upfronthosting.co.za>
2018-05-28 00:46:46terry.reedylinkissue33664 messages
2018-05-28 00:46:44terry.reedycreate