forge
Explore
Log in

Don't you dare go Hollow

layout: Preserve active column when column to the left is removed

Browse files at this commit

b3b1e082ac16a93f19be01604cd4d764f004267eIvan MolodetskikhParent: 34db4bc
src/layout.rsmodified+10 -1
@@ -1459,12 +1459,21 @@ impl<W: LayoutElement> Workspace<W> {
1459 let window_idx = column.windows.iter().position(|win| win == window).unwrap();1459 let window_idx = column.windows.iter().position(|win| win == window).unwrap();
1460 column.windows.remove(window_idx);1460 column.windows.remove(window_idx);
1461 if column.windows.is_empty() {1461 if column.windows.is_empty() {
1462+ // FIXME: activate_column below computes current view position to compute the new view
1463+ // position, which can include the column we're removing here. This leads to unwanted
1464+ // view jumps.
1462 self.columns.remove(column_idx);1465 self.columns.remove(column_idx);
1463 if self.columns.is_empty() {1466 if self.columns.is_empty() {
1464 return;1467 return;
1465 }1468 }
1466 1469
1467- self.activate_column(min(self.active_column_idx, self.columns.len() - 1));1470+ if self.active_column_idx > column_idx {
1471+ // A column to the left was removed; preserve the current position.
1472+ self.activate_column(self.active_column_idx - 1);
1473+ } else {
1474+ self.activate_column(min(self.active_column_idx, self.columns.len() - 1));
1475+ }
1476+
1468 return;1477 return;
1469 }1478 }
1470 1479