Skip to content

Hide the Scrollbar when it isn't needed #507#520

Open
deemoun wants to merge 6 commits intopop-os:masterfrom
deemoun:hide-scrollbar
Open

Hide the Scrollbar when it isn't needed #507#520
deemoun wants to merge 6 commits intopop-os:masterfrom
deemoun:hide-scrollbar

Conversation

@deemoun
Copy link

@deemoun deemoun commented Feb 8, 2026

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:

  1. keep original condition: start_line > 0 || (end_line + 1) < lines
  2. add wrap_overflow = layout_run_count > visible_runs
  3. final: scrollable = original_condition || wrap_overflow
  4. visible_runs is clamped with .max(1) to avoid tiny-window zero-line issues.

No changes to scroll math, drag logic, click behavior, or layout behavior.

@leviport leviport requested review from a team February 9, 2026 18:00
@leviport leviport self-assigned this Feb 11, 2026
Copy link
Member

@leviport leviport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@deemoun
Copy link
Author

deemoun commented Feb 12, 2026

Thanks. I will take a look and compare to Prod behavior.

@deemoun
Copy link
Author

deemoun commented Feb 12, 2026

@leviport I don't have permission to open this video file to reproduce that

image

@leviport
Copy link
Member

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.

@leviport
Copy link
Member

Maybe a webm will work better:
Kooha-2026-02-12-09-18-16.webm

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 leviport requested a review from a team February 13, 2026 21:33
Copy link
Member

@leviport leviport left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments