Clean up some scrolling and resizing in help-browser

This commit is contained in:
Kevin Lange 2017-01-10 17:00:03 +09:00
parent 89f9e9a85c
commit a4e9fc0123

View File

@ -162,6 +162,10 @@ You can also <link target=\"special:contents\">check the Table of Contents</link
def finish_resize(self, msg):
"""Accept a resize."""
if msg.width < 100 or msg.height < 100:
self.resize_offer(max(msg.width,100),max(msg.height,100))
return
self.resize_accept(msg.width, msg.height)
self.reinit()
self.size_changed = True
@ -179,6 +183,12 @@ You can also <link target=\"special:contents\">check the Table of Contents</link
self.scroll_offset -= 1
self.text_offset += self.tr.line_height
while self.text_offset >= self.tr.line_height:
n = (len(self.tr.lines)-self.tr.visible_lines())+4
n = n if n >= 0 else 0
if self.scroll_offset >= n:
self.scroll_offset = n
self.text_offset = 0
break
self.scroll_offset += 1
self.text_offset -= self.tr.line_height
self.update_text_buffer()