QRClipboard main: fix extending highlight to sentence (#15431)

This commit is contained in:
hius07 authored and GitHub committed 2026-05-21 18:51:39 +03:00
1 parent 621dff830b
commit 676b26fc4c
1 file changed
+6 -2
+6 -2
View File
@@ -34,8 +34,12 @@ function QRClipboard:addToHighlightDialog()
-- 'this' is self.ui.highlight. Do as ReaderHighlight:saveHighlight() does.
this:highlightFromHoldPos()
if not (this.selected_text and this.selected_text.pos0 and this.selected_text.pos1) then return end
local text = this.ui.rolling
and this.document:extendXPointersToSentenceSegment(this.selected_text.pos0, this.selected_text.pos1)
local text
if this.ui.rolling then
local extended_text =
this.document:extendXPointersToSentenceSegment(this.selected_text.pos0, this.selected_text.pos1)
text = extended_text and extended_text.text
end
text = util.cleanupSelectedText(text or this.selected_text.text)
if Device:hasClipboard() then -- let the text to be reused via menu
Device.input.setClipboardText(text)