feat(list): Add --enter-response option for separate Enter key exit code#322
Open
mg-dev25 wants to merge 1 commit intov1cont:masterfrom
Open
feat(list): Add --enter-response option for separate Enter key exit code#322mg-dev25 wants to merge 1 commit intov1cont:masterfrom
mg-dev25 wants to merge 1 commit intov1cont:masterfrom
Conversation
Add a new --enter-response option that allows setting a different exit code for the Enter key versus Ctrl+Enter in list dialogs. This enables workflows where Enter and Ctrl+Enter need to trigger different actions. Behavior: - Ctrl+Enter: Always exits with --response value (default: 0) - Enter (without dclick-action): Exits with --enter-response if set, otherwise falls back to --response for backward compatibility - Enter (with dclick-action): Unchanged, triggers double-click action The --enter-response defaults to -1 (unset), maintaining full backward compatibility with existing scripts. Example usage: yad --list --response=10 --enter-response=0 ... # Enter exits with 0, Ctrl+Enter exits with 10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--enter-responseoption allowing separate exit codes for Enter vs Ctrl+Enter in list dialogs.Use Case
When building interactive dialogs, it can be useful to have Enter and Ctrl+Enter trigger different actions:
Currently both keys return the same
--responsevalue, making differentiation impossible.Implementation
Three files changed:
yad.h: Addedenter_respfield toYadDatastructureoption.c: Added--enter-responseoption (defaults to -1)list.c: Modifiedlist_activate_cbto useenter_respfor plain EnterBehavior Table
--responsevalue (unchanged)--enter-responseif set, otherwise--responseExample
yad --list --response=10 --enter-response=0 --column=Option Item1 Item2 # Enter returns 0, Ctrl+Enter returns 10Backward Compatibility
--enter-responsedefaults to -1 (unset), so existing scripts continue to work unchanged.