From 301a2c06613c76d2c16a85ab21ad132e5618454b Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 9 Apr 2024 22:34:41 +0400 Subject: layout: Fix view jumps when removing a window on the left --- src/layout/workspace.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/layout') diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index f337a74a..ab23a1f0 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -767,9 +767,6 @@ impl Workspace { self.activate_prev_column_on_removal = None; } - // FIXME: activate_column below computes current view position to compute the new view - // position, which can include the column we're removing here. This leads to unwanted - // view jumps. self.columns.remove(column_idx); if self.columns.is_empty() { return window; @@ -778,7 +775,8 @@ impl Workspace { if column_idx < self.active_column_idx { // A column to the left was removed; preserve the current position. // FIXME: preserve activate_prev_column_on_removal. - self.activate_column(self.active_column_idx - 1); + self.active_column_idx -= 1; + self.activate_prev_column_on_removal = None; } else if column_idx == self.active_column_idx && self.activate_prev_column_on_removal.is_some() { @@ -822,9 +820,6 @@ impl Workspace { self.activate_prev_column_on_removal = None; } - // FIXME: activate_column below computes current view position to compute the new view - // position, which can include the column we're removing here. This leads to unwanted - // view jumps. if self.columns.is_empty() { return column; } @@ -832,7 +827,8 @@ impl Workspace { if column_idx < self.active_column_idx { // A column to the left was removed; preserve the current position. // FIXME: preserve activate_prev_column_on_removal. - self.activate_column(self.active_column_idx - 1); + self.active_column_idx -= 1; + self.activate_prev_column_on_removal = None; } else if column_idx == self.active_column_idx && self.activate_prev_column_on_removal.is_some() { -- cgit