aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-03 17:23:42 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:45 -0600
commit21910da6eb3bad443e1bc923a19edd8e29bdae92 (patch)
tree4d98012884561197bd9092cfa7aede1a4397d7ed
parent3793479ac06bca54653c1aca0019e3100b334ef1 (diff)
downloadrde-21910da6eb3bad443e1bc923a19edd8e29bdae92.tar.gz
rde-21910da6eb3bad443e1bc923a19edd8e29bdae92.tar.bz2
rde-21910da6eb3bad443e1bc923a19edd8e29bdae92.zip
Display stdin ellipsis only if it makes the string shorter.
i.e. would rather show 'My Title' rather than 'My Titl ...'
-rw-r--r--src/Main.hs2
1 files changed, 1 insertions, 1 deletions
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]