Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(treemacs): inherit from variable-pitch face at most once #844

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haselwarter
Copy link

The function doom-themes-enable-treemacs-variable-pitch-labels is
executed every time load-theme gets called.

Before this fix, each invocation would lead to the treemacs-*-faces
gaining an :inherit doom-themes-treemacs-variable-pitch-face
attribute. But inheriting from a face is not an idempotent operation,
i.e., applying it more than once will lead to a different effect than
applying it exactly once. For instance, if the face variable-pitch has
the attribute :height 1.2, then inheriting from it 4 times will lead
to a height of 1.2^4 ≈ 2 instead of 1.2. Loading 4 themes will therefore
inadvertently double the font size in the treemacs buffer.

With this fix, the inheritance is only applied once.


The function `doom-themes-enable-treemacs-variable-pitch-labels` is executed every time `load-theme` gets called. 

Before this fix, each invocation would lead to the treemacs-*-faces gaining an `:inherit doom-themes-treemacs-variable-pitch-face` attribute. But inheriting from a face is not an idempotent operation, i.e., applying it more than once will lead to a different effect than applying it exactly once. For instance, if the face `variable-pitch` has the attribute `:height 1.2`, then inheriting from it 4 times will lead to a height of 1.2^4 ≈ 2 instead of 1.2. Loading 4 themes will therefore inadvertently double the font size in the treemacs buffer.

With this fix, the inheritance is only applied once.
@hlissner hlissner added is:bug Something isn't working as intended re:treemacs labels Nov 1, 2024
@hlissner hlissner added this to the v2.4.0 milestone Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Something isn't working as intended re:treemacs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants