@@ -1527,6 +1527,7 @@ impl Buffer {
1527
1527
}
1528
1528
1529
1529
fn did_finish_parsing ( & mut self , syntax_snapshot : SyntaxSnapshot , cx : & mut Context < Self > ) {
1530
+ self . was_changed ( ) ;
1530
1531
self . non_text_state_update_count += 1 ;
1531
1532
self . syntax_map . lock ( ) . did_parse ( syntax_snapshot) ;
1532
1533
self . request_autoindent ( cx) ;
@@ -1968,7 +1969,12 @@ impl Buffer {
1968
1969
/// This allows downstream code to check if the buffer's text has changed without
1969
1970
/// waiting for an effect cycle, which would be required if using eents.
1970
1971
pub fn record_changes ( & mut self , bit : rc:: Weak < Cell < bool > > ) {
1971
- self . change_bits . push ( bit) ;
1972
+ if let Err ( ix) = self
1973
+ . change_bits
1974
+ . binary_search_by_key ( & rc:: Weak :: as_ptr ( & bit) , rc:: Weak :: as_ptr)
1975
+ {
1976
+ self . change_bits . insert ( ix, bit) ;
1977
+ }
1972
1978
}
1973
1979
1974
1980
fn was_changed ( & mut self ) {
@@ -2273,12 +2279,13 @@ impl Buffer {
2273
2279
}
2274
2280
2275
2281
fn did_edit ( & mut self , old_version : & clock:: Global , was_dirty : bool , cx : & mut Context < Self > ) {
2282
+ self . was_changed ( ) ;
2283
+
2276
2284
if self . edits_since :: < usize > ( old_version) . next ( ) . is_none ( ) {
2277
2285
return ;
2278
2286
}
2279
2287
2280
2288
self . reparse ( cx) ;
2281
-
2282
2289
cx. emit ( BufferEvent :: Edited ) ;
2283
2290
if was_dirty != self . is_dirty ( ) {
2284
2291
cx. emit ( BufferEvent :: DirtyChanged ) ;
@@ -2390,7 +2397,6 @@ impl Buffer {
2390
2397
}
2391
2398
self . text . apply_ops ( buffer_ops) ;
2392
2399
self . deferred_ops . insert ( deferred_ops) ;
2393
- self . was_changed ( ) ;
2394
2400
self . flush_deferred_ops ( cx) ;
2395
2401
self . did_edit ( & old_version, was_dirty, cx) ;
2396
2402
// Notify independently of whether the buffer was edited as the operations could include a
0 commit comments