fixes #225
key-bindings: overwrite collision with a log warning #429
Cyclic4179/fuzzel:keybinds-overwrite into master
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.
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)
Okay, so you also want a warning on remap. I could do that as well
87f56d24ca
c6985a536e
Is this what you had in mind @markstos ?
This looks good to me. I added some test coverage for it here:
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
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?
Closing in favor of #432.
No due date set.
No dependencies set.
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?