@ -5,7 +5,7 @@ use std::sync::Arc;
use helix_core ::Rope ;
use helix_core ::Rope ;
use helix_event ::RenderLockGuard ;
use helix_event ::RenderLockGuard ;
use imara_diff ::Algorithm ;
use imara_diff ::Algorithm ;
use parking_lot ::{ Mutex, Mutex Guard} ;
use parking_lot ::{ RwLock, RwLockRead Guard} ;
use tokio ::sync ::mpsc ::{ unbounded_channel , UnboundedSender } ;
use tokio ::sync ::mpsc ::{ unbounded_channel , UnboundedSender } ;
use tokio ::task ::JoinHandle ;
use tokio ::task ::JoinHandle ;
use tokio ::time ::Instant ;
use tokio ::time ::Instant ;
@ -37,7 +37,7 @@ struct DiffInner {
#[ derive(Clone, Debug) ]
#[ derive(Clone, Debug) ]
pub struct DiffHandle {
pub struct DiffHandle {
channel : UnboundedSender < Event > ,
channel : UnboundedSender < Event > ,
diff : Arc < Mutex < DiffInner > > ,
diff : Arc < RwLock < DiffInner > > ,
inverted : bool ,
inverted : bool ,
}
}
@ -48,7 +48,7 @@ impl DiffHandle {
fn new_with_handle ( diff_base : Rope , doc : Rope ) -> ( DiffHandle , JoinHandle < ( ) > ) {
fn new_with_handle ( diff_base : Rope , doc : Rope ) -> ( DiffHandle , JoinHandle < ( ) > ) {
let ( sender , receiver ) = unbounded_channel ( ) ;
let ( sender , receiver ) = unbounded_channel ( ) ;
let diff : Arc < Mutex < DiffInner > > = Arc ::default ( ) ;
let diff : Arc < RwLock < DiffInner > > = Arc ::default ( ) ;
let worker = DiffWorker {
let worker = DiffWorker {
channel : receiver ,
channel : receiver ,
diff : diff . clone ( ) ,
diff : diff . clone ( ) ,
@ -70,7 +70,7 @@ impl DiffHandle {
pub fn load ( & self ) -> Diff {
pub fn load ( & self ) -> Diff {
Diff {
Diff {
diff : self . diff . lock ( ) ,
diff : self . diff . read ( ) ,
inverted : self . inverted ,
inverted : self . inverted ,
}
}
}
}
@ -164,7 +164,7 @@ impl Hunk {
/// non-overlapping order
/// non-overlapping order
#[ derive(Debug) ]
#[ derive(Debug) ]
pub struct Diff < ' a > {
pub struct Diff < ' a > {
diff : Mutex Guard< ' a , DiffInner > ,
diff : RwLockRead Guard< ' a , DiffInner > ,
inverted : bool ,
inverted : bool ,
}
}