Fix cursor not showing in first column
There was a bug in the display iterator where the first column was never reached after the top line because it was instantly incremented to 1 after it was reset when iterator column reached the end of the terminal width. This has been fixed by making sure that the column is never incremented when the column is reset due to a change in terminal line. This fixes #1198.
This commit is contained in:
parent
b19045da66
commit
334d50e98c
|
@ -748,13 +748,13 @@ impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
// Make sure indices are valid. Return None if we've reached the end.
|
// Make sure indices are valid. Return None if we've reached the end.
|
||||||
if self.col == self.grid.num_cols() {
|
let next_line = self.col == self.grid.num_cols();
|
||||||
|
if next_line {
|
||||||
if self.offset == self.limit {
|
if self.offset == self.limit {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.col = Column(0);
|
self.col = Column(0);
|
||||||
|
|
||||||
self.offset -= 1;
|
self.offset -= 1;
|
||||||
self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit));
|
self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit));
|
||||||
}
|
}
|
||||||
|
@ -766,7 +766,9 @@ impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> {
|
||||||
column: self.col
|
column: self.col
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if !next_line {
|
||||||
self.col += 1;
|
self.col += 1;
|
||||||
|
}
|
||||||
item
|
item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue