X.A.CycleRecentWS: Simplify/fix unView

To make this more "obviously correct", make it resemble the `view`
implementation, just do the exact reverse. Now the only complex bit is
the "undelete" operation.

This also fixes another issue: state was only preserved in the focused
workspace, but it may have changed in another visible workspace as well.
The property test is updated to test this.
This commit is contained in:
Tomas Janousek
2021-05-14 00:35:30 +01:00
committed by slotThe
parent 24786c6d04
commit 12b30c393c
2 changed files with 25 additions and 32 deletions

View File

@@ -6,7 +6,7 @@ import Test.Hspec.QuickCheck
import Test.QuickCheck
import XMonad.Actions.CycleRecentWS (unView)
import XMonad.StackSet (view)
import XMonad.StackSet (view, mapLayout)
import Instances
import Utils (tags)
@@ -17,4 +17,7 @@ spec = do
prop_unView :: T -> Property
prop_unView ss = conjoin
[ counterexample (show t) (unView ss (view t ss) === ss) | t <- tags ss ]
[ counterexample (show t) (unView ss (state (view t ss)) === state ss)
| t <- tags ss ]
where
state = mapLayout succ