diff --git a/xtask/src/build.rs b/xtask/src/build.rs index bc10362258..67547a1c24 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -52,7 +52,8 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> { std::fs::create_dir_all(&prost_asset_dir).unwrap(); let mut prost = prost_build::Config::new(); - let last_generated = prost_asset_dir.join("generated_plugin_api.rs") + let last_generated = prost_asset_dir + .join("generated_plugin_api.rs") .metadata() .and_then(|m| m.modified()); let mut needs_regeneration = false; @@ -62,14 +63,17 @@ pub fn build(sh: &Shell, flags: flags::Build) -> anyhow::Result<()> { for entry in std::fs::read_dir(&protobuf_source_dir).unwrap() { let entry_path = entry.unwrap().path(); if entry_path.is_file() { - if !entry_path.extension().map(|e| e == "proto").unwrap_or(false) { - continue + if !entry_path + .extension() + .map(|e| e == "proto") + .unwrap_or(false) + { + continue; } proto_files.push(entry_path.display().to_string()); let modified = entry_path.metadata().and_then(|m| m.modified()); needs_regeneration |= match (&last_generated, modified) { - (Ok(last_generated), Ok(modified)) => - modified >= *last_generated, + (Ok(last_generated), Ok(modified)) => modified >= *last_generated, // Couldn't read some metadata, assume needs update _ => true, } diff --git a/zellij-server/src/output/mod.rs b/zellij-server/src/output/mod.rs index 2f5238f791..7ad7a38bc8 100644 --- a/zellij-server/src/output/mod.rs +++ b/zellij-server/src/output/mod.rs @@ -91,8 +91,7 @@ fn serialize_chunks_with_newlines( let link_handler = link_handler.map(|l_h| l_h.borrow()); for character_chunk in character_chunks { let chunk_changed_colors = character_chunk.changed_colors(); - let mut character_styles = - DEFAULT_STYLES.enable_styled_underlines(styled_underlines); + let mut character_styles = DEFAULT_STYLES.enable_styled_underlines(styled_underlines); vte_output.push_str("\n\r"); let mut chunk_width = character_chunk.x; for t_character in character_chunk.terminal_characters.iter() { @@ -130,8 +129,7 @@ fn serialize_chunks( let link_handler = link_handler.map(|l_h| l_h.borrow()); for character_chunk in character_chunks { let chunk_changed_colors = character_chunk.changed_colors(); - let mut character_styles = - DEFAULT_STYLES.enable_styled_underlines(styled_underlines); + let mut character_styles = DEFAULT_STYLES.enable_styled_underlines(styled_underlines); vte_goto_instruction(character_chunk.x, character_chunk.y, &mut vte_output) .with_context(err_context)?; let mut chunk_width = character_chunk.x; diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index 659d92f1e3..377f05f6e8 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -906,7 +906,7 @@ impl Grid { mut new_cursor_y, mut saved_cursor_y_coordinates, new_cursor_x, - saved_cursor_x_coordinates + saved_cursor_x_coordinates, ) = cursors; let current_viewport_row_count = self.viewport.len(); @@ -2144,7 +2144,8 @@ impl Perform for Grid { fn print(&mut self, c: char) { let c = self.cursor.charsets[self.active_charset].map(c); - let terminal_character = TerminalCharacter::new_styled(c, self.cursor.pending_styles.clone()); + let terminal_character = + TerminalCharacter::new_styled(c, self.cursor.pending_styles.clone()); self.set_preceding_character(terminal_character.clone()); self.add_character(terminal_character); } @@ -2443,9 +2444,7 @@ impl Perform for Grid { if intermediates.is_empty() { self.cursor .pending_styles - .update(|styles| { - styles.add_style_from_ansi_params(&mut params_iter) - }) + .update(|styles| styles.add_style_from_ansi_params(&mut params_iter)) } } else if c == 'C' || c == 'a' { // move cursor forward @@ -2456,9 +2455,9 @@ impl Perform for Grid { if let Some(clear_type) = params_iter.next().map(|param| param[0]) { let mut char_to_replace = EMPTY_TERMINAL_CHARACTER; if let Some(background_color) = self.cursor.pending_styles.background { - char_to_replace.styles.update(|styles| { - styles.background = Some(background_color) - }); + char_to_replace + .styles + .update(|styles| styles.background = Some(background_color)); } if clear_type == 0 { self.replace_characters_in_line_after_cursor(char_to_replace); @@ -2472,9 +2471,9 @@ impl Perform for Grid { // clear all (0 => below, 1 => above, 2 => all, 3 => saved) let mut char_to_replace = EMPTY_TERMINAL_CHARACTER; if let Some(background_color) = self.cursor.pending_styles.background { - char_to_replace.styles.update(|styles| { - styles.background = Some(background_color) - }); + char_to_replace + .styles + .update(|styles| styles.background = Some(background_color)); } if let Some(clear_type) = params_iter.next().map(|param| param[0]) { if clear_type == 0 { diff --git a/zellij-server/src/panes/terminal_character.rs b/zellij-server/src/panes/terminal_character.rs index 3e5f761000..2bb1326496 100644 --- a/zellij-server/src/panes/terminal_character.rs +++ b/zellij-server/src/panes/terminal_character.rs @@ -332,8 +332,7 @@ impl CharacterStyles { } // create diff from all changed styles - let mut diff = - DEFAULT_STYLES.enable_styled_underlines(self.styled_underlines_enabled); + let mut diff = DEFAULT_STYLES.enable_styled_underlines(self.styled_underlines_enabled); if self.foreground != new_styles.foreground { diff.foreground = new_styles.foreground; diff --git a/zellij-server/src/ui/pane_boundaries_frame.rs b/zellij-server/src/ui/pane_boundaries_frame.rs index 1c517415fd..57cff1ce42 100644 --- a/zellij-server/src/ui/pane_boundaries_frame.rs +++ b/zellij-server/src/ui/pane_boundaries_frame.rs @@ -31,14 +31,12 @@ fn background_color(characters: &str, color: Option) -> Vec { - styles.background = Some(AnsiCode::from(palette_color)); - styles.bold(Some(AnsiCode::On)); - }, - None => {}, - } + styles.update(|styles| match color { + Some(palette_color) => { + styles.background = Some(AnsiCode::from(palette_color)); + styles.bold(Some(AnsiCode::On)); + }, + None => {}, }); let terminal_character = TerminalCharacter::new_styled(character, styles); colored_string.push(terminal_character);