aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2021-11-03 17:23:42 -0600
committerJosh Rahm <rahm@google.com>2021-11-03 17:26:36 -0600
commit63b6a57db25652853b574239dc1b8f1f5f614a9e (patch)
tree4d98012884561197bd9092cfa7aede1a4397d7ed /src
parent59f501a195ab437954c748b2feaedbe60b3d4cd5 (diff)
downloadrde-63b6a57db25652853b574239dc1b8f1f5f614a9e.tar.gz
rde-63b6a57db25652853b574239dc1b8f1f5f614a9e.tar.bz2
rde-63b6a57db25652853b574239dc1b8f1f5f614a9e.zip
Display stdin ellipsis only if it makes the string shorter.
i.e. would rather show 'My Title' rather than 'My Titl ...'
Diffstat (limited to 'src')
-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]