Skip to content

Commit

Permalink
hCenterWith: account for centered image width properly when computing…
Browse files Browse the repository at this point in the history
… additional right padding (see also #520)
  • Loading branch information
jtdaugherty committed Dec 1, 2024
1 parent 5776b29 commit 288c08f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Brick/Widgets/Center.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ hCenterWith mChar p =
c <- getContext
let rWidth = result^.imageL.to imageWidth
rHeight = result^.imageL.to imageHeight
remainder = max 0 $ c^.availWidthL - (leftPaddingAmount * 2)
remainder = max 0 $ c^.availWidthL - (rWidth + (leftPaddingAmount * 2))
leftPaddingAmount = max 0 $ (c^.availWidthL - rWidth) `div` 2
rightPaddingAmount = max 0 $ leftPaddingAmount + remainder
leftPadding = charFill (c^.attrL) ch leftPaddingAmount rHeight
Expand Down

0 comments on commit 288c08f

Please sign in to comment.