aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-02-04 08:24:33 +0000
committerBlaž Hrastnik2021-02-04 08:24:33 +0000
commita81b8f3e42bd86593e9d880d65fe1c6e34f7bf85 (patch)
tree9454c2fd65f87afa94a74515889cd94b09a9b3f8 /helix-term
parenta014787ee8418e27a48d7614ccdb7f9769087606 (diff)
Fix statusline rendering, change colors on active view.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/editor.rs22
1 files changed, 17 insertions, 5 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index b23c9cf6..090f3d0b 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -50,7 +50,12 @@ impl EditorView {
// TODO: this seems to prevent setting style later
// surface.set_style(viewport, theme.get("ui.background"));
- let area = Rect::new(viewport.x, viewport.height - 2, viewport.width, 1);
+ let area = Rect::new(
+ viewport.x,
+ viewport.y + viewport.height - 2,
+ viewport.width,
+ 1,
+ );
self.render_statusline(&view.doc, area, surface, theme, is_focused);
}
@@ -241,27 +246,34 @@ impl EditorView {
theme: &Theme,
is_focused: bool,
) {
- let text_color = text_color();
let mode = match doc.mode() {
Mode::Insert => "INS",
Mode::Normal => "NOR",
Mode::Goto => "GOTO",
};
+ // TODO: share text_color styles inside theme
+ let text_color = if is_focused {
+ Style::default().fg(Color::Rgb(219, 191, 239)) // lilac
+ } else {
+ Style::default().fg(Color::Rgb(164, 160, 232)) // lavender
+ };
// statusline
surface.set_style(
Rect::new(viewport.x, viewport.y, viewport.width, 1),
theme.get("ui.statusline"),
);
- surface.set_string(viewport.x + 1, viewport.y, mode, text_color);
+ if is_focused {
+ surface.set_string(viewport.x + 1, viewport.y, mode, text_color);
+ }
if let Some(path) = doc.relative_path() {
let path = path.to_string_lossy();
- surface.set_string(6, viewport.y, path, text_color);
+ surface.set_string(viewport.x + 6, viewport.y, path, text_color);
// TODO: append [+] if modified
}
surface.set_string(
- viewport.width - 10,
+ viewport.x + viewport.width - 10,
viewport.y,
format!("{}", doc.diagnostics.len()),
text_color,