mirror of
https://github.com/zellij-org/zellij.git
synced 2024-11-23 19:10:09 +03:00
wip: the borders are colored correctly now, need to change the color according to the mode selected next and do some cleaning up
This commit is contained in:
parent
448c426c2b
commit
3dd776834a
@ -1,7 +1,6 @@
|
||||
use crate::tab::Pane;
|
||||
use ansi_term::Colour::{self, Fixed};
|
||||
use std::collections::HashMap;
|
||||
use ansi_term::Colour::*;
|
||||
use super::super::utils::logging::debug_log_to_file;
|
||||
|
||||
use std::fmt::{Display, Error, Formatter};
|
||||
|
||||
@ -26,7 +25,7 @@ pub struct BoundarySymbol {
|
||||
boundary_type: BoundaryType,
|
||||
invisible: bool,
|
||||
should_be_colored: bool,
|
||||
color: ansi_term::Colour
|
||||
color: Colour,
|
||||
}
|
||||
|
||||
impl BoundarySymbol {
|
||||
@ -35,17 +34,14 @@ impl BoundarySymbol {
|
||||
boundary_type,
|
||||
invisible: false,
|
||||
should_be_colored,
|
||||
color: match should_be_colored {
|
||||
true => ansi_term::Colour::Red,
|
||||
false => ansi_term::Colour::White
|
||||
}
|
||||
color: Fixed(245),
|
||||
}
|
||||
}
|
||||
pub fn invisible(mut self) -> Self {
|
||||
self.invisible = true;
|
||||
self
|
||||
}
|
||||
pub fn color(mut self, color: ansi_term::Colour) -> Self {
|
||||
pub fn color(mut self, color: Colour) -> Self {
|
||||
self.color = color;
|
||||
self.should_be_colored = true;
|
||||
self
|
||||
@ -56,12 +52,10 @@ impl Display for BoundarySymbol {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
|
||||
match self.invisible {
|
||||
true => write!(f, " "),
|
||||
false => {
|
||||
match self.should_be_colored {
|
||||
true => write!(f, "{}", self.color.paint(self.boundary_type)),
|
||||
false => write!(f, "{}", self.boundary_type)
|
||||
}
|
||||
}
|
||||
false => match self.should_be_colored {
|
||||
true => write!(f, "{}", self.color.paint(self.boundary_type)),
|
||||
false => write!(f, "{}", self.boundary_type),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,6 +68,10 @@ fn combine_symbols(
|
||||
let should_be_colored = current_symbol.should_be_colored || next_symbol.should_be_colored;
|
||||
let current_symbol = current_symbol.boundary_type;
|
||||
let next_symbol = next_symbol.boundary_type;
|
||||
let color = match should_be_colored {
|
||||
true => Fixed(154),
|
||||
false => Fixed(245),
|
||||
};
|
||||
match (current_symbol, next_symbol) {
|
||||
(boundary_type::TOP_RIGHT, boundary_type::TOP_RIGHT) => {
|
||||
// (┐, ┐) => Some(┐)
|
||||
@ -82,7 +80,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::VERTICAL) => {
|
||||
@ -92,7 +90,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::HORIZONTAL) => {
|
||||
@ -102,7 +100,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::TOP_LEFT) => {
|
||||
@ -112,7 +110,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::BOTTOM_RIGHT) => {
|
||||
@ -122,7 +120,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::BOTTOM_LEFT) => {
|
||||
@ -132,7 +130,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -142,7 +140,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -152,7 +150,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -162,7 +160,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -172,7 +170,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_RIGHT, boundary_type::CROSS) => {
|
||||
@ -182,7 +180,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::HORIZONTAL) => {
|
||||
@ -192,7 +190,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::VERTICAL) => {
|
||||
@ -202,7 +200,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::TOP_LEFT) => {
|
||||
@ -212,7 +210,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::BOTTOM_RIGHT) => {
|
||||
@ -222,7 +220,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::BOTTOM_LEFT) => {
|
||||
@ -232,7 +230,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -242,7 +240,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -252,7 +250,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -262,7 +260,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -272,7 +270,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL, boundary_type::CROSS) => {
|
||||
@ -282,7 +280,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::VERTICAL) => {
|
||||
@ -292,7 +290,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::TOP_LEFT) => {
|
||||
@ -302,7 +300,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::BOTTOM_RIGHT) => {
|
||||
@ -312,7 +310,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::BOTTOM_LEFT) => {
|
||||
@ -322,7 +320,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -332,7 +330,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -342,7 +340,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -352,7 +350,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -362,7 +360,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL, boundary_type::CROSS) => {
|
||||
@ -372,7 +370,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::TOP_LEFT) => {
|
||||
@ -382,7 +380,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::BOTTOM_RIGHT) => {
|
||||
@ -392,7 +390,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::BOTTOM_LEFT) => {
|
||||
@ -402,7 +400,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -412,7 +410,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -422,7 +420,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -432,7 +430,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -442,7 +440,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::TOP_LEFT, boundary_type::CROSS) => {
|
||||
@ -452,7 +450,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::BOTTOM_RIGHT) => {
|
||||
@ -462,7 +460,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::BOTTOM_LEFT) => {
|
||||
@ -472,7 +470,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -482,7 +480,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -492,7 +490,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -502,7 +500,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -512,7 +510,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_RIGHT, boundary_type::CROSS) => {
|
||||
@ -522,7 +520,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_LEFT, boundary_type::BOTTOM_LEFT) => {
|
||||
@ -532,7 +530,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_LEFT, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -542,7 +540,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_LEFT, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -552,7 +550,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_LEFT, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -562,7 +560,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_LEFT, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -572,7 +570,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::BOTTOM_LEFT, boundary_type::CROSS) => {
|
||||
@ -582,7 +580,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_LEFT, boundary_type::VERTICAL_LEFT) => {
|
||||
@ -592,7 +590,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_LEFT, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -602,7 +600,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_LEFT, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -612,7 +610,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_LEFT, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -622,7 +620,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_LEFT, boundary_type::CROSS) => {
|
||||
@ -632,7 +630,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_RIGHT, boundary_type::VERTICAL_RIGHT) => {
|
||||
@ -642,7 +640,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_RIGHT, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -652,7 +650,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_RIGHT, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -662,7 +660,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::VERTICAL_RIGHT, boundary_type::CROSS) => {
|
||||
@ -672,7 +670,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL_DOWN, boundary_type::HORIZONTAL_DOWN) => {
|
||||
@ -682,7 +680,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL_DOWN, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -692,7 +690,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL_DOWN, boundary_type::CROSS) => {
|
||||
@ -702,7 +700,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL_UP, boundary_type::HORIZONTAL_UP) => {
|
||||
@ -712,7 +710,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::HORIZONTAL_UP, boundary_type::CROSS) => {
|
||||
@ -722,7 +720,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(boundary_type::CROSS, boundary_type::CROSS) => {
|
||||
@ -732,7 +730,7 @@ fn combine_symbols(
|
||||
boundary_type,
|
||||
invisible,
|
||||
should_be_colored,
|
||||
color
|
||||
color,
|
||||
})
|
||||
}
|
||||
(_, _) => None,
|
||||
@ -829,7 +827,6 @@ impl Boundaries {
|
||||
}
|
||||
}
|
||||
pub fn add_rect(&mut self, rect: &dyn Pane, should_be_colored: bool) {
|
||||
debug_log_to_file(format!("colored? {}", should_be_colored));
|
||||
if rect.x() > 0 {
|
||||
let boundary_x_coords = rect.x() - 1;
|
||||
let first_row_coordinates = self.rect_right_boundary_row_start(rect);
|
||||
@ -846,6 +843,9 @@ impl Boundaries {
|
||||
if rect.invisible_borders() {
|
||||
symbol_to_add = symbol_to_add.invisible();
|
||||
}
|
||||
if rect.colored_borders() {
|
||||
symbol_to_add = symbol_to_add.color(Fixed(154));
|
||||
}
|
||||
let next_symbol = self
|
||||
.boundary_characters
|
||||
.remove(&coordinates)
|
||||
@ -870,6 +870,9 @@ impl Boundaries {
|
||||
if rect.invisible_borders() {
|
||||
symbol_to_add = symbol_to_add.invisible();
|
||||
}
|
||||
if rect.colored_borders() {
|
||||
symbol_to_add = symbol_to_add.color(Fixed(154));
|
||||
}
|
||||
let next_symbol = self
|
||||
.boundary_characters
|
||||
.remove(&coordinates)
|
||||
@ -886,15 +889,18 @@ impl Boundaries {
|
||||
for row in first_row_coordinates..last_row_coordinates {
|
||||
let coordinates = Coordinates::new(boundary_x_coords, row);
|
||||
let mut symbol_to_add = if row == first_row_coordinates && row != 0 {
|
||||
BoundarySymbol::new(boundary_type::TOP_RIGHT, false)
|
||||
BoundarySymbol::new(boundary_type::TOP_RIGHT, should_be_colored)
|
||||
} else if row == last_row_coordinates - 1 && row != self.rows - 1 {
|
||||
BoundarySymbol::new(boundary_type::BOTTOM_RIGHT, false)
|
||||
BoundarySymbol::new(boundary_type::BOTTOM_RIGHT, should_be_colored)
|
||||
} else {
|
||||
BoundarySymbol::new(boundary_type::VERTICAL, false)
|
||||
BoundarySymbol::new(boundary_type::VERTICAL, should_be_colored)
|
||||
};
|
||||
if rect.invisible_borders() {
|
||||
symbol_to_add = symbol_to_add.invisible();
|
||||
}
|
||||
if rect.colored_borders() {
|
||||
symbol_to_add = symbol_to_add.color(Fixed(154));
|
||||
}
|
||||
let next_symbol = self
|
||||
.boundary_characters
|
||||
.remove(&coordinates)
|
||||
@ -910,15 +916,18 @@ impl Boundaries {
|
||||
for col in first_col_coordinates..last_col_coordinates {
|
||||
let coordinates = Coordinates::new(col, boundary_y_coords);
|
||||
let mut symbol_to_add = if col == first_col_coordinates && col != 0 {
|
||||
BoundarySymbol::new(boundary_type::BOTTOM_LEFT, false)
|
||||
BoundarySymbol::new(boundary_type::BOTTOM_LEFT, should_be_colored)
|
||||
} else if col == last_col_coordinates - 1 && col != self.columns - 1 {
|
||||
BoundarySymbol::new(boundary_type::BOTTOM_RIGHT, false)
|
||||
BoundarySymbol::new(boundary_type::BOTTOM_RIGHT, should_be_colored)
|
||||
} else {
|
||||
BoundarySymbol::new(boundary_type::HORIZONTAL, false)
|
||||
BoundarySymbol::new(boundary_type::HORIZONTAL, should_be_colored)
|
||||
};
|
||||
if rect.invisible_borders() {
|
||||
symbol_to_add = symbol_to_add.invisible();
|
||||
}
|
||||
if rect.colored_borders() {
|
||||
symbol_to_add = symbol_to_add.color(Fixed(154));
|
||||
}
|
||||
let next_symbol = self
|
||||
.boundary_characters
|
||||
.remove(&coordinates)
|
||||
|
@ -11,6 +11,7 @@ pub struct PluginPane {
|
||||
pub should_render: bool,
|
||||
pub selectable: bool,
|
||||
pub invisible_borders: bool,
|
||||
pub colored_borders: bool,
|
||||
pub position_and_size: PositionAndSize,
|
||||
pub position_and_size_override: Option<PositionAndSize>,
|
||||
pub send_plugin_instructions: SenderWithContext<PluginInstruction>,
|
||||
@ -28,6 +29,7 @@ impl PluginPane {
|
||||
should_render: true,
|
||||
selectable: true,
|
||||
invisible_borders: false,
|
||||
colored_borders: false,
|
||||
position_and_size,
|
||||
position_and_size_override: None,
|
||||
send_plugin_instructions,
|
||||
@ -188,4 +190,7 @@ impl Pane for PluginPane {
|
||||
fn invisible_borders(&self) -> bool {
|
||||
self.invisible_borders
|
||||
}
|
||||
fn colored_borders(&self) -> bool {
|
||||
self.colored_borders
|
||||
}
|
||||
}
|
||||
|
@ -174,6 +174,9 @@ pub trait Pane {
|
||||
fn invisible_borders(&self) -> bool {
|
||||
false
|
||||
}
|
||||
fn colored_borders(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl Tab {
|
||||
@ -647,7 +650,7 @@ impl Tab {
|
||||
if !self.panes_to_hide.contains(&terminal.pid()) {
|
||||
match self.active_terminal.unwrap() == terminal.pid() {
|
||||
true => boundaries.add_rect(terminal.as_ref(), true),
|
||||
false => boundaries.add_rect(terminal.as_ref(), false)
|
||||
false => boundaries.add_rect(terminal.as_ref(), false),
|
||||
}
|
||||
if let Some(vte_output) = terminal.render() {
|
||||
let vte_output = if let PaneId::Terminal(_) = kind {
|
||||
|
Loading…
Reference in New Issue
Block a user