From bfa926555145f9f578430b87bc1c1b72ef80589f Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sat, 21 Apr 2018 13:45:43 +0200 Subject: Fix bright characters in first column This bug was introduced by the commit which fixed the invisible cursor in the first column (54b21b66ecc6f8f149d1425567e0e3d766a3ac54). To resolve this the alternative implementation by @jwilm has been applied which seems to work out. This fixes #1259. --- src/grid/mod.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/grid/mod.rs b/src/grid/mod.rs index c05584c4..313973a3 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -745,27 +745,29 @@ impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> { #[inline] fn next(&mut self) -> Option { - // Make sure indices are valid. Return None if we've reached the end. - if self.col == self.grid.num_cols() { - if self.offset == self.limit { - return None; - } - - // Switch to the next line - self.col = Column(0); - - self.offset -= 1; - self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit)); + // Return None if we've reached the end. + if self.offset == self.limit && self.grid.num_cols() == self.col { + return None; } - // Return the next item + // Get the next item. let item = Some(Indexed { inner: self.grid.raw[self.offset][self.col], line: self.line, column: self.col }); + // Update line/col to point to next item self.col += 1; + if self.col == self.grid.num_cols() { + if self.offset != self.limit { + self.offset -= 1; + + self.col = Column(0); + self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit)); + } + } + item } } -- cgit