Commit Graph

8669 Commits (7a0e3d5e68e4d119cdd60060a01303380e497c74)
 

Author SHA1 Message Date
Aleksa Sarai 7a0e3d5e68 readerhighlight: remove selected_word and use selected_text everywhere
There were two ways of specifing selected text for a highlight depending
on whether it was a "single word" or text selected using hold-and-pan.
In addition to being a bit more complicated than is necessary, with the
addition of the language support plugin system (where the "single word"
selected might be expanded), it makes more sense to simply use the same
logic and table structure for both cases.

The dictionary lookup special case (hold-without-pan triggering a
dictionary lookup by default) still works as before.

In addition, this patch fixes a minor inefficiency during dictionary
quick lookup -- before this patch, the highlight would be re-selected
because the quick lookup window is run concurrently and tries to fetch
ReaderHighlight.selected_text but this is set to nil immediately after
triggering the lookup. This is unnecessary because :clear() will be
called anyway when the quick pop-up closes, and so clearing this can be
left until then.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai 3ffb4c1692 kopt: add fallbacks for cases where kctx is not in cache
There were a handful of cases where if there was no cached kctx there
was no fallback and several KoptInterface methods would return nil,
causing issues in various parts of KOReader (this happened with the
migration to selected_text everywhere but it's unclear how that change
caused this regression).

In any case, from a correctness perspective it makes sense to have the
corresponding fallback paths to create a new kctx if we couldn't find a
cached one.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai b21029f1ac credocument: update getTextFromXPointers wrapper to support selections
With the latest koreader-base update, we can now create native
selections using getTextFromXPointers. In order to make the wrapper less
annoying to use, always enable segmented selection if selections are
enabled (to match getTextFromPositions).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai a29d24f86d geom: supplement :combine with more generic .boundingBox
It is a bit cleaner to do all of the necessary looping over lists of
Geoms within a straight-forward Geom.boundingBox function rather than
looping over :combine every time (or reimplementing :combine in some
cases). Geom:combine can be trivially reimplemented in terms of
Geom.boundingBox as well.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Aleksa Sarai 6f1b70e5eb util.utf8: improve CJK character detection
Previously the CJK character detection defined only characters in the
range U+4000..U+AFFF as "CJK characters". This excludes an incredibly
large number of CJK characters within the BMP, let alone the whole two
planes dedicated to rarer CJK characters (the SIP and TIP). As a result,
a very large number of Chinese, Japanese, and Korean characters were not
detected as being CJK characters.

While slightly less elegant-looking, it is far more accurate to compute
the codepoint from the utf8 character and then see if it falls within
one of the defined CJK blocks. This is not future-proof against future
CJK ideograph extensions in future Unicode versions, but there is no
real way to accurately predict such changes so this is the best we can
do without accidentally treating characters explicitily defined as being
non-CJK in Unicode as CJK.

While we're at it, copy Lua 5.3's utf8.charpattern constant definition
so that we can more easily write utf8 iterators with string.gmatch (at
least in the interim until there is a rework of utf8 handling in
KOReader and everything is rebuilt on top of utf8proc).

Some unit tests are added for Korean and Japanese text, and the existing
unit tests needed a minor adjustment to handle the fact that
isSplittable now correctly detects CJK punctuation as a character to
compare against the forbidden split rules.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
3 years ago
Frans de Jonge 8e017de898
ReaderSearch: remove stray newline from regex help (#8358)
Noticed due to #8356.
3 years ago
Mike Kozlowski 2cd4d09db4
Add initial support for Kobo Sage (Cadmus) (#8361) 3 years ago
poire-z dade71d3c3
bump crengine: upstream sync, page splitting fix (#8360)
- Update German hyphenation patterns
- (Upstream) zip64 support: fixes and enhancements
- Page splitting: fix footnotes possibly delayed too long
3 years ago
NiLuJe 304e128031 Bump android-luajit-launcher
https://github.com/koreader/android-luajit-launcher/pull/336
3 years ago
NiLuJe c10597bcb0 Bump base
https://github.com/koreader/koreader-base/pull/1413
https://github.com/koreader/koreader-base/pull/1415
https://github.com/koreader/koreader-base/pull/1417
https://github.com/koreader/koreader-base/pull/1419
https://github.com/koreader/koreader-base/pull/1420
https://github.com/koreader/koreader-base/pull/1418
https://github.com/koreader/koreader-base/pull/1421
3 years ago
NiLuJe 942ea70235 ProgressWidget: Simplify painting logic.
* Use paintRect and plain colors instead of lightenRect and a weird
  dimming factor.
* Update call sites to the new API
* Handle FP maths properly (i.e., floor coordinates & ceil dimensions at
  the latest possible time).
* Fix border handling in the fill bar (make sure we actually honor it
  when computin the x position, and that we won't overflow into it when
  computing the width).
* Update docs
3 years ago
NiLuJe b996b8282f ReaderRolling: Unbreak CRe spinner on e-Ink
Regression since #8195, but the fact that it sometimes worked before
that was already a fluke ;).

c.f., https://github.com/koreader/koreader/pull/5406#issuecomment-948632160
3 years ago
hius07 22a012e729
[chore] RadioButtonWidget: remove unused "Use default" string (#8354) 3 years ago
poire-z 37eb53f6e4
DocSettings/Purge .sdr: reword, don't purge other books (#8348)
Reword "Purge .sdr" to "Reset settings".
When purging, remove only the known document metadata
files, and not those for a document with the same name but
a different suffix.
3 years ago
hius07 2c6943e5d6
FileManager: no notification on successful file operations (#8330) 3 years ago
zwim 09725e518a
Autowarmth: wording, move expert-mode menu entry down (#8350) 3 years ago
yparitcher 61d02923e9
Dispatcher: fix horizontal margins (#8344)
Regression from #8287
3 years ago
zwim 6492583e96
Autowarmth: wording, help_text, menu tweaks (#8338) 3 years ago
hius07 d652eec2cd
ReaderHighlight: allow updating a highlight drawing style (#8323)
Also modify highlight dialog's "Edit" button to be "Add note"
or "Edit note" whether a note has already beed added.
Adds a new RadioButtonWidget.
3 years ago
hius07 f0b992d425
Bookmarks: new settings and tweaks (#8301)
Bookmarks list:
- page numbers are displayed
- page bookmarks are marked with a star
- new setting: Sort by largest page number (default: checked)
New bookmark setting: Add page number / timestamp to bookmark
- If enabled (default), bookmark name is 'Page # notes @ time'.
- If disabled, bookmark name is equal to the notes field.
Rename bookmark dialog:
- page number and timestamp are displayed in the input
  dialog description
- blank input renames bookmark to the default name in
  accordance with the new setting
Also fix: changing boundaries of the highlight: the name of the
highlight is not changed if it was previously edited by the user.
3 years ago
hius07 fd697f3c77
wbuilder: use correct call for BookStatus widget (#8342)
Correction required after #8318.
3 years ago
hius07 7036500f5b
Menu widget: adapt font size of shrunken items (#8340) 3 years ago
hius07 4ffabcf087
Screensaver: correct call of BookStatusWidget 3 years ago
ElimGarak1 863255c9f4
Add PocketBook InkPad Lite (PB970) (#8335)
Closes #8331.
3 years ago
Frans de Jonge 91b921505c
Update translations for 2021.10 (#8334) 3 years ago
poire-z ca1c3484d8
DictQuickLookup: two minor fixes (#8333)
- Allow Wikipedia languages cycling when invoked
  from File browser.
- Fix TextBoxWidget content not updated when next/prev
  when use_xtext=false.
3 years ago
yparitcher 1c2e5eee1d
BookStatusWidget: fix status toggle (#8329)
Fix:  #8324

cf: #7671
3 years ago
ichnilatis-gr a1e0d87c62
Greek keyboard: minor updates (#8319)
New popup menu on the Greek acute key for Greek numeral signs.
3 years ago
git-help-eng 0d231cbbef
Footer: maybe shouldn't be visible on resume (#8289) 3 years ago
poire-z ade89cb9b6
Adds ScrollableContainer, to be used with tall widgets (#8299)
And use it with KeyboardLayoutDialog.
3 years ago
yparitcher 8c29b71e45
Tests: emptydir switch from data/dict to history (#8296)
So this test doesn't fail when one has dictionaries locally
(history folder is deprecated and should be empty).
3 years ago
hius07 b2a7d0d5ce
BookStatusWidget: use correct read percentage (#8318)
Closes #8317.
3 years ago
ichnilatis-gr 23be2f278c
[UX] Keyboard: Fix Greek Y popup (#8308)
Correction of the "Υ" popup, where instead of Greek upsilon (as was written) there was the Greek capital tau ("Τ").
3 years ago
Frans de Jonge d8d0066ac0
[CI] Fix certificate issue with quick koreader/koappimage:0.1.8 (#8305)
See https://github.com/koreader/virdevenv/pull/69 for details
3 years ago
yparitcher feab232f35 Kopt: keep 4 items per panel
move newly enabled auto straighten from settings to crop
3 years ago
yparitcher 4c0d11c6d9 Dispatcher: use absolutenumber in more places 3 years ago
yparitcher 888802f618 kopt: allow pdf auto straighten 3 years ago
NiLuJe 75706ca0be
TextBoxWidget: Unbreak Wikipedia (bis) (#8298)
re: https://github.com/koreader/koreader/pull/8275#issuecomment-933744596
3 years ago
zwim 6b5cf63d07
Autowarmth: fix info text alignment issues (#8271) 3 years ago
ichnilatis-gr e4337d1306
Greek keyboard: minor updates (#8292)
Adds Greek semicolon (upper dot) to the dot pop-up menu.
3 years ago
ichnilatis-gr c6b3d5d3a5
Greek keyboard: minor updates (#8291)
Adds Greek semicolon (upper dot) to the dot pop-up menu.
3 years ago
zwim cde13360ae
Fix bug when leaving/entering FM/reader (#8295)
This should fix #8293
3 years ago
hius07 3fe09ecc01
CenterContainer: options to handle larger content (#8277) 3 years ago
hius07 4c9d1ac3f8
Spinwidgets: can now get width or width_factor (#8269) 3 years ago
hius07 2b87b1d8ed
Virtualkeyboard: allow grey'ing the legacy umlaut mode key (#8276)
This key is still available on non-updated keyboard layouts.
3 years ago
Galunid d4628666c9
Statistics: Read page duration limits: allow min=0s (#8273)
Allow for always counting page as read, regardless of time spent.
3 years ago
NiLuJe 0ea8bee4e1
TextBoxWidget: Unbreak Wikipedia (#8275)
Turns out we can't release line_num_to_image early, so, delay it until the final, full widget teardown.

(Regression since #8250, c.f., https://github.com/koreader/koreader/pull/8250#discussion_r716646211)
3 years ago
Frans de Jonge a21b5be64a
[chore] NewsDownloader: various minor string fixes (#8268)
Follow-up to <https://github.com/koreader/koreader/pull/8267>.
3 years ago
Frans de Jonge e865fb9114
[chore] NewsDownloader: remove stray space (#8267) 3 years ago
zwim 2dfbf56624
Autowarmth: Make Information in easy mode more beautiful (#8264) 3 years ago