From 6ec79a12964275e02b37a7d8e5f2418323611855 Mon Sep 17 00:00:00 2001 From: Martin Lariz Date: Thu, 30 Jul 2020 09:33:46 -0700 Subject: [PATCH] Allow more positions for not overwriting chunk --- src/view.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/view.rs b/src/view.rs index 5b78097..24354d9 100644 --- a/src/view.rs +++ b/src/view.rs @@ -127,12 +127,21 @@ impl<'a> View<'a> { if let Some(ref hint) = mat.hint { let extra_position = if self.position == "left" { 0 + } else if self.position == "off_left" { + 0 - mat.hint.clone().unwrap().len() + } else if self.position == "off_right" { + text.len() } else { text.len() - mat.hint.clone().unwrap().len() }; let text = self.make_hint_text(hint.as_str()); + let final_position = if (offset as i32 + extra_position as i32) < 0 { + 0 + } else { + offset + extra_position as u16 + }; print!( "{goto}{background}{foregroud}{text}{resetf}{resetb}", goto = cursor::Goto(offset + extra_position as u16 + 1, mat.y as u16 + 1),