From 21910da6eb3bad443e1bc923a19edd8e29bdae92 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 3 Nov 2021 17:23:42 -0600 Subject: Display stdin ellipsis only if it makes the string shorter. i.e. would rather show 'My Title' rather than 'My Titl ...' --- src/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index 689411c..020c0f8 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -97,7 +97,7 @@ main = do else case amt of 0 -> trunc' False 0 as acc - 4 -> trunc' False 0 as ("... " ++ acc) + 4 | length as > 3 -> trunc' False 0 as ("... " ++ acc) _ -> trunc' False (amt - 1) as (a : acc) splitOnAll arr str = splitOnAll' arr [str] -- cgit