From 37cd154f894e4ac9bc097d4e26bfd19d48c2a9ec Mon Sep 17 00:00:00 2001 From: daa84 Date: Thu, 9 Mar 2017 16:51:34 +0300 Subject: [PATCH] fix scroll bug --- src/ui_model.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ui_model.rs b/src/ui_model.rs index 15bbd50..1df1df2 100644 --- a/src/ui_model.rs +++ b/src/ui_model.rs @@ -75,7 +75,17 @@ pub struct UiModel { impl UiModel { pub fn empty() -> UiModel { - UiModel::new(0, 0) + UiModel { + columns: 0, + rows: 0, + cur_row: 0, + cur_col: 0, + model: vec![], + top: 0, + bot: 0, + left: 0, + right: 0, + } } pub fn new(rows: u64, columns: u64) -> UiModel { @@ -94,9 +104,9 @@ impl UiModel { cur_col: 0, model: model, top: 0, - bot: 0, + bot: (rows - 1) as usize, left: 0, - right: 0, + right: (columns - 1) as usize, } }