browser: fix issue with page pad after search

Used to jump to far and left artifacts.
This commit is contained in:
dece 2021-06-04 19:00:13 +02:00
parent 7372dc85a9
commit ee37865e70
2 changed files with 7 additions and 2 deletions

View file

@ -842,7 +842,8 @@ class Browser:
return
self.set_status(f"Result {index}/{max_index}")
self.page_pad.current_line = next_line
max_line = self.page_pad.get_max_line(self.h)
self.page_pad.current_line = min(next_line, max_line)
self.refresh_windows()
def load_plugins(self):

View file

@ -96,7 +96,7 @@ class PagePad:
def go_to_end(self, window_height):
"""Make the pad show its bottom; return True if a refresh is needed."""
max_line = self.dim[0] - window_height
max_line = self.get_max_line(window_height)
if self.current_line != max_line:
self.current_line = max_line
return True
@ -108,3 +108,7 @@ class PagePad:
self.current_column = 0
return True
return False
def get_max_line(self, window_height):
"""Return the max line that can be used as current_line."""
return self.dim[0] - window_height