aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-08 07:54:55 +0000
committerBlaž Hrastnik2021-04-08 13:34:06 +0000
commit52da68e49a582f960ebf3ec26ae3279b102b01f2 (patch)
tree8ceeb76c40738ad7a39cf1d249deef16c1623fde
parent9f318a852909439190050a0cd157938477f4639b (diff)
Render a separator between vertical splits.
-rw-r--r--helix-term/src/ui/editor.rs36
-rw-r--r--helix-view/src/tree.rs5
-rw-r--r--theme.toml1
3 files changed, 32 insertions, 10 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 726d0d95..556462b0 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -55,13 +55,26 @@ impl EditorView {
is_focused: bool,
) {
let area = Rect::new(
- viewport.x + OFFSET,
- viewport.y,
- viewport.width - OFFSET,
- viewport.height.saturating_sub(1),
+ view.area.x + OFFSET,
+ view.area.y,
+ view.area.width - OFFSET,
+ view.area.height.saturating_sub(1),
); // - 1 for statusline
self.render_buffer(doc, view, area, surface, theme, is_focused);
+ // if we're not at the edge of the screen, draw a right border
+ if viewport.right() != view.area.right() {
+ let x = area.right();
+ let border_style = theme.get("ui.window");
+ for y in area.top()..area.bottom() {
+ surface
+ .get_mut(x, y)
+ // .set_symbol(tui::symbols::line::VERTICAL)
+ .set_symbol(" ")
+ .set_style(border_style);
+ }
+ }
+
// clear with background color
// TODO: this seems to prevent setting style later
// surface.set_style(viewport, theme.get("ui.background"));
@@ -69,9 +82,9 @@ impl EditorView {
self.render_diagnostics(doc, view, area, surface, theme, is_focused);
let area = Rect::new(
- viewport.x,
- viewport.y + viewport.height.saturating_sub(1),
- viewport.width,
+ view.area.x,
+ view.area.y + view.area.height.saturating_sub(1),
+ view.area.width,
1,
);
self.render_statusline(doc, area, surface, theme, is_focused);
@@ -79,7 +92,12 @@ impl EditorView {
// render status
if let Some(status_msg) = &self.status_msg {
let style = Style::default().fg(Color::Rgb(164, 160, 232)); // lavender
- surface.set_string(viewport.x, viewport.y + viewport.height, status_msg, style);
+ surface.set_string(
+ view.area.x,
+ view.area.y + view.area.height,
+ status_msg,
+ style,
+ );
}
}
@@ -595,7 +613,7 @@ impl Component for EditorView {
fn render(&self, mut area: Rect, surface: &mut Surface, cx: &mut Context) {
for (view, is_focused) in cx.editor.tree.views() {
let doc = cx.editor.document(view.doc).unwrap();
- self.render_view(doc, view, view.area, surface, &cx.editor.theme, is_focused);
+ self.render_view(doc, view, area, surface, &cx.editor.theme, is_focused);
}
if let Some(completion) = &self.completion {
diff --git a/helix-view/src/tree.rs b/helix-view/src/tree.rs
index e48f376a..b7c99e16 100644
--- a/helix-view/src/tree.rs
+++ b/helix-view/src/tree.rs
@@ -353,6 +353,9 @@ impl Tree {
let width = area.width / len as u16;
+ let inner_gap = 1u16;
+ // let total_gap = inner_gap * (len as u16 - 1);
+
let mut child_x = area.x;
for (i, child) in container.children.iter().enumerate() {
@@ -362,7 +365,7 @@ impl Tree {
width,
container.area.height,
);
- child_x += width;
+ child_x += width + inner_gap;
// last child takes the remaining width because we can get uneven
// space from rounding
diff --git a/theme.toml b/theme.toml
index 871a28b5..9a1d76ab 100644
--- a/theme.toml
+++ b/theme.toml
@@ -39,6 +39,7 @@
"ui.linenr" = { fg = "#5a5977" } # comet
"ui.statusline" = { bg = "#281733" } # revolver
"ui.popup" = { bg = "#281733" } # revolver
+"ui.window" = { bg = "#452859" } # bossa nova
"warning" = "#ffcd1c"
"error" = "#f47868"