From 05672f6110bbf90b27a4533022fc23f2df292d30 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 8 Aug 2020 01:35:26 +0100 Subject: Fix: don't go below zero in indexed bars --- src/Xmobar/Plugins/Monitors/Common/Output.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Xmobar/Plugins/Monitors') diff --git a/src/Xmobar/Plugins/Monitors/Common/Output.hs b/src/Xmobar/Plugins/Monitors/Common/Output.hs index 4733a9f..3c18e87 100644 --- a/src/Xmobar/Plugins/Monitors/Common/Output.hs +++ b/src/Xmobar/Plugins/Monitors/Common/Output.hs @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------ -- | -- Module: Xmobar.Plugins.Monitors.Strings --- Copyright: (c) 2018, 2019 Jose Antonio Ortega Ruiz +-- Copyright: (c) 2018, 2019, 2020 Jose Antonio Ortega Ruiz -- License: BSD3-style (see LICENSE) -- -- Maintainer: jao@gnu.org @@ -224,7 +224,7 @@ showPercentBar v x = do let c = bw < 1 w = if c then length bf else bw len = min w $ round (fromIntegral w * x) - bfs = if c then [bf !! (len - 1)] else take len $ cycle bf + bfs = if c then [bf !! max 0 (len - 1)] else take len $ cycle bf s <- colorizeString v bfs return $ s ++ if c then "" else take (bw - len) (cycle bb) -- cgit v1.2.3