20
849
Fork
You've already forked fuzzel
83

key-bindings: overwrite collision with a log warning #429

Closed
Cyclic4179 wants to merge 4 commits from Cyclic4179/fuzzel:keybinds-overwrite into master
pull from: Cyclic4179/fuzzel:keybinds-overwrite
merge into: dnkl:master
dnkl:master
dnkl:gnome-support
dnkl:releases/1.14
dnkl:issue-319-window-switching
dnkl:issue-561-nord-theme-only
dnkl:resvg-filtering-take-2
dnkl:resvg-filtering
dnkl:releases/1.13
dnkl:rehanzo-dont-ignore-execute-648
dnkl:keybinds-overwrite
dnkl:issue-561-refresh-theme
dnkl:ci-automated-testing
dnkl:reenable-legacy-icons
dnkl:releases/1.12
dnkl:test-coverage-for-fzf-caching
dnkl:releases/1.11
dnkl:releases/1.10
dnkl:releases/1.9
dnkl:releases/1.8
dnkl:releases/1.7
dnkl:releases/1.6
dnkl:releases/1.5
dnkl:releases/1.4
dnkl:releases/1.3
dnkl:releases/1.2
dnkl:releases/1.1
dnkl:releases/1.0
First-time contributor
Copy link

fixes #225

fixes #225
Collaborator
Copy link

Sorry, I'm having trouble confirming this causes any log warnings to be printed. Please provide steps to reproduce triggering this logging. Here's what I tried:

echo -e "[key-bindings]\nexecute=y\nexecute=x" >tmp-fuzzel.ini
echo -e "first\nsecond" | fuzzel --dmenu --search second --config tmp-fuzzel.ini 

I defined and used a custom config file which contained

[key-bindings]
execute=y
execute=x

I expected this to trigger the logging, but it did not.

Actually, I expected adding execute=x to file by itself to trigger the logging, because there's a default set for it.

Sorry, I'm having trouble confirming this causes any log warnings to be printed. Please provide steps to reproduce triggering this logging. Here's what I tried: ``` echo -e "[key-bindings]\nexecute=y\nexecute=x" >tmp-fuzzel.ini echo -e "first\nsecond" | fuzzel --dmenu --search second --config tmp-fuzzel.ini ``` I defined and used a custom config file which contained ``` [key-bindings] execute=y execute=x ``` I expected this to trigger the logging, but it did not. Actually, I expected adding `execute=x` to file by itself to trigger the logging, because there's a default set for it.
Author
First-time contributor
Copy link

I only implemented a behavioural change on key-conflicts (where previously an error was logged and the new keymap was ignored)

fuzzel --config <(echo $'[key-bindings]\ndelete-line-backward=Return') --dmenu --search test

Hitting enter now deletes the line.

(BTW: not sure if the order of struct config_key_binding_list *bindings should be preserved because remove_from_key_bindings_list assumes this I think, but its only called before resolve_key_binding_collisions in which the order might change so it should be fine)

I only implemented a behavioural change on key-conflicts (where previously an error was logged and the new keymap was ignored) ```sh fuzzel --config <(echo $'[key-bindings]\ndelete-line-backward=Return') --dmenu --search test ``` Hitting enter now deletes the line. (BTW: not sure if the order of `struct config_key_binding_list *bindings` should be preserved because `remove_from_key_bindings_list` assumes this I think, but its only called before `resolve_key_binding_collisions` in which the order might change so it should be fine)
Author
First-time contributor
Copy link

Okay, so you also want a warning on remap. I could do that as well

Okay, so you also want a warning on remap. I could do that as well
Cyclic4179 force-pushed keybinds-overwrite from 87f56d24ca
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to c6985a536e
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024年10月07日 17:32:23 +02:00
Compare
Author
First-time contributor
Copy link

Is this what you had in mind @markstos ?

Is this what you had in mind @markstos ?
Collaborator
Copy link

This looks good to me. I added some test coverage for it here:

#432

Am I correct that this will start to produce warnings about overrides that people didn't get before?

I think I'm OK with that. The default log level is warning. And can easily be changed by setting log-level=info in the config file.

The warning level still seems like a good default as it may help surface problems when they are getting fuzzel set up.

@dnkl can give a final review.

Here's an example of what that the warning output will look like now for both remapping some default bindings and remapping a user binding.

warn: config.c:322: unmapping default keybinding: execute: was previously triggered by Return
warn: config.c:322: unmapping default keybinding: execute: was previously triggered by KP_Enter
warn: config.c:322: unmapping default keybinding: execute: was previously triggered by Control+y
warn: config.c:327: unmapping keybinding defined at tmp-fuzzel.ini:2: execute: was previously triggered by y
This looks good to me. I added some test coverage for it here: https://codeberg.org/dnkl/fuzzel/pulls/432 Am I correct that this will start to produce warnings about overrides that people didn't get before? I think I'm OK with that. The default log level is warning. And can easily be changed by setting `log-level=info` in the config file. The warning level still seems like a good default as it may help surface problems when they are getting fuzzel set up. @dnkl can give a final review. Here's an example of what that the warning output will look like now for both remapping some default bindings and remapping a user binding. ``` warn: config.c:322: unmapping default keybinding: execute: was previously triggered by Return warn: config.c:322: unmapping default keybinding: execute: was previously triggered by KP_Enter warn: config.c:322: unmapping default keybinding: execute: was previously triggered by Control+y warn: config.c:327: unmapping keybinding defined at tmp-fuzzel.ini:2: execute: was previously triggered by y ```
Author
First-time contributor
Copy link

I just noticed this warning will be triggered even if unmapping with "none" as in

fuzzel --config <(echo $'[key-bindings]\nexecute=none')

Should there also some sort of log, eg info or nothing?

I just noticed this warning will be triggered even if unmapping with "none" as in ```sh fuzzel --config <(echo $'[key-bindings]\nexecute=none') ``` Should there also some sort of log, eg info or nothing?
cleanup
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline is pending approval
de6702db1a
Collaborator
Copy link

Closing in favor of #432.

Closing in favor of #432.
markstos closed this pull request 2025年06月14日 19:15:32 +02:00
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline is pending approval

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fuzzel!429
Reference in a new issue
dnkl/fuzzel
No description provided.
Delete branch "Cyclic4179/fuzzel:keybinds-overwrite"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?