fix: target caret excerpts and retain diff viewport offsets
This commit is contained in:
+15
-1
@@ -939,11 +939,25 @@ impl DiffState {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn expand_after_excerpt(&mut self, below: bool, source_row: usize) {
|
||||
let Some(display_row) = self.after_display_row(source_row) else {
|
||||
return;
|
||||
};
|
||||
self.expand_excerpt_at(below, self.display_rows[display_row]);
|
||||
}
|
||||
|
||||
fn expand_excerpt(&mut self, below: bool) {
|
||||
let Some(target) = self.display_rows.get(self.top).copied() else {
|
||||
return;
|
||||
};
|
||||
self.expand_excerpt_at(below, target);
|
||||
}
|
||||
|
||||
fn expand_excerpt_at(&mut self, below: bool, target: DisplayRow) {
|
||||
let Some(top) = self.display_rows.get(self.top).copied() else {
|
||||
return;
|
||||
};
|
||||
let index = match top {
|
||||
let index = match target {
|
||||
DisplayRow::Line(row) => self
|
||||
.excerpt_ranges
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user