diff options
author | mathieui <mathieui@mathieui.net> | 2014-05-01 02:28:01 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-05-01 02:28:01 +0200 |
commit | c287a959b424efbff3817352d33f0a12e9eacdfb (patch) | |
tree | e661a196738c1a40bde7cf8f4e80a70e7651c61f /src | |
parent | 48e59d377fc03feb1203c6a02d7e6424a533be62 (diff) | |
download | poezio-c287a959b424efbff3817352d33f0a12e9eacdfb.tar.gz poezio-c287a959b424efbff3817352d33f0a12e9eacdfb.tar.bz2 poezio-c287a959b424efbff3817352d33f0a12e9eacdfb.tar.xz poezio-c287a959b424efbff3817352d33f0a12e9eacdfb.zip |
Fix bugs in the previous/next highlight functions
Diffstat (limited to 'src')
-rw-r--r-- | src/windows.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/windows.py b/src/windows.py index 3087c786..5500059a 100644 --- a/src/windows.py +++ b/src/windows.py @@ -767,8 +767,8 @@ class TextWin(Win): highlights, scroll to the end of the buffer. """ log.debug('Going to the next highlight…') - if not self.highlights or self.hl_pos != self.hl_pos or \ - self.hl_pos == len(self.highlights)-1: + if (not self.highlights or self.hl_pos != self.hl_pos or + self.hl_pos >= len(self.highlights) - 1): self.hl_pos = float('nan') self.pos = 0 return @@ -789,6 +789,7 @@ class TextWin(Win): self.hl_pos = float('nan') self.pos = 0 return + self.hl_pos = 0 hl = self.highlights[0] self.pos = len(self.built_lines) - pos - self.height if self.pos < 0 or self.pos >= len(self.built_lines): @@ -808,7 +809,7 @@ class TextWin(Win): return if self.hl_pos != self.hl_pos: self.hl_pos = len(self.highlights) - 1 - elif self.hl_pos > 0: + else: self.hl_pos -= 1 log.debug("self.hl_pos = %s", self.hl_pos) hl = self.highlights[self.hl_pos] @@ -822,6 +823,7 @@ class TextWin(Win): self.hl_pos = float('nan') self.pos = 0 return + self.hl_pos = 0 hl = self.highlights[0] self.pos = len(self.built_lines) - pos - self.height if self.pos < 0 or self.pos >= len(self.built_lines): |