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
ReaderBookmark: show current page #9872
Conversation
local curr_page_string = self:getBookmarkPageString(curr_page_num) | ||
local curr_page_item = { | ||
page = curr_page_num, | ||
text = DISPLAY_PREFIX["curr_page"] .. _("Book current page"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just current page should do the trick.
text = DISPLAY_PREFIX["curr_page"] .. _("Book current page"), | |
text = DISPLAY_PREFIX["curr_page"] .. _("Current page"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason that one doesn't just say "current page"? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah, that's extremely clunky wording (in both cases ;p).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e., I'd go with something like "On the current page" for the popup, and a plain "Current page" for the new stuff.
else | ||
self.ui:handleEvent(Event:new("SetDogearVisibility", false)) | ||
end | ||
local is_index = self:getDogearBookmarkIndex(pn_or_xp) and true or false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_page_bookmarked
?
self.view.footer:onUpdateFooter(self.view.footer_visible) | ||
end | ||
return | ||
local index = self:getBookmarkIndexBinary(item) or self:getBookmarkIndex(item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming of the first method is a bit bad - we're not getting a bookmark index "binary" :)
getBookmarkIndexUsingBinarySearch(item) or self:getBookmarkIndexUsingFullScan(item)
or
getFastBookmarkIndex(item) or self:getFallbackBookmarkIndex(item)
(so-so)
or something better than that :)
Btw, you told me before, but why do we need these 2 ways of getting a bookmark index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need these 2 ways of getting a bookmark index?
Non-binary search is used when changing highlight boundaries (pos0 and pos1).
We can avoid this by passing the old highlight to find the corresponding bookmark.
And as a fallback
koreader/frontend/apps/reader/modules/readerbookmark.lua
Lines 981 to 984 in 5696a7c
-- If we haven't found item, it may be because there are multiple | |
-- bookmarks on the same page, and the above binary search decided to | |
-- not search on one side of one it found on page, where item could be. | |
-- Fallback to do a full scan. |
I did not investigate if there were any fails of binary search.
A bit too much changes to review carefully, so trusting you on the refactoring. But about the feature, adding a normal-size slot among bookmarks for
I don't find it particulary pretty, especially on your screenshots with tall bookmark slots (may look a bit less ugly on my small one-line bookmarks):
I guess it was the easier way to implement that, without touching to Menu, as it's just a regular slot. Some other ideas, just for discussions, probably less easy to implement.
|
Current behaviour of the bookmark list: Reasons of changes: What if there are no bookmarks in the book current page? An anchor (Current page item) explains where we are and why we see this page of the bookmark list. I find this item rather useful, helping to navigate through the bookmarks and pages. The "Book current page" button in the popup dialog is always enabled now (as we always have an item in the book current page). |
I agree with all these "reasons for change". Nothing against that. And I agree that if sorted by page number, we should open on the current page. Reaching the start or end is just a matter of hitting the
These are technicalities, because of the simple way you went at it, adding a normal slot and not touching Menu.
I think you're talking about the button in the popup dialog. Anyway, I think a border separator would work just as well as a cue about where your bookmarks are situated vs. the current page - keeping the bookmarks on the current page in bold.
I guess that when/if bookmarks are not sorted by page order (or reverse page order), there is no current page slot/border to show, as they may be many such "current" page in this unordered list :) |
By it, I meant changing "the visual aspect of the bookmark list". |
That makes it indeed a bit more different :) May be with some indentation (or blank icon), or centered with dots on both sides. And/or dimmed (if dimming is not used with bookmarks.) But it still feels like a dev hack (which it is :) It could be a setting, but well, I prefer solutions that don't need a setting and that work for most cases. And I guess a thickborder could be that solution: it would always be there, either at the top or at the bottom, and would be less bothering I think. |
I'd tend to be on the "minimalism" side of the argument, FWIW. But the "keep it empty if it's empty" argument is easy to deal with: just, well, keep the widget empty if there's no bookmarks ;o). |
Random idea: dim the page numbers for stuff that is behind (e.g., lower than) the current page number? That should only require minimal Menu trickery, and sort of achieves the same goal? |
Feels like it would be enough (unless I failed to understand how important it is to see the current page among bookmarks) and the less intrusive - even more if we instead dim page numbers that are after, as when reading a book, the bookmarks you have made would be behind, so if these are kept non-dim, it's a no visible change for most people. |
(Keep in mind that I'm a very very light bookmark user, so I'm just throwing wild ideas at the wall here ;)). |
This looks ok to me, unintrusive enough, and giving the info (that you were actually on page 679 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other comment about the code.
Still the comments I made previously about some naming:
- is_index => is_page_bookmarked (unless is_index somehow talks to you better)
- getBookmarkIndexBinary() should really not end with just "Binary" - better with: "...BinarySearch", or "...WithBinarySearch" or "...UsingBinarySearch"
Are you fine with the final result ? Does it answer enough #8047 ? |
I'm okay with the dimmed page number. |
(1) Show book current page in the list of bookmarks, for easier navigation.
(2) Boookmark list is opened showing the page with the book current page.
(A lot of duplicated code in the module has been removed)
Opening the bookmark list
Reading forward, all bookmarks are behind
Filtered
Closes #8047.
This change is