Slightly wider and darker gutter.

This commit is contained in:
Nathan Vegdahl 2020-02-01 18:12:06 +09:00
parent 9ff24353b4
commit 18920d9e87
2 changed files with 12 additions and 17 deletions

View File

@ -253,22 +253,17 @@ impl<T: LineFormatter> Editor<T> {
}
}
/// 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);
// Minus 1 vertically for the header, minus one more than the digits in
// 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 - 1,
self.editor_dim.1 - line_count_digits - 2,
);
} 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;
}
}
pub fn undo(&mut self) {

View File

@ -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