summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Draw
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2023-06-02 23:45:55 +0100
committerjao <jao@gnu.org>2023-06-02 23:45:55 +0100
commitb5e397b1fdb9867b1d4ac599c88ef8b6354b5782 (patch)
tree5623a8dfe37424d6909758747b0794dd4edea08e /src/Xmobar/Draw
parentc9b6bf77415afff2dbd7b8e33ccdd21b771fbec0 (diff)
downloadxmobar-b5e397b1fdb9867b1d4ac599c88ef8b6354b5782.tar.gz
xmobar-b5e397b1fdb9867b1d4ac599c88ef8b6354b5782.tar.bz2
center middle section for templates of the form "}M{" (fixes #677)
Diffstat (limited to 'src/Xmobar/Draw')
-rw-r--r--src/Xmobar/Draw/Cairo.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
index 36f9bde..8dcda5d 100644
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -2,7 +2,7 @@
------------------------------------------------------------------------------
-- |
-- Module: Xmobar.X11.Cairo
--- Copyright: (c) 2022 Jose Antonio Ortega Ruiz
+-- Copyright: (c) 2022, 2023 Jose Antonio Ortega Ruiz
-- License: BSD3-style (see LICENSE)
--
-- Maintainer: jao@gnu.org
@@ -185,7 +185,7 @@ drawSegments dctx surf = do
(lend, as, bx) <- foldM (drawSegment dctx surf dw) (0, [], []) llyts
let [rw, cw] = map sWidth [rlyts, clyts]
rstart = max lend (dw - rw)
- cstart = if lend > 1 then max lend ((dw - cw) / 2.0) else lend
+ cstart = if lend > 1 || rw == 0 then max lend ((dw - cw) / 2.0) else lend
(_, as', bx') <- if cw > 0
then foldM (drawSegment dctx surf rstart) (cstart, as, bx) clyts
else return (0, as, bx)