From 7da9de34d81f6a03f1923ff95ce0f48678ce86fb Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Fri, 16 Sep 2016 17:12:53 -0700 Subject: Fix crash There might be a better way to track cursor state such that these checks aren't necessary. --- src/grid.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/grid.rs') diff --git a/src/grid.rs b/src/grid.rs index d62903c9..c3473d8c 100644 --- a/src/grid.rs +++ b/src/grid.rs @@ -134,6 +134,10 @@ impl Grid { } } + pub fn contains(&self, cursor: &Cursor) -> bool { + self.lines > cursor.line && self.cols > cursor.col + } + /// Swap two lines in the grid /// /// This could have used slice::swap internally, but we are able to have -- cgit