don't reset scroll pos when window is resized or moved

develop
Myk Taylor 2023-01-15 15:59:09 -08:00
parent b855170c64
commit 20f865eba0
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## New Plugins
## Fixes
- ``widgets.WrappedLabel``: no longer resets scroll position when window is moved or resized
## Misc Improvements
- Scrollable widgets now react to mouse wheel events when the mouse is over the widget

@ -1366,6 +1366,10 @@ function WrappedLabel:getWrappedText(width)
return text_to_wrap:wrap(width - self.indent)
end
function WrappedLabel:preUpdateLayout()
self.saved_start_line_num = self.start_line_num
end
-- we can't set the text in init() since we may not yet have a frame that we
-- can get wrapping bounds from.
function WrappedLabel:postComputeFrame()
@ -1378,6 +1382,7 @@ function WrappedLabel:postComputeFrame()
table.insert(text, NEWLINE)
end
self:setText(text)
self:scroll(self.saved_start_line_num - 1)
end
------------------