Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When editor text wrap is enabled, extensions should never cause horizontal scrolling. #43940

Closed
gwk opened this issue Feb 18, 2018 · 7 comments
Closed
Labels
editor-wrapping Editor line wrapping issues feature-request Request for new features or functionality
Milestone

Comments

@gwk
Copy link

gwk commented Feb 18, 2018

  • VSCode Version: Version 1.21.0-insider (1.21.0-insider) 9a4ba7d
  • OS Version: 10.13.4 Beta (17E150g)

Steps to Reproduce:

  1. Configure VSCode to wrap text (I believe this is the default).
  2. Install gitlens extension.
  3. Open a project that has a git history.
  4. Place the cursor on a line that is almost the length of the editor window.

With the default settings, Gitlens draws text at the end of the current line showing git blame info.
This causes the line length to exceed that of the window, thereby enabling horizontal scrolling.
Note that horizontal scrolling is not possible, even with wrapping lines, until the first time gitlens takes this action and causes an overflow. The only recourse I see is to reload the editor window, but it's just a temporary fix until gitlens does it again.

I think this is a design problem with the core VSCode editor. I do not want the editor to scroll horizontally, ever, unless wrapping is disabled. That an extension can cause the core UI to switch into a fundamentally different (and annoying) mode seems to me a flaw in the editor itself. The alternative is to blame the extension; perhaps there is some way of configuring GitLens to prevent this but I have tried and haven't found it yet. To reiterate, it seems reasonable to ask that the editor not allow extensions to break the basic layout constraint that the editor does not scroll horizontally.

The reason this is so annoying is that once horizontal scroll is enabled, then when I scroll vertically with the trackpad I tend to shift the horizontal scroll slightly, thereby visually clipping the left side of the document by a character or two. Even after coping with this for months, I still get thrown off by it.

Does this issue occur when all extensions are disabled?: Not sure. Currently the repo depends on an extension, but it seems like something that the core should prevent.

@gwk
Copy link
Author

gwk commented Feb 18, 2018

Also filed with GitLens: gitkraken/vscode-gitlens#290

@eamodio
Copy link
Contributor

eamodio commented Feb 19, 2018

Unfortunately I don't think there is anything GitLens (or any extension that uses an after decoration) could do to prevent this. I played with changing the DecorationRangeBehavior but I didn't see any change.

I feel like this changed somewhat recently -- where after decoration now affect scrolling. FWIW, I prefer that they affect scrolling, but they should honor the editor wrapping if they do.

Also related if an after decoration causes a line to grow and cause the scrollbars to appear, when the decoration is removed, the scrollbars don't go back to the previous state.

@alexdima alexdima added editor-rendering Editor rendering issues feature-request Request for new features or functionality and removed editor editor-core Editor basic functionality labels Feb 26, 2018
@alexdima
Copy link
Member

Currently, inline decorations (such as CSS color boxes or git lens decorations) are implemented via CSS :before / :after selectors and they are unknown to the editor.

@eamodio
Copy link
Contributor

eamodio commented Feb 26, 2018

As a hack, when the editor is in word-wrap mode, maybe the :after can be position: absolute to pull it out flow so it won't scroll?

@alexdima
Copy link
Member

alexdima commented Feb 26, 2018

@eamodio That is a good thought, but I think that would not work for all possible types of :after decorations (that can occur in the middle of the text, and which should push the text to the right, and which should result in an horizontal scrollbar). It might only work for :after decorations that are at the end of a line.

@eamodio
Copy link
Contributor

eamodio commented Feb 26, 2018

Ah, right. I forget you can have them anywhere :)

@alexdima alexdima added this to the Backlog milestone Apr 18, 2018
@alexdima alexdima removed their assignment Apr 18, 2018
@alexdima alexdima added editor-wrapping Editor line wrapping issues and removed editor-rendering Editor rendering issues labels Oct 23, 2019
@alexdima
Copy link
Member

Let's track in #32856

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-wrapping Editor line wrapping issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants