Skip to content

Commit

Permalink
DictQuickLookup: Properly scroll back to top when updating a
Browse files Browse the repository at this point in the history
ScrollTextWidget

Despite a similar API between ScrollTextWidget and ScrollHtmlWiget, what
they do internally doesn't quite match.

So, while ScrollHtmlWidget's resetSCroll *does* rewind back to the top,
ScrollTextWidget's doesn't, it just updates the scrollbar itself.
So, do that on our end, *before* the (re-)init, which'll call
_renderText for us.

Fix koreader#7318
  • Loading branch information
NiLuJe committed Feb 20, 2021
1 parent a6a74b6 commit 56f60f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/ui/widget/dictquicklookup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,11 @@ function DictQuickLookup:update()
self.text_widget.text_widget.lang = self.lang and self.lang:lower()
self.text_widget.text_widget.para_direction_rtl = self.rtl_lang
self.text_widget.text_widget.images = self.images
-- Scroll back to the top, àla TextBoxWidget:scrollToTop
self.text_widget.text_widget.virtual_line_num = 1
-- NOTE: The recursive free via our WidgetContainer (self[1]) above already free'd us ;)
self.text_widget.text_widget:init()
-- Scroll back to top
-- Reset the scrollbar's state
self.text_widget:resetScroll()
else
-- We jumped from HTML to Text (or vice-versa), we need a new widget instance
Expand Down

0 comments on commit 56f60f8

Please sign in to comment.