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>.
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
- 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
* 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.
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.
Bump crengine:
- Ensure text decoration (underline) is continued over word gaps
- Invalidate TOC page numbers on rendering change
- Ensure reproducible cache files when same rendering settings
- LVBlockWriteStream: workaround to exclude fatal error
- Use utf8proc for string uppercase/lowercase/capitalize
Bump base:
Thirdparty: adds utf8proc 2.3.0 (libutf8proc.so.2)
For use by crengine, for now mostly for more complete and
accurate text-transform: uppercase/lowercase/capitalize.
Also revert test tweak (in 27ddd6f) to workaround an issue with
cre cache that should be solved by this crengine bump.
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 ;).
Some combination of Travis and/or older Busted necessitated insufficient insulation.
Follow-up to https://github.com/koreader/koreader/pull/4970
Space condensing carried over; reset at the start of readertoc.
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.
Updated for https://github.com/koreader/koreader/pull/4691
Also the assert.is_same() argument order was wrong.
The first argument is expected, the second the real-life result.
Otherwise the error message in case of failure is misleading.
* On Kobo, kill WiFi on startup if we detect an inconsistent state...
Untested, not terribly pretty.
The other solution is to slow down the Wi-Fi meny by doing the same
check for the "Wi-Fi connection" checkbox as in the later wifi_status
one...
* Don't enable auto_restore_wifi by default
It's liable to silently murder batteries for no good reason, given that
we prompt to enable WiFi by default when needed, and we otherwise have
no actual need to keep WiFi on in the background.
re #2215 (in particular, this directly contradicts @houqp in
https://github.com/koreader/koreader/pull/2215#discussion_r74696133 ;)).
Includes:
- Update french hyphenation pattern
- epub.css: update style for 'blockquote'
- DrawBuf: count nb of images and surface drawn
Adds Document:getDrawnImagesStatistics() to help deciding
if refresh with (possibly costly) dithering should be used
(on devices with HW dithering capabilities) with CreDocument:
when a page contains enough images to benefit from it.
* Fix the Touch input probe on Trilogy devices that depend on the touch_probe_ev_epoch_time quirk (fix#630)
* Expose a "Pageturn button inversion" feature in the Navigation menu (for all devices with keys) (fix#4446)
* Allow ignoring the accelerometer on the Forma (Screen > Ignore accelerometer rotation events; also available from the Gesture Manager) (fix#4451)
* Fix SleepCover handling on the Forma (fix#4457)
* Make isWifiOn a tiny bit more accurate (check the actual WiFi module instead of sdio_wifi_pwr)
* Move all flash related Screen options to the eInk submenu
Update translator.lua to use a still working google translate API.
Add a method to show translations (main and alternates) in
a TextViewer.
Re-enable "Translate" button in text selection/highlight buttons
dialog.
Target language can be set with a manually added setting:
translator_target_language = "fr"
and will fallback to the UI language.
By adding a `sorting_hint` to a menu item, the program will put orphaned items in the relevant (sub)menu instead of in the first menu with a NEW prefix.
Fixes#4393.
* Implement isWifiOn on Kindle (fix#4380)
* Ensure frontlight intensity is properly restored on resume on Kindle. (fix #Fix #4392)
Only actually matters when the frontlight is *off*.
Includes:
- (Upstream) Fix dangerous compile warnings
- Fix max image height to prevent spurious page breaks
- Hide <epub:case> in <epub:switch>, show only <epub:default>
Adds a style tweak to show <epub:case> and hide <epub:default>
for the curious person.
bump crengine, which includes:
- Adds support for symbol fonts (local or embedded)
- Fix some issues when rendering text in constrained width
- Page splitting: fix possible missing blocks
- CSS: adds support for 'auto', ignore % for borders
- Fix right border drawing position
- Fix: adds missing properties in copystyle()
- Adds comments, erm_killed rendering method
- Adds getRenderedWidths(): get node min/max node content width
- Tables rendering: fixes and improvements
- getRenderedWidths: enable min_width to be a single CJK char
- Fix wrong text wrap avoid in some case
- epub.css: add style for 'blockquote'
- Fix rendering issue when line ends with an image
Adds a few style tweaks related to tables.
Enforce table width: 100% in Wikipedia EPUBs to keep
previous look, which feels better with the various kinds
of tables in Wikipedia pages.
Fix unit tests as juliet.epub (full of blockquotes), grew quite
a few pages with the epub.css update.
Follow up to fa0117bb (#4268), to make things a bit clearer:
Only ReaderRolling get the 'SetStatusLine' event, and tells
crengine about the change, and then send the 'UpdatePos' event.
ReaderFooter now just gets a :setVisible() method.
Now, all the code that calls a self.ui.document:set* method, that
most probably triggers a full re-rendering by crengine, do signal
'UpdatePos' immediately after. This event signals that all page
number, pages count, positions... are no more valid and must be
queried or computed again.
This could also be used if we ever want to cache Page Links or
Screen Boxes: this event will have us dropped these caches.
Default setting set by holding on the bottom config buttons
for "View mode" (scroll/page) and "Progress bar" (full/mini)
were not used.
Also, when switching Progress bar from 'full' to 'mini',
show the mini bar again.
It was enabled by default, but it's mostly only needed for CJK users.
Furthermore, when floating punctuation is enabled, some rendering
issues exist (text right alignment, variable margins...) that
only CJK developpers could really fix. So, best to disable it and
avoid these rendering issues for most users.
Also: fix CoverBrowser crash when "Delete cache database"
followed by "Prune cache of removed books".
* With a bonus version normalizer fix.
* And a zsync bump/fix to avoid softlocks with OpenStack HTTP frontends (also, pull those from the OTA mirror list).
Use epub.css as the main default style, with all file formats
except FB2 (which needs fb2.css).
(epub.css has been cleaned recently to be more conforming to HTML
specs and to not include class name based styles - with conditional
compatiblity styles for previously opened documents. It should be
usable on all HTML based documents, except FB2 which has some
incompatible specs.)
Consider all shipped css files other than "epub.css" and "fb2.css"
obsolete, and put them in a sub-menu (these other css files have
not been updated in the same way, and are kept as-is for when a
previously opened document requests one of them).
Add an icon indicating which style is set as default (like it's
been done for the Font and Style tweaks menus).
Also set the font size of the full status bar (available with
cre documents) when the setting "cre_header_status_font_size"
is present in settings.reader.lua (to add manually).
* Trim unneeded stuff from startup script
I was somehow convinced I'd already done that...
While we're there, explain why we need to siphon those specific vars
* Fix a stray eth0
-> $INTERFACE
* Be very very sure we have INTERFACE set in our env
re #3936
* Make getFirmwareVersion less fragile on Kobo
Not that we actually use it right now, but, still. :D
* Use the same syntax as the PRODUCT check
* Actually implement getProductId
Instead of a stray c/p ^^
* Properly identify the Rev2/Mark7 variants of existing devices
Namely, the H2O² and Aura SE
Not that the H2O²r2 support is still broken, this just allows us to
implement it cleanyl without breaking handling of the original H2O²
re #3925
* Tweak sleeps a bit around Kobo WiFi modules...
See if that jog things up (re #3936)
* Try harder not to suspend with WiFi on on Kobos
Because otherwise, things go boom. (re #3936)
Includes:
- Fix a few CSS selector issues
- CSS: add support for some pseudo-classes
- Hyphenation: update fr & de patterns
- CSS: Fix non-lowercasing of specific elements names
- Revert parts of recent BR handling fixes
Includes:
- [build] FreeType: bump to 2.9.1
- [build] bump libjpeg-turbo to 1.5.3
- bump crengine:
- Fix CSS selector specificity computation
- [fix] crengine/src/lvfntman.cpp: improve letter_spacing limit
- [fix] crengine/src/lvxml.cpp: add all empty HTML elements
- html head styles: fix styles not being applied
- Hyphenation: increase MAX_PATTERN_SIZE from 16 to 35
- html documents: proper handling of <BR> tags
- Allows requesting old (broken) XML/DOM building code
- cre.cpp: setStyleSheet(): accept filepath and/or css text,
and added getIntProperty() and getStringProperty()
credocument/readerrolling: request older XML/DOM building code
for books previously opened, to not lose bookmarks and highlights
(unit tests update because of new handling of consecutive BR via css
pushed links down in the book)
Use a setting 'copt_overlap_lines' (default to 1) for the
number of text lines from previous page to show on next
page (instead of a hardcoded and unscaled 20).
Take footer height into account for overlap calculation
and dim area.
Show overlap only when changing pages (not when panning).
Also fix ReaderFooter:getHeight() which was returning
a higher height than the real one since footer refactoring.
This implements a reasonable facsimile of going back on Android.
The back button first goes back in a history of visited pages.
When there's no history left, it closes the app.
Fixes#3816.
Fix various inconsitencies: some occurences not highlighted
on displayed page; different occurences highlighted on same
page wheter we went there searching backward or forward; pages
with occurences simply just skipped when searching in one
direction, and not in the other...
To avoid edge cases, crengine will now give back results on up
to 3 pages, that we need to filter.
Bump base and crengine
* junit test results; unfortunately this seems to conflict with the verbose out
* fix deps cache: two files can change independently
* verbose print obsoleted by gtest in upsream busted
I believe this should be `if isKobo()`, or better yet that the entire
block should be moved to `KoboPowerD:init()` because afaik that is the
only platform where the system doesn't provide trustworthy frontlight
information. But to be absolutely sure that I don't break anything (and I
don't want to spend any time on this atm) I'm temporarily excluding only
Android where this behavior is known to be problematic.
See discussion in https://github.com/koreader/koreader/issues/3118#issuecomment-334995879
References #3118 (using keyword "references" because phrases like "possibly fixes"
result in GH autoclose).
This patch should resolve issue #2257 (Footer hides text)
Sometimes, depending on an epub style, some text is hidden by the progress bar (the mini one at the bottom).
1. Android.getScreenBrightness() is used in frontend/device/android/powerd.lua to retrieve the frontlight intensity.
2. kosync.koplugin won't save settings for whisper sync.
3. batterstat.koplugin won't work correctly if several on* events are fired.
* Use getCapacityHW() to ensure latest battery capacity can be retrieved
* BackgroundRunner
* Start background_runner_spec.lua
* AutofrontLight plugin now uses BackgroundRunner plugin
- Factored out duplicate code from filemanager.lua and filemanagerhistory.lua
to new filemanagerbookinfo.lua (and other common code to filemanagerutil.lua).
- Uses sidecar files' new doc_props and doc_pages settings, or fallback to
old 'stats' settings, or to opening document.
- Shows filename, filetype and directory.
- Shows description (Hold to see whole truncated text), keywords, and
cover image (tap to extract image from document and display it if available).
- Book information now available from reader menu, to display info about
the currently opened book.
- Convert possibly HTML description to plain text via added
util.htmlToPlainTextIfHtml() (for simple HTML conversion).
* crengine: return description and keywords metadata
Only available for EPUB documents for now. @poire-z
* crengine: css related improvements, fix crash, better handling of gif @frankyifei
* Force refresh when kindle is out of screensaver or usb is unpluged.
* Improve AutoFrontlight
* More plugins sub menu
* Last brightness should always be updated
* Finish autofrontlight improvement and enable it by default.
* More tets
* onFlushSettings
* MenuSorter can now correctly sort sub menus
* translation text fix
* quickstart(fix): go back to home dir after document close
* quickstart(fix): purge old quick start files
* spec: fix quickstart tests
* Swipe for menu and quickstart guide
Because swiping for the menu is a big change from what we're used to, this commit includes a new quickstart guide.
Fixes#2608.
* add some dev docs
* add FileConverter spec
* add QuickStart spec
* add Version module
* add Version spec
I think it sounds more natural as chapter than as table of content, which is an implementation detail (i.e., the chapter markers are shown based on what's in the TOC).
Also removed redundant "this" from "Remaining pages in this chapter"
MenuSorter: forgot to add plugin style change
MenuSorter: worked out the final quirks
* Menu always compressed into tables without missing indexes for ipairs compatibility
* Orphans attached
* Separators no longer count as items
Also fix touch zone dependency graph generation code.
ReaderHighlight has now been migrated to use touch zone
Inputcontainer's touch event handling logic changed to only stop
propagation when handler returns `true`. Previously, it stops
propagation when a handler is found. This is needed to support
both readerhighlight_tap and tap_forward touch zones.
util.isSplitable() accepts now also the previous char to help
decide if a space can be used to split a line.
TextBoxWidget:_splitCharWidthList() : simplified logic
util: made isSplitable() accept an optional next_char
for wiser decision
textboxwidget: speed up rendering, enhanced text wrapping,
allow selection of multiple words with Hold.
scrolltextwidget: allow scrolling with Tap.
Details in #2393
Touch zone decouples screen size from gesture event registration.
The win here is each individual widget does not need to update
gesture range on screen rotate/resize anymore.
Another advantage is we now have a centralized ordered array to handle
all registered touch event listeners, makes it much easier to resolve
gesture range conflicts between multiple widgets.
This patch also includes the following changes:
* migrate readerpaging to use readerui's touch zone
* migrate readerfooter to use readerui's touch zone
* move inverse read direction setting to touch menu's setting tab
* moved kobolight widget from readerview into readerui
* various dead code cleanups and comments