From fd54ddbd8f1aabcef1cc0adf3d8477fe84149cdb Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 7 Dec 2025 18:48:23 +0100 Subject: [PATCH] TextBoxWidget: clear highlights when hold release on an image Otherwise, any highlight made while panning would stick even after we show and close ImageViewer, even when turning pages. --- frontend/ui/widget/textboxwidget.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/ui/widget/textboxwidget.lua b/frontend/ui/widget/textboxwidget.lua index b88c8bddb..51855bf7d 100644 --- a/frontend/ui/widget/textboxwidget.lua +++ b/frontend/ui/widget/textboxwidget.lua @@ -2060,6 +2060,11 @@ function TextBoxWidget:onHoldReleaseText(callback, ges) if self.line_num_to_image and self.line_num_to_image[self.virtual_line_num] then local image = self.line_num_to_image[self.virtual_line_num] if self.hold_end_pos.x > self.width - image.width and self.hold_end_pos.y < image.height then + -- :onHoldStartText() and :onHoldPanText() do not check if on an image, + -- so we may have gotten some text selected: clear any. + if self:clearHighlight() then + self:redrawHighlight() + end -- Only if low-res image is loaded, so we have something to display -- if high-res loading is not implemented or if its loading fails if image.bb then