When reasonably possible, the program should only crash in debug mode.
Adds a couple of extra unit tests to prevent regressions and adds docs.
Fixes <https://github.com/koreader/koreader/issues/5356>.
`self.inverse_reading_order == nil and G_reader_settings:has("inverse_reading_order")` could easily be false, which would then incorrectly turn the setting off.
Fixes <https://github.com/koreader/koreader/issues/5346>.
* Restart KOReader after a crash, after showing a fancy crash recap screen (our very own Gray Screen of Death!).
Kobo only, because it's possibly the platform where getting booted out
of KOReader is the most annoying.
Keeps track of crashes, to be able to give up after a while, in order to
avoid boot loops in the unlikely event of a crash loop on startup.
Adds a dev option to *always* exit KOReader after the crash screen.
And a couple bugfix this unearthed:
* Always set the default as the *current* value, no matter what (by chance, this was not an issue for margins).
* Don't crash on the hold gesture in the -/+ buttons for the horizontal margins (regression since #5303).
Thanks to <https://github.com/koreader/koreader/pull/5237> we can now extract the knowledge currently embedded in Transifex and put it directly in our source. This positively affects <https://github.com/koreader/koreader/issues/3754>.
Translation instructions and knowledge that comes out of localization-related questions should be preserved in the source, because Transifex is too ephemeral. For example, the links from <https://github.com/koreader/koreader/pull/2290> are no longer accessible. Even when they are, it's quite useful to have this information around while dealing with the code as well, and I also hope it'll be informative to contributors who seldom visit Transifex.
This commit also makes a few minor changes to obviate the need for comments where possible.
This commit standardizes the various todos around the code a bit in a manner recognized by LDoc.
Besides drawing more attention by being displayed in the developer docs, they're also extractable with LDoc on the command line:
```sh
ldoc --tags todo,fixme *.lua
```
However, whether that particular usage offers any advantage over other search tools is questionable at best.
* and some random beautification
This introduces context to our strings to differentiate them when necessary.
The syntax chosen is `C_()`, following [glib](https://developer.gnome.org/glib/2.28/glib-I18N.html#C-:CAPS).
```lua
local _ = require("gettext")
local C_ = _.pgettext
C_("Menu|StyleTweaks|", "Pages")
```
Closes#5232.
References https://github.com/koreader/koreader/issues/5232
Given an entry in the PO file like the following:
```
msgctxt "systemstat"
msgid " Total"
msgstr "Totaal"
```
It can be addressed using:
```lua
local _ = require("gettext")
local C_ = _.pgettext
C_("systemstat", " Total")
```
This allows to distinguish between separate instances of the same string, for example "Pages" meaning "Number of pages" and "Pages" meaning "Display of pages".
Extraction of this code pattern is not yet implemented by nightswatcher. xgettext didn't yet support Lua back in 2013 when all this was first added to the program, but now it does. Therefore it might make the most sense to replace the current Python extraction script with xgettext itself.
By default it only understands gettext.pgettext(), but that can be addressed by passing some extra command line arguments, for example:
```
xgettext -l lua -c --keyword=C_:1c,2 *.lua
```
Bump crengine: background image and other fixes:
- View HTML: option to show text unicode codepoints
- Fix attribute parsing: decode &-encoded chars
- Text: allow wrap after more unicode spaces and hyphen
- Fix: no left hanging when hanging punctuation disabled
- lvtextfm.cpp: more comments, some formatting cleanup
- Optimize background image drawing
- CSS: fix background-image file path resolution
Bump luasec to 0.8.1
Bump harfbuzz to 2.6.0
cre.cpp:
Adds setBackgroundImage() proxy function to crengine
facility to set background textures (this is unrelated
to the background-image CSS fixes).
No frontend code (yet) to select such an image.
View HTML: adds a 3rd view (extended debug view), showing the
unicode codepoint of each char and crengine rendereing methods.
- show icons or letters as prefix of items
- various footer separators
- progress percentage format with decimal digits
- time in 12/24 format
- two duration formats (1:30, 1h30')
- move some options into Settings submenu
The current name causes people to think of scrolling, which is slightly awkward on E Ink. For example, see <https://github.com/koreader/koreader/issues/5166#issuecomment-517771475>.
> But this on LCD, not E-ink where the lag is unbearable, especially if you want to correct any scrolling over/undershoot.
Scroll mode is a misnomer. It should be renamed continuous. I use "scroll mode" as the default, but I seldom or never scroll. Conversely, you can still scroll in paged mode if a page is longer than the screen. As far as I'm concerned if you're scrolling (panning) you may be doing it wrong, but to anyone reading: you do you. ;-)
* Try to make sure restoreWifiAsync eventually sends a NetworkConnected
event...
re: #5109
* Take a page from @shermp's book, and make sure wpa_supplicant managed to
connect to the AP before acquiring an IP.
Tear down WiFi modules in case of failure.
c.f., https://github.com/shermp/Kobo-UNCaGED/pull/21
* Don't let restore-wifi-async.sh enable WiFi behind our back when we're
killing it to start Nickel...
* Don't even call ping if there's no default gw
Close: #4997
This PR add support arrow key and mouse scroll wheel for next/previous page.
- Document in page mode:
PageDown, Arrow down, Arrow right - go to next page
PageUp, Arrow up, arrow left - go to prev page
Mouse scroll wheel down - go to next page
Mouse scroll wheel up - go to prev page
- Document in scroll mode:
PageDown, Arrow right - go to next page
PageUp, Arrow, arrow left - go to prev page
Arrow down - scroll document down
Arrow up - scroll document up
Mouse scroll wheel down - scroll document down
Mouse scroll wheel up - scroll document up
Option to show all files in cloudstorage also not supported by KOReader. We can also download any file.
To show all files in CS we need to enable option Show unsupported files in file manager (introducing in #5129)
Close: #5006
* Fix Kindle model detection in some corner-cases
We were (currently) unaffected because we don't support the K1.
Still, this should be slightly more robust.
Provides a bit more granularity than the generic "Ignore all
publisher margins" - and allow the same for paddings for books
that wrongly use paddings for that effect.
Main thumbnails and galleries items will float in "book" and
"web" modes.
Also use a honest User-Agent when requesting Wikipedia to
comply with their policy and avoid rate limitation (and
broken images).
- Updated "Avoid page break" tweaks to work on our latest epub.css.
- Added "New page on headings>" menu, as we no more break page on
H1, H2, H3 in EPUBs.
- Added "Center headings" as we no more have them centered.
- Added "Pure black and white" which can make some documents
more readable.
Adds "Render mode" toggle with 4 modes, to enable some or all
of crengine's new enhanced block rendering features.
Use "legacy" rendering for previously opened books to not mess
with bookmarks, and "web" (all of the new features) for new books.
Also make available the added "HTML5" stylesheet to the Style menu.
* Make toggling Gyro events more robust
Actually ask to turn it on/off depending on the setting, instead of a
blind toggle
A quick succession of suspend/resume events could otherwise leave it
in an unexpected state (i.e., off when it should have been on).
Specifically, how we ignore it.
No longer do anything specific and potentially racy, and let the
unexpected wakeup handler take care of putting us back to sleep.
Also add an option to only ignore wakeup events from the SleepCover.
Re #5098
Re #5087
For some mysterious reason, I have a duplicate default gateway on my
Forma, one with no metrics, and a proper one.
This ensures we pick the proper one.
I'm fairly sure this is temporary insanity on the part of my device,
but, still, it can't hurt.
route -n:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 208 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 208 0 0 eth0
ip r:
default via 192.168.0.1 dev eth0
default via 192.168.0.1 dev eth0 metric 208
192.168.0.0/24 dev eth0 src 192.168.0.49 metric 208
* Make the cover thumbnail respect the cover's AR in the widget
* Add a "Mark as read/unread" button in the FM's longpress menu.
* Make sure the cover_info cache is wiped if necessary (sidecar purge/BookInfo cache clear).
The contained widget may not have integer position/dimen
(which should probably be fixed in those that don't ensure
that), and our maths could eventually make them even more
shifted by fractional parts.
In the end, when closing the widget, the refresh code may
miss painting/cleaning 1px and leave a border of the widget
on the screen.
- Popup footnotes: workaround strange behaviour of MuPDF
which is adding some unwanted margin above elements
with an "id=" attribute.
- In-page footnotes: also remove any left and right margin,
to keep footnotes aligned with the main text.
Also add 2 classnames (witnessed in quite a few recent
french books) to the list of classic classnames.
- Also bump crengine: CSS: fix parsing of multi classnames
and attributes selectors
Either at all, or because it would impose reduced functionality.
Meaning:
* On 4bpp fb, because those are completely unsupported by the C BB
* On 24bpp fb, because it has limited support for that target format (no alpha blending).
* On 8bpp Linux eInk fb with an inverted palette (that's basically only the K4 ;)).
* On Linux eInk devices w/ no HW inversion support, as that would render NightMode inoperable.
That last point means that it's currently *always* blacklisted on PocketBook, because I don't have a PB device, so I don't know how safe HW inversion would be, meaning none of them are marked as being HW invert capable.
(I was a tiny bit hasty with https://github.com/koreader/koreader-base/pull/912 ;).)
Without having to resort to weird custom defaults.
* Split the current margins setting in three:
* Horizontal margins (because you generally want those two to be balanced).
* Top margin & Bottom margin (because you may want to tweak those separately to deal with quirky status bar/final line shenanigans).
* Also, add a "Reclaim bar height from bottom margin" toggle to the status bar menu, to optionally make sure the status bar won't eat into the bottom margin.
* Includes a free fix to diacritics popup refresh handling in the keyboard ;).
on if it's off.
Because, on the KA1, since wetting the warmth *has* to set the
brightness, it could ;).
Patch only actually needed on Kobo, as all Cervantes devices with warmth
support have a mixer, which mean they *can* set the warmth without
affecting the brightness ;).
* Don't override hw_intensity when we start with the FL off
* And add an insane workaround to make the first toggle behave sanely in this case.
* And also handle the sneakier case where the first toggle happening would not be manual, but triggered by a suspend/resume cycle.
* Make hasNaturalLight* caps safe to call without a device check. (fix#4919)
Make it clear that it's expecting the NTX implementation, though.
* Don't turn the FL on on resume if it was off on suspend
* Make sure turnOn/turnOff actually updates hw_intensity in the process where it matters, instead of just in a short lived fork ;). (fix#4923)
Extend the FR and ES keyboards from the EN one, and
just tweak what has to be changed.
This will allow them to stay in sync with the EN keyboard's
recent and futur developments of key popups.
Also make the FR keyboard a bit more AZERTY.
Going with partial ends up being problematic on REAGL devices in a
number of different ways.
On Kindle (at least pre EPDCv2), it's slightly flickery because of the
whitespace and the boldface.
On Kobo, it's slow when anything else tries to queue an update (i.e.,
flashing the chevrons).
Which is a non-issue on the Forma because then it's fast when using
pageturns to navigate, but, still :D.
The obvious downside is we lose the automatic flash after n refresh,
which is potentially annoying on older, non-reagl devices.
It's not really on issue on REAGL devices, especially on EPDCv2.
Eth (ð) is an important letter for people who like Old English (me), and for IPA.
Ď/ď is Czech/Slovak.
Đ/đ is sometimes an alternative rendering of ð, maybe because you could type it on a traditional typewriter. It's also Slavic and something Vietnamese.
Delta is an often-used Greek letter.
Companion PR to https://github.com/koreader/koreader-base/pull/884
* Basically flags devices known to be stable when using PxP inversion.
* Plus, random fix for #4870 ;).
* A few FrontLight tweaks & cleanups on Kobo:
* Moved the Kobo-specific startup status insanity to Kobo-specific init
* Made turnOff/turnOn frontlight do a smooth ramp down/up
* On Kobo, use turnOff/turnOn for suspend/resume, to get that smooth toggle
* On Kobo, for NaturalLight w/ a mixer, only set warmth for setWarmth, and only set Brightness for setBrightness, otherwise, it tried to set both with not in-sync values, which made the FL widget jittery.
Adds configuration to the top corners as well as the additional gestures hold and two-finger tap.
Deprecates `DTAP_ZONE_FLIPPING` and `DTAP_ZONE_BOOKMARK`.
Fixes#4877.
- Removed "Swipe to follow first link on page" menu item and
handling code, as it feels not really as practical as
"Swipe to follow nearest link".
- Removed recently added "External link action", as we can
just always present a popup with the url and the available
actions.
- Generic handling of these actions in onGoToExternalLink(),
so they are proposed on the Wikipedia lookup popup too.
- Allow external link on PDF documents (previously, only
internal links were handled).
- Have "Ignore external links on tap" available on all
document types.
- Added "Ignore external links on swipe" (default to true,
the current behaviour).
- Added multiswipe gesture "Follow nearest internal link"
(the existing "Follow nearest link" now follows the
nearest external or internal link)
- ButtonDialogTitle: added an option to look a bit more
alike ConfirmBoxes.
- Footnote popups: fix link unhighlight when tap on external link.
Otherwise it's:
1. Too small on virtually all devices due to a lack of scaling.
2. Unusably small by default.
It's currently scaled by the callers (dictquicklookup & footnotewidget) based on other properties, but you shouldn't have to change it from the default just to get something usable. ;-)
It was missing some ordering hints to have it always
precede taps to change page.
(Somehow noticed only when we reached > 32 gestures
registered, which may have introduced some shuffling,
while previously the addition order was somehow
preserved...)
Have the code pre-invert some images when in night mode,
so they get inverted back to normal by night mode.
This will allow images to be displayed normally in
the following contexts:
- images in credocument pages
- long-press on images in credocument viewed in ImageViewer
- cover thumbnails in File browser and History
- full size covers when viewed in ImageViewer
- images in Wikipedia lookup results
* Add a toggle to disable the C blitter in the Dev menu (depends on https://github.com/koreader/koreader-base/pull/882) (never shown if the JIT is disabled, grayed out if the C blitter is not installed)
* Fix a few sizeUtf8Text call sites that were doing a nil check in order to account for the new return type.
* Tweak statusbar handling to avoid spurious sizeUtf8Text warnings when it's hidden, and unify its behavior between being hidden via toggle, and hidden on book open (at least when all-at-once is not enabled).
* c.f., https://github.com/koreader/koreader-base/pull/882 (Android, PB, RGB32 & Legacy Kindle regression fixes).
When toggling between scroll and page modes multiple
times, _gotoXPointer() could find the xpointer to be
already positionned and avoid calling setDirty() (so
not enqueuing a whole screen refresh). But the page
will be slightly moved to account for the top margin
disappearing. We need that whole screen refresh in
such cases, so ensure one is enqueued.
I overlooked this until I noticed it on Transifex today.
See https://github.com/koreader/koreader/pull/4791#discussion_r265546245
Also changing the internal name because for something that's only been in one or two nightlies there's no point in prematurely introducing legacy settings.
Code removed from ReaderGesture and put into BookInfo where
it belongs, so we can just use Events.
Also convert description to plain text to not show HTML tags.