Skip to content

Commit 356fbdf

Browse files
dougli1sqrdgithub-actions[bot]
authored andcommitted
chore(fmt): automated formatting
1 parent 1d731ea commit 356fbdf

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

src/display.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::{convert::Infallible, cmp::Ordering};
1+
use core::{cmp::Ordering, convert::Infallible};
22

33
use alloc::{
44
collections::VecDeque,
@@ -422,22 +422,22 @@ impl TextDisplay {
422422
// We add a correction if amount and COLUMNS are differ in even/odd parity
423423
let amount = amount % ROWS as isize;
424424
self.top = ((self.top as isize + amount) % ROWS as isize) as usize;
425-
425+
426426
let b = [' '; COLUMNS];
427427
let s = String::from_iter(b);
428428

429429
match amount.cmp(&0) {
430430
Ordering::Greater => {
431-
for i in ROWS-amount as usize..ROWS {
431+
for i in ROWS - amount as usize..ROWS {
432432
self.write_text(i, 0, &s);
433433
}
434-
},
434+
}
435435
Ordering::Less => {
436436
let amt = amount.unsigned_abs();
437437
for i in 0..amt {
438438
self.write_text(i, 0, &s);
439439
}
440-
},
440+
}
441441
_ => {}
442442
}
443443
self.dirty_all();

src/terminal.rs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{
22
ansi::{self, EraseMode, Op, OpStr},
33
color::Rgb3,
4-
display::{self, TextDisplay, ROWS, COLUMNS},
4+
display::{self, TextDisplay, COLUMNS, ROWS},
55
CHARACTER_DRAW_CYCLES,
66
};
77
use alloc::string::String;
@@ -65,13 +65,13 @@ impl CursorPos {
6565
enum VerticalLocation {
6666
Middle,
6767
Top,
68-
Bottom
68+
Bottom,
6969
}
7070

7171
enum HorizontalLocation {
7272
Middle,
7373
Left,
74-
Right
74+
Right,
7575
}
7676

7777
#[derive(Debug, Clone, Copy)]
@@ -239,29 +239,26 @@ impl TextField {
239239
.write(self.cursor.pos.row(), self.cursor.pos.col(), t);
240240
self.move_cursor(0, 1);
241241
}
242-
'\n' => {
243-
match self.cursor.location() {
244-
(VerticalLocation::Bottom, _) => {
245-
self.cursor.unset_highlight(&mut self.text);
246-
self.text.scroll_down(1);
247-
self.move_cursor(0, -(self.cursor.pos.col() as isize))
248-
},
249-
_ => {
250-
self.move_cursor(1, -(self.cursor.pos.col() as isize))
251-
}
242+
'\n' => match self.cursor.location() {
243+
(VerticalLocation::Bottom, _) => {
244+
self.cursor.unset_highlight(&mut self.text);
245+
self.text.scroll_down(1);
246+
self.move_cursor(0, -(self.cursor.pos.col() as isize))
252247
}
253-
}
248+
_ => self.move_cursor(1, -(self.cursor.pos.col() as isize)),
249+
},
254250
'\r' => self.move_cursor(0, -(self.cursor.pos.col() as isize)),
255251
_ => {
256252
for c in t.escape_default() {
257253
self.text.write(self.cursor.pos.0, self.cursor.pos.1, c);
258254
match self.cursor.location() {
259255
(_, HorizontalLocation::Left | HorizontalLocation::Middle) => {
260256
self.move_cursor(0, 1);
261-
},
262-
(VerticalLocation::Top | VerticalLocation::Middle, HorizontalLocation::Right) => {
263-
self.move_cursor(1, -(self.cursor.pos.col() as isize))
264-
},
257+
}
258+
(
259+
VerticalLocation::Top | VerticalLocation::Middle,
260+
HorizontalLocation::Right,
261+
) => self.move_cursor(1, -(self.cursor.pos.col() as isize)),
265262
(VerticalLocation::Bottom, HorizontalLocation::Right) => {
266263
self.cursor.unset_highlight(&mut self.text);
267264
self.text.scroll_down(1);
@@ -290,8 +287,10 @@ impl TextField {
290287
MoveCursorDelta { dx, dy } => {
291288
// Constrain dx and dy so that the result added to the current position
292289
// stays within the window
293-
let x = (self.cursor.pos.col() as isize + dx).clamp(0, COLUMNS as isize - 1) - self.cursor.pos.col() as isize;
294-
let y = (self.cursor.pos.row() as isize + dy).clamp(0, ROWS as isize - 1) - self.cursor.pos.row() as isize;
290+
let x = (self.cursor.pos.col() as isize + dx).clamp(0, COLUMNS as isize - 1)
291+
- self.cursor.pos.col() as isize;
292+
let y = (self.cursor.pos.row() as isize + dy).clamp(0, ROWS as isize - 1)
293+
- self.cursor.pos.row() as isize;
295294
self.move_cursor(y, x);
296295
}
297296
MoveCursorBeginningAndLine { dy } => {

0 commit comments

Comments
 (0)