Hide the Scrollbar when it isn't needed #507#520
Hide the Scrollbar when it isn't needed #507#520deemoun wants to merge 6 commits intopop-os:masterfrom
Conversation
leviport
left a comment
There was a problem hiding this comment.
The scroll bar now appears when there is scrollable content, and disappears when the file isn't long enough to need it.
I noticed that there is a threshold where the scroll bar appears, but the file isn't yet long enough to be scrollable. When the scroll bar appears in this instance, it's completely filled in and can't be scrolled up or down. If I keep adding lines until I hit the end of the file, an empty part of the scroll bar finally appears, and I can click and drag the bar to scroll. Here is a video showing what I mean:
https://github.com/user-attachments/assets/c16c09af-d791-4215-bf57-7ac9f4fddc86
Is this behavior intentional?
|
Thanks. I will take a look and compare to Prod behavior. |
|
@leviport I don't have permission to open this video file to reproduce that
|
|
What the heck, that should just work. I am seeing the same 404 when I try while not signed in though. Let me see if I can upload it a different way. |
|
Maybe a webm will work better: I noticed an important clue when re-recording that video: the bug I described only happens when I change display scaling. The Oryx I was testing on yesterday was scaled higher than 100%, so that's how I encountered it. My own Oryx is only FHD, so it runs at 100%, and I couldn't recreate it until I increased the scaling. I'm guessing that means that it could be a libcosmic bug, not a bug with the implementation of your PR. I'll run through regression testing, and if that looks good, we can probably merge it and file a libcosmic bug report. |
leviport
left a comment
There was a problem hiding this comment.
The bug I mentioned doesn't seem like it's the fault of this PR, so I just ran through regression testing, which passed.
results:
Basic operations
- Type three lines of text (no trailing newline).
- Copy the last two lines.
- Paste at the end of the third line (file should now have four lines).
- Ctrl-Z to undo the paste.
- Press Enter to add a trailing newline.
- Paste again (file should now have five lines).
- Ctrl-Z to undo the paste.
- Ctrl-Shift-Z to redo the paste.
- Save the file.
- Ctrl-F and search for something that has a match.
- Press Esc twice to exit the Find dialog.
- Press Ctrl-X to cut the selected search result.
- Paste the cut text on a new line (file should now have six lines).
- Re-save the file.
- Narrow the window until the lines start wrapping (make a line longer if necessary to observe line wrapping).
- Turn word wrapping off.
- Scroll right to the end of the document, then left to the beginning again.
- Click and drag to select some text past the horizontal edge of the window.
- Close the file, open COSMIC Edit again, and open the file via the recents list.
- Close the file again, open COSMIC Edit again, and open the file via the Open dialog.
- Turn word wrapping back on.
Settings
- Open View -> Settings.
- All Appearance settings work.
- Vim bindings work.
Projects & Git Management
- Clone the cosmic-edit Git repo and open its directory as a project.
- Edit -> Find in project... works.
- Make a change in a file.
- File -> Git management shows the change and staging it works.
- Make another change while Git management's open; it updates to show the new change.

Scrollbar now appears only when scrolling is necessary per ticket #507
Testing done:
Opened a new file (scrolling appeared)
Typed a few lines so that it shows scrollbar there
Resized the editor back and forth - it shows the scrollbar in those cases
Scrolled back and forth - no other behavior chages
Deleted all the text - scrollbar disappeared
Vertical scrollbar is now fully Option-gated: Some(rect) only when scrollable, None otherwise (prevents stale rect use).
Vertical scrollbar draw and hit-testing/drag handling run only when the rect is Some.
Soft-wrap overflow edge case fixed by extending scrollability with visual-line overflow:
No changes to scroll math, drag logic, click behavior, or layout behavior.