glamour icon indicating copy to clipboard operation
glamour copied to clipboard

fix: render right margin for block stack elements

Open jahvon opened this issue 1 year ago • 3 comments

This PR addresses a bug I was encountering with fixing up #324. It updates the way the block stack width is calculated. Instead of multiplying the indent and margin size, those two are added together. That seems to match how those two are used in the MarginWriter used by most block elements.

I also updated the Header so that it uses MarginWriter like the other block elements (so padding and such is applied the same way)

Note: This change does seem to result in a global drop in the rendered width by 1-2 spaces since we're evaluating the width and margin as 0 in most cases.

Fixes: #331

jahvon avatar Aug 07 '24 01:08 jahvon

Here are a couple of images to demonstrate the spacing / padding rendered now:

When setting the padding character in MarginWriter to "+" Screenshot 2024-08-06 at 9 48 15 PM

When updating the document background color Screenshot 2024-08-06 at 9 50 33 PM

jahvon avatar Aug 07 '24 01:08 jahvon

I was looking at this as well but to me it seems like we would have to use margin*2, see my comment for details.

maxmoehl avatar Aug 30 '24 09:08 maxmoehl

I was looking at this as well but to me it seems like we would have to use margin*2, see my comment for details.

Great catch and great explanation @maxmoehl. I'll push up an update here

jahvon avatar Aug 30 '24 21:08 jahvon

Could someone see into merging this? It's a canonical party pooper.

rusq avatar Nov 25 '24 00:11 rusq

hey, thanks for the PR, sorry for the delay on merging it :)

caarlos0 avatar Nov 25 '24 17:11 caarlos0