Gutter styling improvements.

Instead of having the hard line numbers alternate colors, give soft
wrapped lines their own lighter color.  This still gives a nice
visual cue when lines are wrapped, but isn't as generally distracting.
This commit is contained in:
Nathan Vegdahl 2020-02-17 18:47:43 +09:00
parent 6a736e0b66
commit e061603a6e

View File

@ -49,19 +49,7 @@ const STYLE_CURSOR: Style = Style(
b: 0xD0, b: 0xD0,
}, },
); );
const STYLE_GUTTER_ODD: Style = Style( const STYLE_GUTTER_LINE_START: Style = Style(
Color::Rgb {
r: 0x70,
g: 0x70,
b: 0x70,
},
Color::Rgb {
r: 0x08,
g: 0x08,
b: 0x08,
},
);
const STYLE_GUTTER_EVEN: Style = Style(
Color::Rgb { Color::Rgb {
r: 0x78, r: 0x78,
g: 0x78, g: 0x78,
@ -73,6 +61,18 @@ const STYLE_GUTTER_EVEN: Style = Style(
b: 0x1B, b: 0x1B,
}, },
); );
const STYLE_GUTTER_LINE_WRAP: Style = Style(
Color::Rgb {
r: 0x78,
g: 0x78,
b: 0x78,
},
Color::Rgb {
r: 0x22,
g: 0x22,
b: 0x22,
},
);
const STYLE_INFO: Style = Style( const STYLE_INFO: Style = Style(
Color::Rgb { Color::Rgb {
r: 0xC0, r: 0xC0,
@ -506,7 +506,8 @@ impl TermUI {
// Fill in the gutter with the appropriate background // Fill in the gutter with the appropriate background
for y in c1.0..(c2.0 + 1) { for y in c1.0..(c2.0 + 1) {
self.screen.draw(c1.1, y, blank_gutter, STYLE_GUTTER_ODD); self.screen
.draw(c1.1, y, blank_gutter, STYLE_GUTTER_LINE_WRAP);
} }
// Loop through the blocks, printing them to the screen. // Loop through the blocks, printing them to the screen.
@ -519,12 +520,6 @@ impl TermUI {
} }
is_first_loop = false; is_first_loop = false;
let gutter_style = if (line_num % 2) == 0 {
STYLE_GUTTER_EVEN
} else {
STYLE_GUTTER_ODD
};
// Print line number // Print line number
if is_line_start { if is_line_start {
let lnx = c1.1; let lnx = c1.1;
@ -539,7 +534,7 @@ impl TermUI {
[..(gutter_width - 2 - digit_count(line_num as u32, 10) as usize)], [..(gutter_width - 2 - digit_count(line_num as u32, 10) as usize)],
line_num, line_num,
)[..], )[..],
gutter_style, STYLE_GUTTER_LINE_START,
); );
} }
} }