Menu widget: "Go to letter" everywhere#13405
Merged
Merged
Conversation
Closed
poire-z
reviewed
Mar 13, 2025
Comment on lines
+1302
to
+1310
| function Menu:searchStringInMenuItems(search_string, goto_letter) | ||
| search_string = Utf8Proc.lowercase(util.fixUtf8(search_string, "?")) | ||
| for i, item in ipairs(self.item_table) do | ||
| if not item.is_go_up and not (goto_letter and item.is_file == false) then -- skip folders in "Go to letter" | ||
| local item_text = Utf8Proc.lowercase(util.fixUtf8(item.text, "?")) | ||
| local idx = item_text:find(search_string) | ||
| if idx and (idx == 1 or not goto_letter) then | ||
| self.itemnumber = i -- draw focus | ||
| self:onGotoPage(self:getPageNumber(i)) |
Contributor
There was a problem hiding this comment.
I think this function is badly named: you don't search and return results (like what we do in other functions named with "Search"), you "go" to the first page containing or starting with the string.
:goToMenuItemMatching(...) may be?
poire-z
approved these changes
Mar 15, 2025
Frenzie
approved these changes
Mar 15, 2025
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.
In the Flat Library (collection of all books) the list of authors takes many pages.
I'd like to jump to the desired first letter or search for a string.
Let Search and Go to letter buttons show up in all lists.
If a parent widget (FM, History, Collections) provides its own search dialog, it is called with the Search… button.
This change is