summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Oram <mitmaro@gmail.com>2017-01-27 08:40:21 -0330
committerTim Oram <mitmaro@gmail.com>2017-01-27 14:55:47 -0330
commit2ce4fbdefa34f56486bc43849d5114d8b214bd08 (patch)
tree05aeccdad19fe01f799affc1ab6a3e50eac9091f /src
parent280268676615d91cc8a070fac78957d5d011dbd5 (diff)
Fix crash when window shrinks below 4 rows
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 321331a..aae9a03 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -242,8 +242,11 @@ impl Window {
fn draw(&self, git_interactive: &GitInteractive) {
self.window.clear();
self.draw_title();
- // 4 removed for other UI lines
- let window_height = (self.window.get_max_y() - 4) as usize;
+ let window_height = match self.window.get_max_y() {
+ // 4 removed for other UI lines
+ x if x >= 4 => x - 4,
+ _ => 4
+ } as usize;
if self.top > 0 {
self.draw_more_indicator(self.top);