summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-04-21 13:45:43 +0200
committerJoe Wilm <jwilm@users.noreply.github.com>2018-04-24 10:01:33 -0700
commit88305677f520f5884297e594ff2469cb948c7bef (patch)
treec928d0b7d3eb7f0f6940d4ef2ee3e05169c9d5d4
parent2b3ef5f6644fcefe595a52846744662bd99c2f6d (diff)
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.
-rw-r--r--src/grid/mod.rs26
1 files changed, 14 insertions, 12 deletions
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<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
}
}