aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-03-24 14:42:05 +0100
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commit334d50e98c5f579e6f5b240ef2be971472ee27fb (patch)
treea128af26fa41fc9a925e152adeb7964cd8335efe
parentb19045da66899999856c6b2cc6707b60c607660a (diff)
downloadalacritty-334d50e98c5f579e6f5b240ef2be971472ee27fb.tar.gz
alacritty-334d50e98c5f579e6f5b240ef2be971472ee27fb.zip
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.
-rw-r--r--src/grid/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs
index faf67772..0564cdf5 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -748,13 +748,13 @@ 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() {
+ let next_line = self.col == self.grid.num_cols();
+ if next_line {
if self.offset == self.limit {
return None;
}
self.col = Column(0);
-
self.offset -= 1;
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
});
- self.col += 1;
+ if !next_line {
+ self.col += 1;
+ }
item
}
}