From b13f022708643324e920d1d94aa80d0210ba941a Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Wed, 16 Jan 2019 08:18:57 -0800 Subject: [PATCH] Stop stripping trailing zeros from duration in 3.0 Fixes #184 --- fish_right_prompt.fish | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fish_right_prompt.fish b/fish_right_prompt.fish index 27dce7c..d44114e 100644 --- a/fish_right_prompt.fish +++ b/fish_right_prompt.fish @@ -42,11 +42,15 @@ function __bobthefish_pretty_ms -S -a ms interval -d 'Millisecond formatting for end switch $FISH_VERSION - # Fish 2.3 and lower doesn't know about the -s argument to math. case 2.0.\* 2.1.\* 2.2.\* 2.3.\* + # Fish 2.3 and lower doesn't know about the -s argument to math. math "scale=$scale;$ms/$interval_ms" | string replace -r '\\.?0*$' $interval - case \* + case 2.\* + # Fish 2.x always returned a float when given the -s argument. math -s$scale "$ms/$interval_ms" | string replace -r '\\.?0*$' $interval + case \* + math -s$scale "$ms/$interval_ms" + echo -ns $interval end end