aboutsummaryrefslogtreecommitdiffstats
path: root/src/grid.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-02 14:52:30 -0400
committerJesse Luehrs <doy@tozt.net>2019-11-02 14:52:30 -0400
commitbf8b298d125a29321947867a6f60ea133ebe3675 (patch)
tree87be517ccfe2d7db1b933fc676f145e768717f29 /src/grid.rs
parent031e1936c74463f187d012238bcf6b187e3c1a1f (diff)
downloadvt100-rust-bf8b298d125a29321947867a6f60ea133ebe3675.tar.gz
vt100-rust-bf8b298d125a29321947867a6f60ea133ebe3675.zip
fix screen resizing
Diffstat (limited to 'src/grid.rs')
-rw-r--r--src/grid.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/grid.rs b/src/grid.rs
index 2842d02..1ebc539 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -27,6 +27,17 @@ impl Grid {
pub fn set_size(&mut self, size: Size) {
self.size = size;
+
+ if self.scroll_bottom >= size.rows {
+ self.scroll_bottom = size.rows - 1;
+ }
+ if self.scroll_bottom < self.scroll_top {
+ self.scroll_top = 0;
+ }
+
+ self.row_clamp_top(false);
+ self.row_clamp_bottom(false);
+ self.col_clamp();
}
pub fn pos(&self) -> &Pos {