Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't allow vertical scrollbar to affect soft wrap column #17474
Previously, the decision of whether to show or hide scrollbars in a text editor was made by estimating whether or not a scrollbar was needed based on the editor's content. It involved a circular data flow:
From what I can tell, there are some subtle issues with the timing of our measurements that currently cause this calculation to produce unstable results, resulting in the issues linked below.
Aside from these rendering bugs, this overall approach for showing and hiding scrollbars seems different from other applications that I'm familiar with. In other applications, there does not seem to be this circular feedback loop.
For example, in
I did a similar test with Sublime Text 3, and I observed a similar behavior. I think that these apps' behavior seems simpler than Atom's from an implementation perspective, and probably better from a UX perspective as well.
Description of the Change
In this PR, I've changed Atom's logic for showing and hiding scrollbars in two ways:
We could also fix the bugs referenced below within the current paradigm. @Ben3eeE had one idea for fixing this bug at the cost of performing extra DOM measurements. From my testing, this fix does indeed work.
The reasons that I'm proposing this solution instead is:
This is a bigger change, and it definitely requires careful testing on all three platforms.
On all three platforms (and with all possible scrollbar settings on mac):
/cc @nathansobo @as-cii I haven't dealt with this code, so I might be missing some aspects of this whole thing. Before I proceed to fix up the tests that I've broken, could you take a look at this overall approach?
I think it would just leave room for the scrollbar, similarly to what happens on mac os, when
Actually, I take this back. In Chrome itself, regular DOM elements actually do seem to have this circular feedback loop where the state of the vertical scrollbar can affect soft wrap. So it's not as cut and dry as I originally made it sound. Still, in TextEdit, Sublime Text, and VS Code, the vertical scrollbar does not affect soft wrap, so I think it's ok for us to adopt this approach too.