Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs in popup #10573

Merged
merged 3 commits into from
Apr 28, 2024
Merged

Fix bugs in popup #10573

merged 3 commits into from
Apr 28, 2024

Conversation

pascalkuthe
Copy link
Member

fixes #10569

this fixes regression introduced by #10257 both regarding general crashes and bugs when popup borders are used (#10566/#10553). While working on this I noticed there were actually existing bugs where the border size wasn't quite taken into account while scrolling which I also fixed. Since borders now need to be accounted for in the popup I made the border config and entirely internal config so its moore self contained.

Also incorporated the fixes from #10507 with some slight adjustments.

Marked for the next release since this fixes newly introduced crashes that are fairly easy to trigger

@pascalkuthe pascalkuthe added this to the 24.04 milestone Apr 23, 2024
@pascalkuthe pascalkuthe added C-bug Category: This is a bug A-helix-term Area: Helix term improvements E-medium Call for participation: Experience needed to fix: Medium / intermediate S-waiting-on-review Status: Awaiting review from a maintainer. labels Apr 23, 2024
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

I found a typo but otherwise this looks good. I've been using it locally since you posted it

helix-term/src/ui/popup.rs Outdated Show resolved Hide resolved
the-mikedavis
the-mikedavis previously approved these changes Apr 25, 2024
@pascalkuthe
Copy link
Member Author

(I will rebase later to absorb that commit sp we don't have to Squash merge)

pascalkuthe and others added 2 commits April 26, 2024 00:21
Trunctation should always be handled by the parent. Returning None is
only supposed to indicate a missing implementation

Co-authored-by: Ben Fekih, Hichem" <[email protected]>
helix-term/src/ui/popup.rs Show resolved Hide resolved
helix-term/src/ui/popup.rs Show resolved Hide resolved
helix-term/src/ui/popup.rs Show resolved Hide resolved
helix-term/src/ui/popup.rs Show resolved Hide resolved
Co-authored-by: Ben Fekih, Hichem" <[email protected]>
Copy link
Member

@dead10ck dead10ck left a comment

Choose a reason for hiding this comment

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

Nice, not only did you fix it, but you also refactored it and eliminated a bunch of repetition too. Thanks and nice work!

Comment on lines -158 to -160
if PADDING >= viewport.1 || PADDING >= viewport.0 {
return None;
}
Copy link
Member

Choose a reason for hiding this comment

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

Was this the bug? Returning None instead of a default size?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah this was an existing bug that caused crashes. required_size is only meant to always return None (for components that can't be embedded in a popup) or always meant to return Some. The API is a bit confusing and was very inconsistently used so this seems to have slipped trough at some point.

@the-mikedavis the-mikedavis merged commit e2594b6 into master Apr 28, 2024
6 checks passed
@the-mikedavis the-mikedavis deleted the popup_bugs branch April 28, 2024 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-medium Call for participation: Experience needed to fix: Medium / intermediate S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for popup
4 participants