From ec64e1f5d7b69c0496c1d151884ac5556212eb55 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 31 May 2026 20:55:27 -0400 Subject: [PATCH] Fix context_text extraction to start from XPointer offset --- main.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.lua b/main.lua index aff42ae..b7cde09 100644 --- a/main.lua +++ b/main.lua @@ -675,6 +675,11 @@ function Bookhoard:getContextText() 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 text = text:sub(1, 100) end