scroll_to_separator now scrolls to the top if there’s no separator.

This commit is contained in:
Florent Le Coz 2013-01-29 07:57:48 +01:00
parent 13b5ab4b65
commit e0136e785a

View file

@ -793,13 +793,15 @@ class TextWin(Win):
self.pos = len(self.built_lines) - self.built_lines.index(None) - self.height + 1 self.pos = len(self.built_lines) - self.built_lines.index(None) - self.height + 1
if self.pos < 0: if self.pos < 0:
self.pos = 0 self.pos = 0
# Chose a proper position (not too high) else:
self.scroll_up(0) self.pos = len(self.built_lines) - self.height + 1
# Make “next highlight” work afterwards. This makes it easy to # Chose a proper position (not too high)
# review all the highlights since the separator was placed, in self.scroll_up(0)
# the correct order. # Make “next highlight” work afterwards. This makes it easy to
self.hl_pos = len(self.highlights) - self.nb_of_highlights_after_separator - 1 # review all the highlights since the separator was placed, in
log.debug("self.hl_pos = %s" % self.hl_pos) # the correct order.
self.hl_pos = len(self.highlights) - self.nb_of_highlights_after_separator - 1
log.debug("self.hl_pos = %s" % self.hl_pos)
def remove_line_separator(self): def remove_line_separator(self):
""" """