From ceea03fe5f1d66c345125385afca871e3f6f2d5c Mon Sep 17 00:00:00 2001 From: Avahe Kellenberger Date: Sun, 3 Jul 2022 09:49:16 -0400 Subject: [PATCH] Fixed refactoring error --- src/nimdowpkg/windowmanager.nim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/nimdowpkg/windowmanager.nim b/src/nimdowpkg/windowmanager.nim index 667a3b6..eb49b75 100644 --- a/src/nimdowpkg/windowmanager.nim +++ b/src/nimdowpkg/windowmanager.nim @@ -573,11 +573,14 @@ proc jumpToUrgentWindow(this: WindowManager) = template modWidthDiff(this: WindowManager, diff: int) = var layout = this.selectedMonitor.taggedClients.findFirstSelectedTag.layout if layout of MasterStackLayout: - var masterStackLayout = cast[MasterStackLayout](layout) + let masterStackLayout = cast[MasterStackLayout](layout) let screenWidth = masterStackLayout.calcScreenWidth(this.selectedMonitor.layoutOffset) - if (diff > 0 and masterStackLayout.widthDiff < 0) or (diff < 0 and masterStackLayout.widthDiff > 0): - let clientWidth = masterStackLayout.calcClientWidth(screenWidth).int - if clientWidth - abs(masterStackLayout.widthDiff).int - abs(diff).int > 0: + + if + (diff > 0 and masterStackLayout.widthDiff < 0) or + (diff < 0 and masterStackLayout.widthDiff > 0) or + masterStackLayout.calcClientWidth(screenWidth).int - abs(masterStackLayout.widthDiff).int - abs( + diff).int > 0: masterStackLayout.widthDiff += diff this.selectedMonitor.doLayout()