Skip to content

Menu widget: "Go to letter" everywhere#13405

Merged
hius07 merged 7 commits into
koreader:masterfrom
hius07:go-to-letter
Mar 16, 2025
Merged

Menu widget: "Go to letter" everywhere#13405
hius07 merged 7 commits into
koreader:masterfrom
hius07:go-to-letter

Conversation

@hius07

@hius07 hius07 commented Mar 13, 2025

Copy link
Copy Markdown
Member

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.

1


This change is Reviewable

@hius07 hius07 mentioned this pull request Mar 13, 2025
Comment thread frontend/ui/widget/menu.lua Outdated
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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

@hius07 hius07 merged commit b707d0f into koreader:master Mar 16, 2025
@hius07 hius07 deleted the go-to-letter branch March 16, 2025 06:03
@hius07 hius07 added this to the 2025.03 milestone Mar 16, 2025
@hius07 hius07 mentioned this pull request Mar 26, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
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