GTK: avoid subsequent duplicate entries in history

This commit is contained in:
Julian Ospald 2016-04-20 17:27:47 +02:00
parent 7608d838aa
commit 0ff24002e5
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28

View File

@ -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