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
2022-06-11 11:08:40 +02:00
parent 141fa98a32
commit b9724f1e93
2 changed files with 23 additions and 5 deletions

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)