fix: synchronize horizontal scrolling between diff panes
This commit is contained in:
+14
-4
@@ -615,6 +615,11 @@ impl DiffState {
|
||||
Focus::After => self.max_after,
|
||||
Focus::Files => return 0,
|
||||
};
|
||||
let columns = if self.pane_layout() == PaneLayout::Split {
|
||||
self.max_before.max(self.max_after)
|
||||
} else {
|
||||
columns
|
||||
};
|
||||
left.min(columns.saturating_add(1).saturating_sub(width.max(1)))
|
||||
}
|
||||
|
||||
@@ -630,10 +635,15 @@ impl DiffState {
|
||||
left.saturating_sub(3)
|
||||
};
|
||||
let left = self.bound_horizontal(focus, left, width);
|
||||
match focus {
|
||||
Focus::Before => self.left_before = left,
|
||||
Focus::After => self.left_after = left,
|
||||
Focus::Files => unreachable!(),
|
||||
if self.pane_layout() == PaneLayout::Split {
|
||||
self.left_before = left;
|
||||
self.left_after = left;
|
||||
} else {
|
||||
match focus {
|
||||
Focus::Before => self.left_before = left,
|
||||
Focus::After => self.left_after = left,
|
||||
Focus::Files => unreachable!(),
|
||||
}
|
||||
}
|
||||
self.follow_caret = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user