Skip to content

Commit 528ccbf

Browse files
committed
chore: Apply cargo format
1 parent fba2574 commit 528ccbf

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

zellij-server/src/panes/grid.rs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -850,11 +850,11 @@ impl Grid {
850850

851851
let mut new_cursor_y = self.canonical_line_y_coordinates(cursor_canonical_line_index)
852852
+ (cursor_index_in_canonical_line / new_columns);
853-
let mut saved_cursor_y_coordinates = self.saved_cursor_position.as_ref()
854-
.map(|saved_cursor|
853+
let mut saved_cursor_y_coordinates =
854+
self.saved_cursor_position.as_ref().map(|saved_cursor| {
855855
self.canonical_line_y_coordinates(saved_cursor.y)
856856
+ saved_cursor_index_in_canonical_line.as_ref().unwrap() / new_columns
857-
);
857+
});
858858

859859
// A cursor at EOL has two equivalent positions - end of this line or beginning of
860860
// next. If not already at the beginning of line, bias to EOL so add character logic
@@ -864,8 +864,8 @@ impl Grid {
864864
new_cursor_y -= 1;
865865
new_cursor_x = new_columns
866866
}
867-
let saved_cursor_x_coordinates = saved_cursor_index_in_canonical_line.as_ref()
868-
.map(|saved_cursor_index_in_canonical_line| {
867+
let saved_cursor_x_coordinates = saved_cursor_index_in_canonical_line.as_ref().map(
868+
|saved_cursor_index_in_canonical_line| {
869869
let x = self.saved_cursor_position.as_ref().unwrap().x;
870870
let mut new_x = *saved_cursor_index_in_canonical_line % new_columns;
871871
let new_y = saved_cursor_y_coordinates.as_mut().unwrap();
@@ -874,7 +874,8 @@ impl Grid {
874874
new_x = new_columns
875875
}
876876
new_x
877-
});
877+
},
878+
);
878879

879880
let current_viewport_row_count = self.viewport.len();
880881
match current_viewport_row_count.cmp(&self.height) {
@@ -926,20 +927,25 @@ impl Grid {
926927
saved_cursor_position.x = saved_cursor_x_coordinates;
927928
saved_cursor_position.y = saved_cursor_y_coordinates;
928929
},
929-
_ => unreachable!("saved cursor {:?} {:?}",
930-
saved_cursor_x_coordinates,
931-
saved_cursor_y_coordinates),
930+
_ => unreachable!(
931+
"saved cursor {:?} {:?}",
932+
saved_cursor_x_coordinates, saved_cursor_y_coordinates
933+
),
932934
}
933935
};
934936
}
935937
if new_rows != self.height {
936938
let mut new_cursor_y = self.cursor.y;
937-
let mut saved_cursor_y_coordinates =
938-
self.saved_cursor_position.as_ref().map(|saved_cursor| saved_cursor.y);
939+
let mut saved_cursor_y_coordinates = self
940+
.saved_cursor_position
941+
.as_ref()
942+
.map(|saved_cursor| saved_cursor.y);
939943

940944
let new_cursor_x = self.cursor.x;
941-
let saved_cursor_x_coordinates =
942-
self.saved_cursor_position.as_ref().map(|saved_cursor| saved_cursor.x);
945+
let saved_cursor_x_coordinates = self
946+
.saved_cursor_position
947+
.as_ref()
948+
.map(|saved_cursor| saved_cursor.x);
943949

944950
let current_viewport_row_count = self.viewport.len();
945951
match current_viewport_row_count.cmp(&new_rows) {
@@ -990,9 +996,10 @@ impl Grid {
990996
saved_cursor_position.x = saved_cursor_x_coordinates;
991997
saved_cursor_position.y = saved_cursor_y_coordinates;
992998
},
993-
_ => unreachable!("saved cursor {:?} {:?}",
994-
saved_cursor_x_coordinates,
995-
saved_cursor_y_coordinates),
999+
_ => unreachable!(
1000+
"saved cursor {:?} {:?}",
1001+
saved_cursor_x_coordinates, saved_cursor_y_coordinates
1002+
),
9961003
}
9971004
};
9981005
}

zellij-server/src/panes/unit/grid_tests.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,8 +2421,11 @@ fn saved_cursor_across_resize() {
24212421
arrow_fonts,
24222422
styled_underlines,
24232423
);
2424-
let mut parse = |s, grid: &mut Grid|
2425-
for b in Vec::from(s) { vte_parser.advance(&mut *grid, b) };
2424+
let mut parse = |s, grid: &mut Grid| {
2425+
for b in Vec::from(s) {
2426+
vte_parser.advance(&mut *grid, b)
2427+
}
2428+
};
24262429
let content = "
24272430
\rLine 1 >fill to 20_<
24282431
\rLine 2 >fill to 20_<
@@ -2463,8 +2466,11 @@ fn saved_cursor_across_resize_longline() {
24632466
arrow_fonts,
24642467
styled_underlines,
24652468
);
2466-
let mut parse = |s, grid: &mut Grid|
2467-
for b in Vec::from(s) { vte_parser.advance(&mut *grid, b) };
2469+
let mut parse = |s, grid: &mut Grid| {
2470+
for b in Vec::from(s) {
2471+
vte_parser.advance(&mut *grid, b)
2472+
}
2473+
};
24682474
let content = "
24692475
\rLine 1 >fill \u{1b}[sto 20_<";
24702476
parse(content, &mut grid);
@@ -2487,7 +2493,7 @@ fn saved_cursor_across_resize_rewrap() {
24872493
let styled_underlines = true;
24882494
let mut grid = Grid::new(
24892495
4,
2490-
4*8,
2496+
4 * 8,
24912497
Rc::new(RefCell::new(Palette::default())),
24922498
terminal_emulator_color_codes,
24932499
Rc::new(RefCell::new(LinkHandler::new())),
@@ -2498,8 +2504,11 @@ fn saved_cursor_across_resize_rewrap() {
24982504
arrow_fonts,
24992505
styled_underlines,
25002506
);
2501-
let mut parse = |s, grid: &mut Grid|
2502-
for b in Vec::from(s) { vte_parser.advance(&mut *grid, b) };
2507+
let mut parse = |s, grid: &mut Grid| {
2508+
for b in Vec::from(s) {
2509+
vte_parser.advance(&mut *grid, b)
2510+
}
2511+
};
25032512
let content = "
25042513
\r12345678123456781234567\u{1b}[s812345678"; // 4*8 chars
25052514
parse(content, &mut grid);

0 commit comments

Comments
 (0)