Fix context_text extraction to start from XPointer offset
This commit is contained in:
@@ -675,6 +675,11 @@ function Bookhoard:getContextText()
|
|||||||
end
|
end
|
||||||
if not text or text == "" then return "" end
|
if not text or text == "" then return "" end
|
||||||
|
|
||||||
|
local char_offset = tonumber(xp:match("text%(%)%.?(%d+)")) or 0
|
||||||
|
if char_offset > 0 and char_offset < #text then
|
||||||
|
text = text:sub(char_offset + 1)
|
||||||
|
end
|
||||||
|
|
||||||
if #text > 100 then
|
if #text > 100 then
|
||||||
text = text:sub(1, 100)
|
text = text:sub(1, 100)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user