Skip to content

Commit c74fec4

Browse files
committed
fix?: do not block on the main thread when acquiring diff handle
not sure if this will work as I can't reproduce this but let's see!
1 parent e8d7e76 commit c74fec4

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

helix-vcs/src/diff.rs

+7
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ impl DiffHandle {
7575
}
7676
}
7777

78+
pub fn try_load(&self) -> Option<Diff> {
79+
Some(Diff {
80+
diff: self.diff.try_read()?,
81+
inverted: self.inverted,
82+
})
83+
}
84+
7885
/// Updates the document associated with this redraw handle
7986
/// This function is only intended to be called from within the rendering loop
8087
/// if called from elsewhere it may fail to acquire the render lock and panic

helix-view/src/document.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ impl Document {
15901590
// file in the file system into what gix::blame knows about (gix::blame only
15911591
// knows about commit history, it does not know about uncommitted changes)
15921592
diff_handle
1593-
.load()
1593+
.try_load()?
15941594
.hunks_intersecting_line_ranges(std::iter::once((0, cursor_line as usize)))
15951595
.try_fold(
15961596
(0, 0),

0 commit comments

Comments
 (0)