Skip to content

Commit

Permalink
chore: Run xtask format
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanhs committed Dec 30, 2023
1 parent 3b55f63 commit a0731c2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 30 deletions.
14 changes: 9 additions & 5 deletions xtask/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
}
Expand Down
6 changes: 2 additions & 4 deletions zellij-server/src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
21 changes: 10 additions & 11 deletions zellij-server/src/panes/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions zellij-server/src/panes/terminal_character.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 6 additions & 8 deletions zellij-server/src/ui/pane_boundaries_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ fn background_color(characters: &str, color: Option<PaletteColor>) -> Vec<Termin
let mut colored_string = Vec::new();
for character in characters.chars() {
let mut styles = RcCharacterStyles::reset();
styles.update(|styles| {
match color {
Some(palette_color) => {
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);
Expand Down

0 comments on commit a0731c2

Please sign in to comment.