Fix bright characters in first column

This bug was introduced by the commit which fixed the invisible cursor
in the first column (54b21b66ec). To
resolve this the alternative implementation by @jwilm has been applied
which seems to work out.

This fixes #1259.
This commit is contained in:
Christian Duerr 2018-04-21 13:45:43 +02:00 committed by Joe Wilm
parent 4df09128ce
commit bfa9265551
1 changed files with 14 additions and 12 deletions

View File

@ -745,27 +745,29 @@ impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> {
#[inline]
fn next(&mut self) -> Option<Self::Item> {
// 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
}
}