summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Draw
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-12-31 00:20:20 +0000
committerjao <jao@gnu.org>2022-12-31 00:20:20 +0000
commit01c545188e1904406b1afddde29ca8deefa5216a (patch)
tree2e764d7e8c28a7d7b96b324b098257e1b1bbdef7 /src/Xmobar/Draw
parentd896b1a80f3bc5dc487971b1230cd2b4185b9404 (diff)
downloadxmobar-01c545188e1904406b1afddde29ca8deefa5216a.tar.gz
xmobar-01c545188e1904406b1afddde29ca8deefa5216a.tar.bz2
layout: special case for empty left segment (see #655)
Diffstat (limited to 'src/Xmobar/Draw')
-rw-r--r--src/Xmobar/Draw/Cairo.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Xmobar/Draw/Cairo.hs b/src/Xmobar/Draw/Cairo.hs
index 43276eb..36f9bde 100644
--- a/src/Xmobar/Draw/Cairo.hs
+++ b/src/Xmobar/Draw/Cairo.hs
@@ -185,8 +185,10 @@ 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 = max lend ((dw - cw) / 2.0)
- (_, as', bx') <- foldM (drawSegment dctx surf rstart) (cstart, as, bx) clyts
+ cstart = if lend > 1 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)
(_, as'', bx'') <- foldM (drawSegment dctx surf dw) (rstart, as', bx') rlyts
drawBoxes dctx surf (reverse bx'')
when (C.borderWidth conf > 0) (drawBorder conf dw dh surf)