Skip to content

Conversation

@mdonatas
Copy link

@mdonatas mdonatas commented Dec 21, 2025

Fixes #4 and #53

Root cause for #4 only occurs when using a mouse cursor to drag the vertical scrollbar. If during drag a horizontal scrollbar is shown or hidden the text part of TextAreaControl gets resized by the appearance or disappearance of the scrollbar at the bottom. At the same time mouse cursor which drags the vertical scrollbar remains in the same place (adjusted for the dragging itself). This causes the vertical scrollbar to effectively get moved as the whole control "moves" under it while dragging is active.

Notepad++ solves this by keeping the horizontal scrollbar forever if it's shown at least once.

Note

This only applies to click+drag scrolling. Scroll-wheel or touch-pad scrolling is not affected

#53 was caused by being unable to reach a "stable" state when trying to determine necessary scrollbars. e.g. 1) you need a horizontal scrollbar 2) horizontal scrollbar hides the longest line which caused it 3) hide horizontal scrollbar .. back to 1).

Proposed changes

  • Track the state of whether the mouse is still down on the scrollbar during the drag process (accomplished by TrackableVScrollBar)
    • Only allow horizontal scrollbar to be hidden if mouse-drag is not active
  • Change scrollbar visibility calculation to need just one pass thus avoiding looking for "stable" scrollbar configuration

Test methodology

  • Unit tests
  • Used this daily for at least a month

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

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

works well for me; nitpicks on code style (ignoring usage of var because commonly used for this control)

@mdonatas
Copy link
Author

Thank you @mstv for the review 👍 I've made the changes except for where I still would prefer to have it the way it is.. although that's not the hill I am ready to die on :D so let me know if you have strong views on those.

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.

TextEditor horizontal scrollbar causes content to jitter/jump

2 participants