Skip to content

Commit 41824fe

Browse files
committed
cargo fmt
1 parent 0048f22 commit 41824fe

3 files changed

Lines changed: 43 additions & 24 deletions

File tree

src/editor/mod.rs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::sync::mpsc;
1616
static NEXT_EDITOR_ID: AtomicUsize = AtomicUsize::new(0);
1717

1818
use gpui::{
19-
AnyElement, Anchor, App, Context, CursorStyle, DragMoveEvent, Empty, FocusHandle, Focusable,
19+
Anchor, AnyElement, App, Context, CursorStyle, DragMoveEvent, Empty, FocusHandle, Focusable,
2020
Hsla, IntoElement, KeyDownEvent, ListAlignment, ListState, ModifiersChangedEvent, MouseButton,
2121
ReadGlobal, Render, Rgba, TextRun, Window, anchored, div, font, list, point, prelude::*, px,
2222
};
@@ -2211,25 +2211,24 @@ impl Editor {
22112211
.timer(std::time::Duration::from_millis(100))
22122212
.await;
22132213

2214-
let continue_loop = cx
2215-
.update(|cx| {
2216-
if let Some(editor) = weak.upgrade() {
2217-
editor.update(cx, |editor, cx| {
2218-
if let Some(rx) = &editor.file_watcher_rx {
2219-
let mut changed = false;
2220-
while rx.try_recv().is_ok() {
2221-
changed = true;
2222-
}
2223-
if changed {
2224-
editor.reload_file(cx);
2225-
}
2214+
let continue_loop = cx.update(|cx| {
2215+
if let Some(editor) = weak.upgrade() {
2216+
editor.update(cx, |editor, cx| {
2217+
if let Some(rx) = &editor.file_watcher_rx {
2218+
let mut changed = false;
2219+
while rx.try_recv().is_ok() {
2220+
changed = true;
22262221
}
2227-
});
2228-
true
2229-
} else {
2230-
false
2231-
}
2232-
});
2222+
if changed {
2223+
editor.reload_file(cx);
2224+
}
2225+
}
2226+
});
2227+
true
2228+
} else {
2229+
false
2230+
}
2231+
});
22332232

22342233
if !continue_loop {
22352234
break;

src/line.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,14 @@ impl Line {
11091109
let cursor_height = cursor_font_size * 1.2;
11101110
let y_offset = (line_height - cursor_height) / 2.0;
11111111
let cursor_pos = point(pos.x, pos.y + y_offset);
1112-
let _ = shaped_cursor.paint(cursor_pos, cursor_height, gpui::TextAlign::Left, None, window, cx);
1112+
let _ = shaped_cursor.paint(
1113+
cursor_pos,
1114+
cursor_height,
1115+
gpui::TextAlign::Left,
1116+
None,
1117+
window,
1118+
cx,
1119+
);
11131120
},
11141121
)
11151122
.absolute()
@@ -1173,7 +1180,14 @@ impl Line {
11731180
let cursor_height = cursor_font_size * 1.2;
11741181
let y_offset = (line_height - cursor_height) / 2.0;
11751182
let cursor_pos = point(bounds.origin.x + x_pos, bounds.origin.y + y_offset);
1176-
let _ = shaped_cursor.paint(cursor_pos, cursor_height, gpui::TextAlign::Left, None, window, cx);
1183+
let _ = shaped_cursor.paint(
1184+
cursor_pos,
1185+
cursor_height,
1186+
gpui::TextAlign::Left,
1187+
None,
1188+
window,
1189+
cx,
1190+
);
11771191
},
11781192
)
11791193
.absolute()

src/main.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ fn run_demo(editor: Entity<Editor>, cx: &mut gpui::App) {
4343
});
4444
};
4545

46-
cx.background_executor().timer(Duration::from_millis(500)).await;
46+
cx.background_executor()
47+
.timer(Duration::from_millis(500))
48+
.await;
4749

4850
for step in script {
4951
match step {
@@ -54,7 +56,9 @@ fn run_demo(editor: Entity<Editor>, cx: &mut gpui::App) {
5456
}
5557
}
5658
DemoStep::Wait(ms) => {
57-
cx.background_executor().timer(Duration::from_millis(ms)).await;
59+
cx.background_executor()
60+
.timer(Duration::from_millis(ms))
61+
.await;
5862
}
5963
DemoStep::Action(action) => {
6064
run(cx, action);
@@ -63,7 +67,9 @@ fn run_demo(editor: Entity<Editor>, cx: &mut gpui::App) {
6367
}
6468
}
6569

66-
cx.background_executor().timer(Duration::from_millis(500)).await;
70+
cx.background_executor()
71+
.timer(Duration::from_millis(500))
72+
.await;
6773
cx.update(|cx| {
6874
if let Some(wh) = cx.windows().first().copied() {
6975
let _ = cx.update_window(wh, |_, _, cx| {

0 commit comments

Comments
 (0)