Repository: zellij-org/zellij
File: src/client/boundaries.rs (Rust)

Code before:
    boundary_characters: HashMap<Coordinates, BoundarySymbol>,
}

impl Boundaries {
    pub fn new(columns: u16, rows: u16) -> Self {
        let columns = columns as usize;
        let rows = rows as usize;
        Boundaries {
            columns,
            rows,
            boundary_characters: HashMap::new(),
        }
    }
    pub fn add_rect(&mut self, rect: &dyn Pane, should_be_colored: bool, input_mode: InputMode) {
        if rect.x() > 0 {
            let boundary_x_coords = rect.x() - 1;
            let first_row_coordinates = self.rect_right_boundary_row_start(rect);
            let last_row_coordinates = self.rect_right_boundary_row_end(rect);
            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_LEFT, should_be_colored)
                } else if row == last_row_coordinates - 1 && row != self.rows - 1 {
                    BoundarySymbol::new(boundary_type::BOTTOM_LEFT, should_be_colored)
                } else {
                    BoundarySymbol::new(boundary_type::VERTICAL, should_be_colored)
                };
                if rect.invisible_borders() {
                    symbol_to_add = symbol_to_add.invisible();
                }
                let next_symbol = self
                    .boundary_characters
                    .remove(&coordinates)
                    .and_then(|current_symbol| {
                        find_next_symbol(current_symbol, symbol_to_add, input_mode)
                    })
                    .unwrap_or(symbol_to_add);
                self.boundary_characters.insert(coordinates, next_symbol);
            }
        }
        if rect.y() > 0 {
            let boundary_y_coords = rect.y() - 1;
            let first_col_coordinates = self.rect_bottom_boundary_col_start(rect);
            let last_col_coordinates = self.rect_bottom_boundary_col_end(rect);
            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::TOP_LEFT, should_be_colored)
                } else if col == last_col_coordinates - 1 && col != self.columns - 1 {
                    BoundarySymbol::new(boundary_type::TOP_RIGHT, should_be_colored)
                } else {

Review comment (suggestion):
Also, maybe we can make the method assigning color to `BoundarySymbol` a Builder type method? Something like:
```
BoundarySymbol::new(boundary_type::VERTICAL).color(colors::GREEN)
```
What do you think? I just think it will be more idiomatic rust.

Code after:
                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).color(color)
                } else if row == last_row_coordinates - 1 && row != self.rows - 1 {
                    BoundarySymbol::new(boundary_type::BOTTOM_RIGHT).color(color)
                } else {
                    BoundarySymbol::new(boundary_type::VERTICAL).color(color)
                };
                if rect.invisible_borders() {
                    symbol_to_add = symbol_to_add.invisible();
                }
                let next_symbol = self
                    .boundary_characters
                    .remove(&coordinates)
                    .and_then(|current_symbol| find_next_symbol(current_symbol, symbol_to_add))
                    .unwrap_or(symbol_to_add);
                self.boundary_characters.insert(coordinates, next_symbol);
            }
        }
        if self.rect_bottom_boundary_is_before_screen_edge(rect) {
            let boundary_y_coords = rect.bottom_boundary_y_coords();
            let first_col_coordinates = self.rect_bottom_boundary_col_start(rect);
            let last_col_coordinates = self.rect_bottom_boundary_col_end(rect);
            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).color(color)
                } else if col == last_col_coordinates - 1 && col != self.columns - 1 {
                    BoundarySymbol::new(boundary_type::BOTTOM_RIGHT).color(color)
                } else {
                    BoundarySymbol::new(boundary_type::HORIZONTAL).color(color)
                };
                if rect.invisible_borders() {
                    symbol_to_add = symbol_to_add.invisible();
                }
                let next_symbol = self
                    .boundary_characters
                    .remove(&coordinates)
                    .and_then(|current_symbol| find_next_symbol(current_symbol, symbol_to_add))
                    .unwrap_or(symbol_to_add);
                self.boundary_characters.insert(coordinates, next_symbol);
            }
        }
    }
    pub fn vte_output(&self) -> String {
        let mut vte_output = String::new();
        for (coordinates, boundary_character) in &self.boundary_characters {
            vte_output.push_str(&format!(
                "\u{1b}[{};{}H\u{1b}[m{}",
                coordinates.y + 1,
                coordinates.x + 1,