@@ -359,7 +359,7 @@ pub enum BufferEvent {
359359 is_local : bool ,
360360 } ,
361361 /// The buffer was edited.
362- Edited ,
362+ Edited { is_local : bool } ,
363363 /// The buffer's `dirty` bit changed.
364364 DirtyChanged ,
365365 /// The buffer was saved.
@@ -2457,7 +2457,7 @@ impl Buffer {
24572457 false
24582458 } ;
24592459 if let Some ( ( transaction_id, start_version) ) = self . text . end_transaction_at ( now) {
2460- self . did_edit ( & start_version, was_dirty, cx) ;
2460+ self . did_edit ( & start_version, was_dirty, true , cx) ;
24612461 Some ( transaction_id)
24622462 } else {
24632463 None
@@ -2844,15 +2844,21 @@ impl Buffer {
28442844 Some ( edit_id)
28452845 }
28462846
2847- fn did_edit ( & mut self , old_version : & clock:: Global , was_dirty : bool , cx : & mut Context < Self > ) {
2847+ fn did_edit (
2848+ & mut self ,
2849+ old_version : & clock:: Global ,
2850+ was_dirty : bool ,
2851+ is_local : bool ,
2852+ cx : & mut Context < Self > ,
2853+ ) {
28482854 self . was_changed ( ) ;
28492855
28502856 if self . edits_since :: < usize > ( old_version) . next ( ) . is_none ( ) {
28512857 return ;
28522858 }
28532859
28542860 self . reparse ( cx, true ) ;
2855- cx. emit ( BufferEvent :: Edited ) ;
2861+ cx. emit ( BufferEvent :: Edited { is_local } ) ;
28562862 if was_dirty != self . is_dirty ( ) {
28572863 cx. emit ( BufferEvent :: DirtyChanged ) ;
28582864 }
@@ -2964,7 +2970,7 @@ impl Buffer {
29642970 self . text . apply_ops ( buffer_ops) ;
29652971 self . deferred_ops . insert ( deferred_ops) ;
29662972 self . flush_deferred_ops ( cx) ;
2967- self . did_edit ( & old_version, was_dirty, cx) ;
2973+ self . did_edit ( & old_version, was_dirty, false , cx) ;
29682974 // Notify independently of whether the buffer was edited as the operations could include a
29692975 // selection update.
29702976 cx. notify ( ) ;
@@ -3119,7 +3125,7 @@ impl Buffer {
31193125
31203126 if let Some ( ( transaction_id, operation) ) = self . text . undo ( ) {
31213127 self . send_operation ( Operation :: Buffer ( operation) , true , cx) ;
3122- self . did_edit ( & old_version, was_dirty, cx) ;
3128+ self . did_edit ( & old_version, was_dirty, true , cx) ;
31233129 self . restore_encoding_for_transaction ( transaction_id, was_dirty) ;
31243130 Some ( transaction_id)
31253131 } else {
@@ -3137,7 +3143,7 @@ impl Buffer {
31373143 let old_version = self . version . clone ( ) ;
31383144 if let Some ( operation) = self . text . undo_transaction ( transaction_id) {
31393145 self . send_operation ( Operation :: Buffer ( operation) , true , cx) ;
3140- self . did_edit ( & old_version, was_dirty, cx) ;
3146+ self . did_edit ( & old_version, was_dirty, true , cx) ;
31413147 true
31423148 } else {
31433149 false
@@ -3159,7 +3165,7 @@ impl Buffer {
31593165 self . send_operation ( Operation :: Buffer ( operation) , true , cx) ;
31603166 }
31613167 if undone {
3162- self . did_edit ( & old_version, was_dirty, cx)
3168+ self . did_edit ( & old_version, was_dirty, true , cx)
31633169 }
31643170 undone
31653171 }
@@ -3169,7 +3175,7 @@ impl Buffer {
31693175 let operation = self . text . undo_operations ( counts) ;
31703176 let old_version = self . version . clone ( ) ;
31713177 self . send_operation ( Operation :: Buffer ( operation) , true , cx) ;
3172- self . did_edit ( & old_version, was_dirty, cx) ;
3178+ self . did_edit ( & old_version, was_dirty, true , cx) ;
31733179 }
31743180
31753181 /// Manually redoes a specific transaction in the buffer's redo history.
@@ -3179,7 +3185,7 @@ impl Buffer {
31793185
31803186 if let Some ( ( transaction_id, operation) ) = self . text . redo ( ) {
31813187 self . send_operation ( Operation :: Buffer ( operation) , true , cx) ;
3182- self . did_edit ( & old_version, was_dirty, cx) ;
3188+ self . did_edit ( & old_version, was_dirty, true , cx) ;
31833189 self . restore_encoding_for_transaction ( transaction_id, was_dirty) ;
31843190 Some ( transaction_id)
31853191 } else {
@@ -3220,7 +3226,7 @@ impl Buffer {
32203226 self . send_operation ( Operation :: Buffer ( operation) , true , cx) ;
32213227 }
32223228 if redone {
3223- self . did_edit ( & old_version, was_dirty, cx)
3229+ self . did_edit ( & old_version, was_dirty, true , cx)
32243230 }
32253231 redone
32263232 }
@@ -3330,7 +3336,7 @@ impl Buffer {
33303336 if !ops. is_empty ( ) {
33313337 for op in ops {
33323338 self . send_operation ( Operation :: Buffer ( op) , true , cx) ;
3333- self . did_edit ( & old_version, was_dirty, cx) ;
3339+ self . did_edit ( & old_version, was_dirty, true , cx) ;
33343340 }
33353341 }
33363342 }
0 commit comments