summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-08-08 01:35:26 +0100
committerjao <jao@gnu.org>2020-08-08 01:35:26 +0100
commit05672f6110bbf90b27a4533022fc23f2df292d30 (patch)
treec8d32a1242055d91ccaa74c8bda0b41e03b50b51
parent6b8a1822c816c1d060f5d49228494b61503dfcd0 (diff)
downloadxmobar-05672f6110bbf90b27a4533022fc23f2df292d30.tar.gz
xmobar-05672f6110bbf90b27a4533022fc23f2df292d30.tar.bz2
Fix: don't go below zero in indexed bars
-rw-r--r--src/Xmobar/Plugins/Monitors/Common/Output.hs4
1 files changed, 2 insertions, 2 deletions
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)