diff options
-rw-r--r-- | helix-term/src/ui/editor.rs | 21 | ||||
-rw-r--r-- | helix-view/src/view.rs | 10 |
2 files changed, 20 insertions, 11 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 5b5cda93..aa159d40 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -163,15 +163,18 @@ impl EditorView { Box::new(highlights) }; - Self::render_gutter( - editor, - doc, - view, - view.area, - theme, - is_focused, - &mut line_decorations, - ); + let gutter_overflow = view.gutter_offset(doc) == 0; + if !gutter_overflow { + Self::render_gutter( + editor, + doc, + view, + view.area, + theme, + is_focused, + &mut line_decorations, + ); + } if is_focused { let cursor = doc diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs index ee6fc127..e5e2641a 100644 --- a/helix-view/src/view.rs +++ b/helix-view/src/view.rs @@ -187,11 +187,17 @@ impl View { } pub fn gutter_offset(&self, doc: &Document) -> u16 { - self.gutters + let total_width = self + .gutters .layout .iter() .map(|gutter| gutter.width(self, doc) as u16) - .sum() + .sum(); + if total_width < self.area.width { + total_width + } else { + 0 + } } // |