summaryrefslogtreecommitdiff
path: root/Assistant/Alert.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/Alert.hs')
-rw-r--r--Assistant/Alert.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index 5877ba069..6b32fde1d 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -247,11 +247,18 @@ sanityCheckFixAlert msg = Alert
combinemessage _ _ = Nothing
addFileAlert :: FilePath -> Alert
-addFileAlert file = (activityAlert (Just "Added") $ takeFileName file)
+addFileAlert file = (activityAlert (Just "Added") $ trim $ takeFileName file)
{ alertName = Just AddFileAlert
, alertCombiner = messageCombiner combinemessage
}
where
+ trim f
+ | len < maxlen = f
+ | otherwise = take half f ++ ".." ++ drop (len - half) f
+ where
+ len = length f
+ maxlen = 20
+ half = (maxlen - 2) `div` 2
combinemessage (StringAlert new) (StringAlert old) =
Just $ StringAlert $
unlines $ take 10 $ new : lines old