GTK: avoid subsequent duplicate entries in history
This commit is contained in:
parent
7608d838aa
commit
0ff24002e5
@ -152,8 +152,10 @@ rawPathToItem myview tp = do
|
||||
|
||||
-- |Makes sure the list is max 5. This is probably not very efficient
|
||||
-- but we don't care, since it's a small list anyway.
|
||||
addHistory :: a -> [a] -> [a]
|
||||
addHistory i xs
|
||||
addHistory :: Eq a => a -> [a] -> [a]
|
||||
addHistory i [] = [i]
|
||||
addHistory i xs@(x:_)
|
||||
| i == x = xs
|
||||
| length xs == maxLength = i : take (maxLength - 1) xs
|
||||
| otherwise = i : xs
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user