Fix a few things after #7166 (#7212)

* Switching between HTML/text dicts (Fix #7209)
* Updating the scrollbar and scroll state properly when switching dicts
* Highlights in SortWidget
* Highlights in the Dictionary Download page
* Minor simplification of the tail end of the update process in ImageViewer
This commit is contained in:
NiLuJe
2021-01-31 02:51:40 +01:00
committed by GitHub
parent 3118d0dba0
commit a38881a9f7
6 changed files with 163 additions and 141 deletions

View File

@@ -159,6 +159,17 @@ function ScrollTextWidget:updateScrollBar(is_partial)
end
end
-- Reset the scrolling *state* to the top of the document, but don't actually re-render/refresh anything.
-- (Useful when replacing a Scroll*Widget during an update call, c.f., DictQuickLookup).
function ScrollTextWidget:resetScroll()
local low, high = self.text_widget:getVisibleHeightRatios()
self.v_scroll_bar:set(low, high)
local visible_line_count = self.text_widget:getVisLineCount()
local total_line_count = self.text_widget:getAllLineCount()
self.v_scroll_bar.enable = visible_line_count < total_line_count
end
function ScrollTextWidget:moveCursorToCharPos(charpos)
self.text_widget:moveCursorToCharPos(charpos)
self:updateScrollBar()