gpui: Recalculate list layout after the window has been resized#51414
Merged
ChristopherBiscardi merged 2 commits intozed-industries:mainfrom Mar 13, 2026
Merged
Conversation
comment says "If the width of the list has changed, invalidate all cached item heights" which wasn't incorrect per-se, but it just invalidated them without triggering any recomputation, causing incorrect scroll bars.
ChristopherBiscardi
approved these changes
Mar 13, 2026
Contributor
ChristopherBiscardi
left a comment
There was a problem hiding this comment.
I've reproduced this with a similar window management software (yabai) and confirmed that the fix works.
before:
screenshot-2026-03-12-at-16.25.26-converted.mp4
after:
screenshot-2026-03-12-at-16.29.22-converted.mp4
Test fails without the fix, and passes with the fix.
I think this fix is correct, since the width is being invalidated and this is also what is done when height changes in remeasure
Contributor
|
Thanks! |
tommyming
pushed a commit
to tommyming/zed
that referenced
this pull request
Mar 13, 2026
…industries#51414) Closes zed-industries#51417 I noticed this bug in the settings menu where when I opened the settings menu, I could not scroll down through all the available options, eg. on the initial page I wasn't able to scroll down to privacy. When I saw that no one else had reported this issue, I figured it may be due to my setup, and it turns out that using Aerospace, the window manager I use, was what made this bug visible to me. Because aerospace resizes the window right after it launches, the originally computed heights for the list are incorrect, meaning the scroll bar is the wrong size as well. in the relevant code there was a comment that says "If the width of the list has changed, invalidate all cached item heights" which wasn't incorrect per-se, but it just invalidated them without triggering any re-computation, causing incorrect scroll bars. My intuition is that window resizes/events that change the width of the list bounds are fairly rare, so there shouldn't be a large performance hit from the change. Also implemented a test that directly showcases the behavior, if you run the test without the change it fails, as the max_offset_for_scrollbar will be wrong. Videos: Before https://github.com/user-attachments/assets/2b680222-7071-4098-863f-519361f0756a After: https://github.com/user-attachments/assets/1222a299-23d7-4007-8e88-55d2daccce64 [x] Tests [x] Video of behavior Release Notes: - gpui: fixed list height re-computation when the list width changes.
Yamrc
added a commit
to NeoNekos/NekoWG
that referenced
this pull request
Mar 15, 2026
- 修复设置菜单无法滚动显示全部选项的问题 - 解决窗口管理器(如Aerospace)导致的列表高度计算不正确 - 修改窗口大小变化时无效化缓存的行为,确保滚动条正确显示 - 增加测试,验证修改后的行为 源提交: zed-industries/zed#51414
Yamrc
added a commit
to NeoNekos/NekoWG
that referenced
this pull request
Mar 15, 2026
- 修复设置菜单无法滚动显示全部选项的问题 - 解决窗口管理器(如Aerospace)导致的列表高度计算不正确 - 修改窗口大小变化时无效化缓存的行为,确保滚动条正确显示 - 增加测试,验证修改后的行为 源提交: zed-industries/zed#51414
Yamrc
added a commit
to NeoNekos/NekoWG
that referenced
this pull request
Mar 15, 2026
- 修复设置菜单无法滚动显示全部选项的问题 - 解决窗口管理器(如Aerospace)导致的列表高度计算不正确 - 修改窗口大小变化时无效化缓存的行为,确保滚动条正确显示 - 增加测试,验证修改后的行为 源提交: zed-industries/zed#51414
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #51417
I noticed this bug in the settings menu where when I opened the settings menu, I could not scroll down through all the available options, eg. on the initial page I wasn't able to scroll down to privacy. When I saw that no one else had reported this issue, I figured it may be due to my setup, and it turns out that using Aerospace, the window manager I use, was what made this bug visible to me. Because aerospace resizes the window right after it launches, the originally computed heights for the list are incorrect, meaning the scroll bar is the wrong size as well.
in the relevant code there was a comment that says "If the width of the list has changed, invalidate all cached item heights" which wasn't incorrect per-se, but it just invalidated them without triggering any re-computation, causing incorrect scroll bars.
My intuition is that window resizes/events that change the width of the list bounds are fairly rare, so there shouldn't be a large performance hit from the change.
Also implemented a test that directly showcases the behavior, if you run the test without the change it fails, as the max_offset_for_scrollbar will be wrong.
Videos:
Before
before_fix.mov
After:
fixed.mov
[x] Tests
[x] Video of behavior
Release Notes: