help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: right aligning a string, using display (space :align-to


From: martianhiatus
Subject: Re: right aligning a string, using display (space :align-to
Date: Fri, 20 Oct 2023 18:06:31 +0200


As the manual says, by default the :align-to expressions are
interpreted as being in character units, i.e. in units of columns, not
pixels.  You need to use (NUMBER) to have NUMBER interpreted as
pixels.  So your second snippet should be changed to

(concat
 (propertize " "
             'display
             `(space :align-to (- right
                                  ,(list (string-pixel-width stats)))))
 str)

and then it will work.

hi eli, thanks. i had tried to (list) the whole expression following :align-to.

it does work, but it still doesn't work with text-scaling. if i increase 
text-scale, my right-aligned string is broken over to the next line, same as 
when not using pixel-width alignment. if i decrease text scaling, my 
right-aligned string is further from the right margin.

i thought the two might be linked, but the behavior is the same.

do you have any ideas about how to not break :align-to while text scaling?

m



--
some writing: https://anarchive.mooo.com
an internets: https://pleasantlybabykid.tumblr.com/
.
xmpp: mousebot@ghost.noho.st
.
gpg pub key: 0x582C8EAF0B0D77C9
fingerprint: DA24 B943 36EF C491 E22F A70B 582C 8EAF 0B0D 77C9



reply via email to

[Prev in Thread] Current Thread [Next in Thread]