From a58fa04e4f62990ff93618fdb7334896935ad89b Mon Sep 17 00:00:00 2001 From: weiss Date: Tue, 19 Mar 2024 16:19:25 +0100 Subject: [PATCH] LabeledFamily: make remove member number if it is equal to 1 --- src/WorkspaceFamily.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/WorkspaceFamily.hs b/src/WorkspaceFamily.hs index d7ff78e..ab370f6 100644 --- a/src/WorkspaceFamily.hs +++ b/src/WorkspaceFamily.hs @@ -68,11 +68,14 @@ allLabeledFamilies = , ("聊", "y") , ("设", "n") , ("记", "-") + , (scratchpadWorkspaceTag, "0") ] instance Family LabeledFamily where fName (LabeledFamily name _) = name fPrefix = fName + idWithMember f (FamilyMember 1) = fPrefix f + idWithMember f m = fPrefix f <> show m instance Node LabeledFamily where workspaceID = fullID @@ -83,7 +86,6 @@ class Family a where fName :: a -> FamilyName fPrefix :: a -> String idWithMember :: a -> FamilyMember -> WorkspaceId - idWithMember f = (fPrefix f <>) . show hasWorkspace :: a -> WorkspaceId -> Bool hasWorkspace f ws = fPrefix f `isPrefixOf` ws fullID :: a -> X WorkspaceId @@ -93,6 +95,7 @@ data GFamily = forall a. (Family a) => GFamily a instance Family GFamily where fName (GFamily f) = fName f fPrefix (GFamily f) = fPrefix f + idWithMember (GFamily f) = idWithMember f allFamilies :: [GFamily] allFamilies = (allLabeledFamilies <&> GFamily) <> (allNumberedFamilies <&> GFamily) @@ -198,9 +201,7 @@ swapElements n m (x : xs) numToKey :: Int -> String numToKey s = ["m", ",", ".", "j", "k", "l", "u", "i", "o", "-"] !! (s - 1) -myWorkspaces = - scratchpadWorkspaceTag - : [idWithMember f m | f <- allFamilies, m <- allFamilyMembers] +myWorkspaces = [idWithMember f m | f <- allFamilies, m <- allFamilyMembers] logWorkspaceFamilies :: Logger logWorkspaceFamilies = do