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(completionentry): calculate max size and resize correctly #95

Merged
merged 3 commits into from
Dec 23, 2024

Conversation

geodimm
Copy link
Contributor

@geodimm geodimm commented Dec 5, 2024

The new max size calculation ensures the popup position is always below
the entry widget.

The addition of the Resize method ensures the popup is updated with the
rest of the widget upon resize.

Since now the popup doesn't go above the entry widget not all options
are rendered and the test had to be updated to select the first item as
the other ones are not visible

Before:
https://github.com/user-attachments/assets/baff9482-3543-4e8a-8e52-cdad1ef79dcc

After:
https://github.com/user-attachments/assets/981f6a41-7705-42d0-a075-555c65fc28df

The new max size calculation ensures the popup position is always below
the entry widget.

The addition of the Resize method ensures the popup is updated with the
rest of the widget upon resize.

Since now the popup doesn't go above the entry widget not all options
are rendered and the test had to be updated to select the first item as
the other ones are not visible
@geodimm geodimm force-pushed the fix-completionentry-resize branch from 233b279 to 27ea5b9 Compare December 5, 2024 22:55
@@ -136,7 +146,8 @@ type navigableList struct {
}

func newNavigableList(items []string, entry *widget.Entry, setTextFromMenu func(string), hide func(),
create func() fyne.CanvasObject, update func(id widget.ListItemID, object fyne.CanvasObject)) *navigableList {
create func() fyne.CanvasObject, update func(id widget.ListItemID, object fyne.CanvasObject),
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change - it looks like you have added another item to the parameters to put it on a new line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just my formatter automatically formatting the source code, it's a non-functional change :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andydotxyz Would you prefer to undo the white space change or you're happy to merge the PR as is?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, please do put it back to not having an empty parameter which is just newline.
I will get our CI updated so that the linter runs correctly for our code standards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@andydotxyz would it be possible to get this merged soon? 🙏

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this, just asking something that looks strange in the style

@coveralls
Copy link

coveralls commented Dec 9, 2024

Pull Request Test Coverage Report for Build 12331391666

Details

  • 10 of 12 (83.33%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 47.973%

Changes Missing Coverage Covered Lines Changed/Added Lines %
widget/completionentry.go 10 12 83.33%
Totals Coverage Status
Change from base Build 10230812376: 0.1%
Covered Lines: 1893
Relevant Lines: 3946

💛 - Coveralls

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

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

Perfect thanks so much for this, and congratulations on your first fyne-x PR landing :)

@andydotxyz andydotxyz merged commit b37145a into fyne-io:master Dec 23, 2024
7 checks passed
@andydotxyz
Copy link
Member

I wonder if there maybe should be a follow-up for when the select is at the bottom of a screen and should pop above instead of below? Perhaps there should be a minimum size check and if the "down" is too short use "up" instead?

@geodimm
Copy link
Contributor Author

geodimm commented Dec 26, 2024

Yes, I was also thinking about making the size configurable, e.g. for the dropdown to take 50% or 75% of the screen size as opposed to filling it. Both would be good improvements

@andydotxyz
Copy link
Member

A word of warning - don't make widget size relative to screen/window size - it leads to bad outcomes. If you want to configure how much content should be displayed then it should be relative to some content reasoning not window space.

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