Highlighting/lookup: avoid getting stuck when nothing selected
Fixes 2 cases where we could get stuck in an exepected state: - if onHold would get us nothing to act on, we would stay stuck in "hold" state (until a next hold) and taps for page turn would not work - if text selection would get us some text (ie. some punctuation) that would be stripped to an empty string, we would just not do the lookup, but the selection would stay: best to do that lookup and get a "no result" window, that when closed would do the normal cleanup.
This commit is contained in:
1 parent
61f4542b6b
commit
148449df6a
2 files changed
+11
-4
No files matched your search
@@ -1812,6 +1812,13 @@ function ReaderHighlight:onHold(arg, ges)
|
||||
end
|
||||
return true
|
||||
end
|
||||
-- It has happened it failed because the text range was detected on the
|
||||
-- previous page and highlighted by crengine, but no word was returned
|
||||
-- (because the boxes were not on the current page).
|
||||
-- Be sure we clear any such selection
|
||||
self.ui.document:clearSelection()
|
||||
-- And that we don't get stuck in a hold state
|
||||
self.hold_pos = nil
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user