fbwhiptail: implement missing whiptail-compatible features#2075
Open
tlaurion wants to merge 1 commit intolinuxboot:masterfrom
Open
fbwhiptail: implement missing whiptail-compatible features#2075tlaurion wants to merge 1 commit intolinuxboot:masterfrom
tlaurion wants to merge 1 commit intolinuxboot:masterfrom
Conversation
Add a patch against fbwhiptail 1.3 that brings it to feature parity with newt's whiptail for the options used by Heads scripts: Bugs fixed: - --output-fd: output was always hardcoded to stderr; now uses fdopen() on the specified fd (default 2 keeps existing behaviour) - backtitle: parsed but never passed to the draw layer (parse preserved, rendering to follow in a future patch) New modes: - --infobox: renders once and exits immediately (no interaction) - --inputbox: live text entry with printable char / backspace handling; Enter confirms, Escape cancels (unless --nocancel) - --passwordbox: same as inputbox, characters masked as '*' - --textbox: loads file content into scrollable text surface; Page Up / Page Down scroll, Enter / Escape close - --radiolist: single-selection list with [*]/[ ] markers; Space selects - --checklist: multi-selection list with [X]/[ ] markers; Space toggles New flags: - --nocancel: suppresses double-Escape cancel in all modes - --defaultno: yesno dialog starts with No selected - --separate-output: checklist emits one tag per line instead of "a" "b" Previously-silenced but accepted options: - --scrolltext, --fullbuttons / --fb: no longer trigger "unknown argument" Internal changes to fbwhiptail_menu.c / fbwhiptail_menu.h: - whiptail_mode enum moved before Menu struct (forward-declaration fix) - refresh_text_surface() made non-static, renamed menu_refresh_text(), clears the surface before redrawing to prevent ghost text on scroll - Menu struct gains: input_buf, input_len, password, nocancel, mode - whiptail_menu_item gains: status field (checklist/radiolist state) - whiptail_args gains: nocancel, defaultno, separate_output - load_text_from_file() and menu_refresh_text() exported in header Signed-off-by: Thierry Laurion <insurgo@riseup.net>
There was a problem hiding this comment.
Pull request overview
Adds a Heads build patch against fbwhiptail 1.3 to improve whiptail compatibility for dialogs used by initrd scripts (new dialog modes/flags plus a fix for --output-fd).
Changes:
- Implements additional whiptail dialog modes (e.g., infobox/inputbox/passwordbox/textbox/checklist/radiolist) and related flags (
--nocancel,--defaultno,--separate-output). - Fixes
--output-fdhandling by writing results to the requested FD viafdopen(). - Refactors/extends menu internals (mode enum placement, exported text refresh + file loader, new per-item status and input state).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+690
to
+691
| printf ("\033c"); | ||
| fflush (stdout); |
| i += 4; | ||
| args->mode = MODE_MENU; | ||
| - args->items = malloc (sizeof(whiptail_menu_item) * (argc - i) / 2); | ||
| + args->items = malloc (sizeof(whiptail_menu_item) * (argc - i) / 2 + 1); |
Comment on lines
+492
to
+493
| + args->mode = is_radio ? MODE_RADIOLIST : MODE_CHECKLIST; | ||
| + args->items = malloc (sizeof(whiptail_menu_item) * (argc - i) / 3 + 1); |
Comment on lines
+267
to
+268
| + static char input_data[10] = {0}; | ||
| + static int input_size = 0; |
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.
Add a patch against fbwhiptail 1.3 that brings it to feature parity with newt's whiptail for the options used by Heads scripts:
Bugs fixed:
New modes:
New flags:
Previously-silenced but accepted options:
Internal changes to fbwhiptail_menu.c / fbwhiptail_menu.h:
WiP/PoC until in desirable state, need full testing.