Fir cursor not scrolling

This commit is contained in:
Joe Wilm 2018-02-15 19:34:09 -08:00
parent 5748066b8a
commit 9b9b138bac
2 changed files with 12 additions and 3 deletions

View File

@ -628,6 +628,7 @@ pub struct DisplayIter<'a, T: 'a> {
offset: usize,
limit: usize,
col: Column,
line: Line,
}
impl<'a, T: 'a> DisplayIter<'a, T> {
@ -635,8 +636,9 @@ impl<'a, T: 'a> DisplayIter<'a, T> {
let offset = grid.display_offset + *grid.num_lines() - 1;
let limit = grid.display_offset;
let col = Column(0);
let line = Line(0);
DisplayIter { grid, offset, col, limit }
DisplayIter { grid, offset, col, limit, line }
}
pub fn offset(&self) -> usize {
@ -646,6 +648,10 @@ impl<'a, T: 'a> DisplayIter<'a, T> {
pub fn column(&self) -> Column {
self.col
}
pub fn line(&self) -> Line {
self.line
}
}
impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> {
@ -660,13 +666,15 @@ impl<'a, T: Copy + 'a> Iterator for DisplayIter<'a, T> {
}
self.col = Column(0);
self.offset -= 1;
self.line = Line(*self.grid.lines - 1 - (self.offset - self.limit));
}
// Return the next item.
let item = Some(Indexed {
inner: self.grid.raw[self.offset][self.col],
line: Line( *self.grid.lines - 1 - (self.offset - self.limit)),
line: self.line,
column: self.col
});

View File

@ -342,7 +342,8 @@ impl<'a> Iterator for RenderableCellsIter<'a> {
self.inner.column() == self.cursor.col
{
// Cursor cell
let cell = self.cursor_cells.pop_front().unwrap();
let mut cell = self.cursor_cells.pop_front().unwrap();
cell.line = self.inner.line();
// Since there may be multiple cursor cells (for a wide
// char), only update iteration position after all cursor