X.L.MultiColumns bugfix and formating

Fix bug where a column list of insufficient length could be used to find the column of the window. Also fix formating to conform better with standards.
This commit is contained in:
Anders Engstrom 2009-10-27 13:17:41 +00:00
parent 3fd77f5386
commit 6e84273e03

View File

@ -83,7 +83,7 @@ instance LayoutClass MultiCol a where
-- Make sure the list of columns is big enough and update active column
nw = multiColNWin l ++ repeat (multiColDefWin l)
l' = l { multiColNWin = take (max (length $ multiColNWin l) $ getCol (wlen-1) nw + 1) nw
, multiColActive = getCol (length $ W.up s) (multiColNWin l)
, multiColActive = getCol (length $ W.up s) nw
}
-- Only return new layout if it has been modified
resl = if l'==l
@ -94,8 +94,7 @@ instance LayoutClass MultiCol a where
,fmap incmastern (fromMessage m)]
where resize Shrink = l { multiColSize = max (-0.5) $ s-ds }
resize Expand = l { multiColSize = min 1 $ s+ds }
incmastern (IncMasterN x)
= l { multiColNWin = take a n ++ [newval] ++ tail r }
incmastern (IncMasterN x) = l { multiColNWin = take a n ++ [newval] ++ tail r }
where newval = max 0 $ head r + x
r = drop a n
n = multiColNWin l
@ -105,7 +104,7 @@ instance LayoutClass MultiCol a where
description _ = "MultiCol"
-- Get which column a window is in.
-- | Get which column a window is in, starting at 0.
getCol :: Int -> [Int] -> Int
getCol w (n:ns) = if n<1 || w < n
then 0