tb-keycast
tb-keycast copied to clipboard
Wrong width calculations when font differs in buffer and tab-bar
I discover that all calculations of position and width used to align status string to the right and avoid wrapping are incorrect when tab-bar have different font than buffer.
Its because to calculate width of string in pixels string-pixel-width
function is used. It works by inserting string to temporary buffer and takes measurements there. If your buffer font is for example monospace but tab-bar font use proportional font it will return wrong value.
I believe that to fix this all we need is to apply font used in tab-bar to string before string-pixel-width
function is used.
I believe that to fix this all we need is to apply font used in tab-bar to string before
string-pixel-width
function is used.
This should generally be good enough. However, there are several more edge cases you may encounter. See https://github.com/yantar92/org/blob/feature/org-fold-universal-core/lisp/org-macs.el#L890