diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-03-28 14:35:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-28 14:35:01 +0000 |
commit | 8654a09f73c1fc63dae8f7ba7ab91999498852c2 (patch) | |
tree | b172bd0e39d4c93428c4c2b4c9e7ab47cb64daa8 | |
parent | 16153e615d62b4ff589e34537897652a44545f94 (diff) | |
download | alacritty-8654a09f73c1fc63dae8f7ba7ab91999498852c2.tar.gz alacritty-8654a09f73c1fc63dae8f7ba7ab91999498852c2.zip |
Fix prompt jumping during reflow
If the window is resized while lines are longer than the visible area,
Alacritty will no longer move down the prompt and pull from history when
possible but instead keep the prompt in place and move the additional
lines into the scrollback buffer.
This fixes #2213.
-rw-r--r-- | src/grid/mod.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs index c555400d..272ea340 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -211,7 +211,7 @@ impl<T: GridCell + Copy + Clone> Grid<T> { match self.cols.cmp(&cols) { Ordering::Less => self.grow_cols(cols, cursor_pos, template), - Ordering::Greater => self.shrink_cols(cols, cursor_pos, template), + Ordering::Greater => self.shrink_cols(cols, template), Ordering::Equal => (), } } @@ -321,7 +321,7 @@ impl<T: GridCell + Copy + Clone> Grid<T> { self.cols = cols; } - fn shrink_cols(&mut self, cols: index::Column, cursor_pos: &mut Point, template: &T) { + fn shrink_cols(&mut self, cols: index::Column, template: &T) { // Truncate all buffered lines self.raw.shrink_hidden(cols); @@ -364,17 +364,11 @@ impl<T: GridCell + Copy + Clone> Grid<T> { // Add new row with all removed cells self.raw.insert(i, row, max_lines); - if cursor_pos.line >= self.lines - 1 { - // Increase scrollback history - self.scroll_limit = min(self.scroll_limit + 1, self.max_scroll_limit); + // Increase scrollback history + self.scroll_limit = min(self.scroll_limit + 1, self.max_scroll_limit); - // Since inserted might exceed cols, we need to check the same line again - i += 1; - } else { - // Pull content down if cursor is not at the bottom - self.raw.rotate(1); - cursor_pos.line += 1; - } + // Since inserted might exceed cols, we need to check the same line again + i += 1; } } } |