Skip to content

input: Avoid notifying unchanged scroll and paint state - #2988

Merged
huacnlee merged 3 commits into
longbridge:mainfrom
jlucaso1:fix/input-scroll-notify
Sep 7, 2026
Merged

input: Avoid notifying unchanged scroll and paint state#2988
huacnlee merged 3 commits into
longbridge:mainfrom
jlucaso1:fix/input-scroll-notify

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

An input invalidated its cached parent on every unrelated redraw. Both update_scroll_offset and TextElement::paint called notify unconditionally, so a window drawing video rebuilt the input's surrounding screen on each frame.

Compare the clamped scroll offset before notifying. During paint, keep geometry notifications when bounds or scroll extent change, but do not notify for an unchanged layout. Editing, scrolling and resize invalidations remain intact.

Verification

  • Added both regression tests before the fix. Both failed. An edited input rebuilt its cached parent 60 times for 60 root notifications.
  • Both regressions now pass, including clamped no-op offsets, real scrolling, a shrinking scroll range, editing and resizing.
  • After merging current main, cargo test -p gpui-base --lib --locked passed 842 tests.
  • cargo clippy -p gpui-base --lib --tests --locked -- -D warnings passed on the updated branch.
  • The compatibility version based on 5cb0946 also passed all 731 base tests and 412 component tests.

Consumers still on the 0.5 API can test the identical fix through jlucaso1/gpui-component branch fix/input-scroll-notify-0.5 at 970c606, without adopting the 0.6 dependency changes in current main.

@walterlow

Copy link
Copy Markdown

I was about to make a PR for this similar issue i encountered while developing my app as well
image

@huacnlee
huacnlee enabled auto-merge (squash) September 7, 2026 13:51
@huacnlee
huacnlee merged commit 16a3051 into longbridge:main Sep 7, 2026
9 checks passed
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.

3 participants