Open taleinat opened 5 years ago
With code context shown, scrolling a window by dragging the scrollbar causes the scrollbar's tab to "jump around" and sometimes some "flashing" visual artifacts.
The "flashing" appears to occur only before the screen is resized for the first time, in which case the entire window is resized whenever the number of context lines changes during scrolling.
See attached animated screen capture.
Reproduced on latest versions of Win10 and macOS.
See also PR python/cpython#58238, adding line numbers, which makes this more likely to occur for users.
I repeated Tal's experiment, on Windows, and added more. I list below multiple issues related to code context and scrolling, and possible solutions.
1: two geometry modes. After the text height is set on start up or by restore height, CC height is added to the fixed text height, making frame (and window height) vary. After the window height is set by the user or zoom height, CC height is subtracted from the frame height, derived from the window height, making text height vary.
I don't remember noticing such switching between add and sub modes when CC height was fixed, but I presume it occurred. (I don't have pre-3.6.8 3.x to check.) But it is now confusing and a nuisance. I think we should prefer sub mode because add mode would undo correct zooming when zoomed, results in status line artifacts when row and column spaces temporarily left black, and is overall more obnoxious. Perhaps we could do this by setting window height after setting text height.
We might experiment with border styles and their affect on the boundary between CC and text.
There are two oddities. First, the padding between border and text line ends remains dark. Second, after moving up and down a line where flashing happens, it sometimes stops after about 3 repetitions. (Example editor.py, CC on, line 41 top line visible, move down and back up, repeat.)
Perhaps making sure that both toplevel and frame have the proper background will solve the issue. I don't know the colorizer well enough to know whether it is relevant here.
One way to prevent the bouncing is to fix the CC height, like it used to be. Rather than revert, I would add a min height, so that min == max means fixed. Another way to prevent the bouncing is to avoid mixing CC and scrolling, especially dragging. Adding a CC hot key would enable quick looks at current context while mostly having it off. With line numbers on, I think that this would be even more needed.
The tests needed would mostly be suggestions added to an htest.
Regarding point #4, scrolling by dragging the scrollbar, note that the current PR for adding line numbers (GH-14030) does effectively the same when dragging on the line numbers to select lines. Therefore, if/when that PR is merged, this will become more common.
One way to prevent the bouncing is to fix the CC height, like it used to be.
+1 from me. I find this behavior very distracting and unnatural.
I suggest we do consider reverting rather than adding another config value (minimum context lines), working towards our goal of simplicity and friendliness to novices and new users.
Whereas I found the fixed size to be much less usable. The default of 3 lines was too few and often useless when context is needed whereas a realistic size of, say, 8, wasted too much space too much of the time. I might prefer deleting the feature to reverting.
It is probably a good thing to have 2 developers with different visual processing systems ;-).
With integral lines at the top of the text, scrolling one line down with a header line at the top means that the header line stays put while the background changes and the separator lines moves. A dedent line moves up as the context shrinks. I *like* the CC size changes because the size indicates the indent depth.
Changing the general tab line from Max context lines: [ ] to Code context lines: min [ ] max [ ] strike me as an improvement even without adding min, and the somewhat obvious addition of min (it is currently fixed at 1) should not confuse users.
The scrollbar slider bobble does not bother me much when scrolling with key or mouse wheel because I hardly see it. My eyes are focused on the text.
Another possible solution is suppressing CC update at least while the mouse button is held down over the scrollbar. Button down/up on the scrollbar instance sets text.pause_CC to True/False and CC update checks self.text.pauseCC.
I *like* the CC size changes because the size indicates the indent depth.
My feeling is that you would be in a minority here. IMO most new/novice users would find this surprising and confusing, since it is far from a customary UI experience. Since our opinions obviously differ rather greatly on this, I suggest that we try to be objective and get some opinions from other users.
The scrollbar slider bobble does not bother me much when scrolling with key or mouse wheel because I hardly see it. My eyes are focused on the text.
On Windows, when scrolling with a mouse scroll wheel or a trackpad, I find that this makes scrolling rather inconsistent, since it will scroll more or less lines depending on the change in the number of context lines.
Another possible solution is suppressing CC update at least while the mouse button is held down over the scrollbar. Button down/up on the scrollbar instance sets text.pause_CC to True/False and CC update checks self.text.pauseCC.
I also see artifacts and scrollbar "jitter" when scrolling with a mouse wheel or trackpad, so IMO that wouldn't be a thorough enough solution.
'at least' means 'get something working, then consider expanding'. The scrollwheel is tougher without built-in start/stop events equivalent to press/release. We could, however, synthesize them. But I want to start with mouse button, and it that works, consider keys next.
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: ```python assignee = 'https://github.com/terryjreedy' closed_at = None created_at =
labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
title = 'IDLE: Scrolling issues with code context shown'
updated_at =
user = 'https://github.com/taleinat'
```
bugs.python.org fields:
```python
activity =
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = False
closed_date = None
closer = None
components = ['IDLE']
creation =
creator = 'taleinat'
dependencies = []
files = ['48469']
hgrepos = []
issue_num = 37559
keywords = ['patch']
message_count = 7.0
messages = ['347666', '347855', '347890', '347893', '347931', '347954', '348003']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'taleinat', 'cheryl.sabella']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue37559'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']
```