@@ -16,7 +16,7 @@ use std::sync::mpsc;
1616static NEXT_EDITOR_ID : AtomicUsize = AtomicUsize :: new ( 0 ) ;
1717
1818use 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 ;
0 commit comments