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

Horizontal scrollbar doesn’t shrink after the long line getting shortened #13516

Open
EFanZh opened this issue Oct 11, 2016 · 8 comments
Open
Labels
editor-scrollbar feature-request Request for new features or functionality
Milestone

Comments

@EFanZh
Copy link
Contributor

EFanZh commented Oct 11, 2016

  • VSCode Version: 1.6.0
  • OS Version: Windows 10

Steps to Reproduce:

  1. Create an empty file;
  2. Type a long line until the horizontal scrollbar appears;
  3. Delete that long line;
  4. Observe that the horizontal scrollbar still exists.

If I resize the window, the horizontal scrollbar disappears, but If I only delete the long line, the horizontal scrollbar still exists.

@alexdima
Copy link
Member

alexdima commented Oct 27, 2016

We never got to implement that it shrinks :)

We do something very easy:

  • when painting a viewport: scrollWidth = Math.max(scrollWidth, lines[i].getWidth())
  • when relayouting: scrollWidth = 0.

@alexdima alexdima added feature-request Request for new features or functionality polish Cleanup and polish issue editor-core Editor basic functionality labels Oct 27, 2016
@alexdima alexdima added this to the Backlog milestone Oct 27, 2016
@alexdima alexdima removed their assignment Oct 27, 2016
@alexdima alexdima added the *as-designed Described behavior is as designed label Oct 27, 2016
@EFanZh
Copy link
Contributor Author

EFanZh commented Oct 10, 2017

@alexandrudima I think this bug (or feature) is somehow fixed (or implemented), can you verify it?

@alexdima
Copy link
Member

No, I haven't fixed this yet.

Scroll in such a way that not all lines are visible in the viewport:
kapture 2017-10-23 at 18 24 34

longest line longest line longest line longest line longest line longest line 



















a not so long line a not so long line

@alexdima alexdima removed the *as-designed Described behavior is as designed label Dec 10, 2018
@alexdima alexdima added editor-rendering Editor rendering issues *out-of-scope Posted issue is not in scope of VS Code and removed editor-core Editor basic functionality labels Oct 21, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 23, 2019

We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Oct 23, 2019
@realh
Copy link

realh commented Oct 23, 2019

I might not go so far as to say this is crucial, but I think it is quite important. In my duplicate bug report I pointed out how touchpads can scroll horizontally and vertically at once, so the scrollbars can be quite a nuisance. Every other editor I've used resizes the viewport as soon as a long line is deleted.

If your implementation is as simple as you say in the second comment here, can't you simply reset scrollWidth whenever a long line gets deleted or becomes short enough to fit? A "long line" could be defined either as being >= scrollWidth or as anything too long for the viewport, I think either would work.

@alexdima alexdima reopened this Oct 23, 2019
@alexdima alexdima removed the *out-of-scope Posted issue is not in scope of VS Code label Oct 23, 2019
@alexdima alexdima added editor-scrollbar and removed polish Cleanup and polish issue editor-rendering Editor rendering issues labels Oct 24, 2019
@ma-sadeghi
Copy link

Hi, Any updates on this issue? :)

@realh
Copy link

realh commented Apr 24, 2024

There are two workarounds: enable Word Wrap, or press Ctrl-B/Cmd-B twice whenever the width needs to be corrected.

@ma-sadeghi
Copy link

Thanks @realh! Just for reference: If GitLens's show-blame-per-line config is enabled, the trick won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-scrollbar feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants