gh-42010: IDLE Editor Bottom Scroll Bar by csabella · Pull Request #1984 · python/cpython (original) (raw)

Cheryl, I tested the patch and initially it seemed fine. Then I encountered the continued flashing that I presume you referred to, and discovered how to reproduce it, and figure out why, I think, but not how to stop it.

@taleinat We are trying to add the as-needed horizontal scrollbar used in the font sample to editor and output windows. When scrolling with the text height fixed, (the initial default), there are tolerable single 'flashes' when the bar is shown or hidden, like seen when context lines are added or deleted. When scrolling with the window height fixed, as when zoomed or after resizing, a minor glitch can happen when the bottom line is the only long line but is mostly covered up by the scrollbar, so that there is nothing visible to scroll. I will come back to how to reproduce this.

In either mode, a long line only at the bottom can cause the bbar to appear and disappear in a loop. To reproduce on my machine with this patch applied, using SourceCodePro size12 font, open configdialog.py. In fixed text mode, scroll down until blank line 252 is the bottom visible line. Move down 1 more with vbar bottom arrow. Long line 253 and hbar appear (with a flash). Move back up with top vbar arrow. Hbar flashes until one scrolls again.

Switch to fixed window mode by slightly increasing its height. Make non-blank line 251 the bottom visible line. A slice of blank line 252 is also displayed but with a small enough window height increase, none of line number 252 will be. Move down with vbar arrow, exposing blank line 252 and bit of long line 253, which will be covered by the hbar. Since none of 253 is visible, the hbar is not needed, so it is removed, exposing a slice of 253, making it needed again. and so on. (I presume something like this happens in the fixed text case when going down and up, even though the text window should be exactly n lines. Only the top (and blank) 1 pixel slice of the long line would be need to be exposed and covered.)

Now make 251 the maximum line number exposed and put the cursor there or above. Move the cursor down with the down arrow key, rather than clicking the vbar down arrow. When scrolling down with the cursor, lines are synchronized with the bottom of the text widget and partial lines are exposed at the top rather the bottom of the text widget. When the cursor exposes line 253, it will be covered up by the hbar. But for me, the top of the cursor is visible, meaning that the blank top slice of 253 is visible, hence the hbar is not removed. This is the minor glitch described above.

The question is how to stop the looping in the situations where it now occurs. I have some vague ideas, but need to sleep soon.