[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51995: 29.0.50; `string-pixel-width' depends on the current window w
From: |
Brahimi Saifullah |
Subject: |
bug#51995: 29.0.50; `string-pixel-width' depends on the current window width |
Date: |
Sat, 20 Nov 2021 18:36:46 -0300 |
>What is the actual real-life situation where
>this is needed?
Mainly when a window with delicated alignment is resized.
Indeed, in most situations it likely won't be an issue,
but I can think of times when it most definitely will:
For example, in the package I'm working on,
I want certain text to always be centered,
even if the user resizes the window.
(By centered I mean having the same amount of space on both sides).
This is a mockup of the code I use:
(let* ((string "Hello World, Hello World, Hello world")
(width (string-pixel-width string)))
(insert
(propertize " "
'display
`(space :align-to (- center (,(/ width 2)))))
string))
If you evaluate this code in a window that is bigger or equal
to the size of the string, it will be properly aligned even if
you resize it later. But if you evaluate it in a small window,
it will be grossly misaligned when you increase the window size.
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width, Brahimi Saifullah, 2021/11/20
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width, Eli Zaretskii, 2021/11/20
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width, martin rudalics, 2021/11/20
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width,
Brahimi Saifullah <=
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width, Brahimi Saifullah, 2021/11/20
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width, Brahimi Saifullah, 2021/11/21
- bug#51995: 29.0.50; `string-pixel-width' depends on the current window width, Brahimi Saifullah, 2021/11/21