Skip to content

Fix set_background_opacity with increment/decrement#1147

Merged
kovidgoyal merged 1 commit intokovidgoyal:masterfrom
kdarkhan:fix-set-background-opacity
Nov 17, 2018
Merged

Fix set_background_opacity with increment/decrement#1147
kovidgoyal merged 1 commit intokovidgoyal:masterfrom
kdarkhan:fix-set-background-opacity

Conversation

@kdarkhan
Copy link
Contributor

There is a logic error in set_background_opacity which breaks increment/decrement handling.
This commit fixes it.

@max-baz
Copy link
Contributor

max-baz commented Nov 17, 2018

Can you describe this logic error? It's not obvious to me even now 🙂

@kdarkhan
Copy link
Contributor Author

kdarkhan commented Nov 17, 2018

Sure. Putting this into my config

map kitty_mod+9    set_background_opacity +0.1
map kitty_mod+8    set_background_opacity -0.1

I would expect the first shortcut to increment, and second to decrement the current opacity.
However because
opacity = background_opacity_of(os_window_id)
overrides the passed in opacity parameter, and later
opacity += float(opacity) just doubles the effective opacity instead of incrementing/decrementing it.

@kovidgoyal kovidgoyal merged commit 55e4761 into kovidgoyal:master Nov 17, 2018
@kdarkhan kdarkhan deleted the fix-set-background-opacity branch November 17, 2018 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants