mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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>