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
Show full ToC entry on hold #6729
Conversation
Same behavior as ReaderBookmark
(Roughly similar to the highlight menu, FWIW).
Also, squish debug prints ;p.
@poire-z: What's the screen dimension and layout here, and was that before or after the Landscape fix? ^^ |
610x600. Same after landscape fix. (Somehow, using an InfoMessage would work around that: it would adjust to the height needed, and even reduce the font size if the text is too long.) |
@poire-z: an (iconless) InfoMessage looks like this: That's perfectly fine by me, FWIW. Will it deal with LTR & stuff properly? |
diff --git a/frontend/apps/reader/modules/readertoc.lua b/frontend/apps/reader/modules/readertoc.lua
index e9551e20..494d8afa 100644
--- a/frontend/apps/reader/modules/readertoc.lua
+++ b/frontend/apps/reader/modules/readertoc.lua
@@ -7,9 +7,9 @@ local Event = require("ui/event")
local Font = require("ui/font")
local GestureRange = require("ui/gesturerange")
local Geom = require("ui/geometry")
+local InfoMessage = require("ui/widget/infomessage")
local InputContainer = require("ui/widget/container/inputcontainer")
local Menu = require("ui/widget/menu")
-local TextViewer = require("ui/widget/textviewer")
local UIManager = require("ui/uimanager")
local logger = require("logger")
local _ = require("gettext")
@@ -584,15 +584,11 @@ function ReaderToc:onShowToc()
end
function toc_menu:onMenuHold(item)
- local textviewer = TextViewer:new{
- title = _("Chapter title"),
+ local infomessage = InfoMessage:new{
+ show_icon = false,
text = item.text,
- lang = self.ui.document:getProps().language,
- width = math.floor(self.width * 0.8),
- height = self.height > self.width and math.floor(self.height * 0.25) or math.floor(self.height * 0.33),
- justified = false,
}
- UIManager:show(textviewer)
+ UIManager:show(infomessage)
return true
end |
^^but may be let that for the day we fix the TOC layout for when book direction is different than UI direction as it might feel strange to have the difference like on the screenshot above. |
Yeah, right now it'd feel somewhat confusing if the popup was laid out differently than the ToC page ;). Good to know, though :). |
Yes, I believe. |
OK, that was my bug, so I'll fix it :/ Something to do with size = Screen:scaleBySize(orig_size), and orig_size being stored in the font object (so we can re-use it to fetch a bold font or a smaller font). We'll need to update it when size/dpi change. |
And took care of trimming toc_indent ;). |
@poire-z: Since I can never remember what the return actually does for those, is returning |
I guess it's fine. But anyway, as we don't know about other valuable handler in this context, and that you always do something (showing the InfoMessage), |
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 think there might be more bits of code that use gsub(...%S...)
to do some trim() and that could be migrated to your new util.*trim() - but may be keep that for a later PR :) (and/or remove the statistics.koplugin one from here to have them all in a dedicated commit?)
(May be not many:
readerstyletweak.lua, generic/device.lua looks updatable
readerhighlight.lua and readerdictionary.lua do trim as part of other stuff, so keeping the gsub there with the other gsub might be clearer.)
frontend/util.lua
Outdated
---- Various whitespace trimming helpers, from http://lua-users.org/wiki/CommonFunctions | ||
---- @string s the string to be trimmed | ||
---- @treturn string trimmed text | ||
-- remove leading whitespace from string. | ||
-- http://en.wikipedia.org/wiki/Trim_(programming) |
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 comments here are slightly weird from an ldoc perspective. ;-)
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.
lgtm, but ideally the comments on the new util functions would be a bit better ;-)
Fix #6728
This change is