From 18920d9e87042d68558c2f771884575e3d39f423 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sat, 1 Feb 2020 18:12:06 +0900 Subject: [PATCH] Slightly wider and darker gutter. --- src/editor/mod.rs | 21 ++++++++------------- src/term_ui/mod.rs | 8 ++++---- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/editor/mod.rs b/src/editor/mod.rs index bb8be80..a08d5f9 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -253,22 +253,17 @@ impl Editor { } } - /// Updates the view dimensions, and returns whether that - /// actually changed anything. + /// Updates the view dimensions. pub fn update_dim(&mut self, h: usize, w: usize) { let line_count_digits = digit_count(self.buffer.line_count() as u32, 10) as usize; - if self.editor_dim.0 != h || self.editor_dim.1 != w { - self.editor_dim = (h, w); + self.editor_dim = (h, w); - // Minus 1 vertically for the header, minus one more than the digits in - // the line count for the gutter. - self.view_dim = ( - self.editor_dim.0 - 1, - self.editor_dim.1 - line_count_digits - 1, - ); - } else if self.view_dim.1 != (self.editor_dim.1 - line_count_digits - 1) { - self.view_dim.1 = self.editor_dim.1 - line_count_digits - 1; - } + // Minus 1 vertically for the header, minus two more than the digits in + // the line count for the gutter. + self.view_dim = ( + self.editor_dim.0 - 1, + self.editor_dim.1 - line_count_digits - 2, + ); } pub fn undo(&mut self) { diff --git a/src/term_ui/mod.rs b/src/term_ui/mod.rs index de362db..5e85a59 100644 --- a/src/term_ui/mod.rs +++ b/src/term_ui/mod.rs @@ -58,9 +58,9 @@ const STYLE_GUTTER: Style = Style( b: 0x70, }, Color::Rgb { - r: 0x28, - g: 0x28, - b: 0x28, + r: 0x22, + g: 0x22, + b: 0x22, }, ); const STYLE_INFO: Style = Style( @@ -517,7 +517,7 @@ impl TermUI { for line in editor.buffer.line_iter_at_index(line_index) { // Print line number if line_block_index == 0 { - let lnx = c1.1 + (gutter_width - 1 - digit_count(line_num as u32, 10) as usize); + let lnx = c1.1 + (gutter_width - 2 - digit_count(line_num as u32, 10) as usize); let lny = screen_line as usize; if lny >= c1.0 && lny <= c2.0 { self.screen