Text highlighting: extend to include punctuations

When selected text seems to be a "sentence segment"
(that is, when there are punctuations around start
AND end), extend the selection to include the relevant
punctuation.
Do this only when saving highlights and for translation
(but not when dict or wikipedia lookups, or search).
This commit is contained in:
poire-z committed 2022-06-11 20:58:52 +02:00
1 parent 141fa98a32
commit b9724f1e93
2 files changed
+23 -5

No files matched your search

+4
View File
@@ -835,6 +835,10 @@ function CreDocument:getTextFromXPointers(pos0, pos1, draw_selection)
return self._document:getTextFromXPointers(pos0, pos1, draw_selection, draw_segmented_selection)
end
function CreDocument:extendXPointersToSentenceSegment(pos0, pos1)
return self._document:extendXPointersToSentenceSegment(pos0, pos1)
end
function CreDocument:getHTMLFromXPointer(xp, flags, from_final_parent)
if xp then
return self._document:getHTMLFromXPointer(xp, flags, from_final_parent)