Re: git: 6368dcb29228 - main - bsdinstall hostname: Replace dialog with bsddialog
- In reply to: Devin Teske : "Re: git: 6368dcb29228 - main - bsdinstall hostname: Replace dialog with bsddialog"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 18 Jul 2022 19:14:55 UTC
On 7/17/22 06:36, Devin Teske wrote: > > > Sent from my iPhone > >> On 15 Jul 2022, at 12:50 AM, Jessica Clarke <jrtc27@freebsd.org> wrote: >> >> On 24 May 2022, at 13:20, Alfonso S. Siciliano <asiciliano@FreeBSD.org> wrote: >>> >>> The branch main has been updated by asiciliano: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=6368dcb29228dd8e18d50c54c3ca1596262d4676 >>> >>> commit 6368dcb29228dd8e18d50c54c3ca1596262d4676 >>> Author: Alfonso S. Siciliano <asiciliano@FreeBSD.org> >>> AuthorDate: 2022-05-24 12:04:24 +0000 >>> Commit: Alfonso S. Siciliano <asiciliano@FreeBSD.org> >>> CommitDate: 2022-05-24 12:20:22 +0000 >>> >>> bsdinstall hostname: Replace dialog with bsddialog >>> >>> Replace (LGPL) dialog utility with (BSD-2-Clause) bsddialog utility. >>> Add --hline info because bsddialog requires TAB to switch the focus on >>> buttons for an inputbox, dialog differs. >> >> This is quite infuriating and bad UI/UX, everyone knows you can just >> type and press enter at these kinds of dialogues, yet bsddialog doesn’t >> support this. Are there any plans to address this shortcoming so >> bsddialog can work like every other dialogue box out there and how most >> users would expect? This is an unfortunate regression over (LGPL) >> dialog and I personally believe bsddialog should have been fixed rather >> than introducing this clunky experience to document the flaw. >> > I apologize for the infuriating and bad UI/UX, if I have understood: $ dialog --inputbox Input 0 0 0 $ bsddialog --inputbox Input 0 0 0 $ dialog --form Form 0 0 2 L1: 1 1 X 1 5 20 25 L2: 2 1 X 2 5 20 25 $ bsddialog --form Form 0 0 2 L1: 1 1 X 1 5 20 25 L2: 2 1 X 2 5 20 25 The problem is TAB -> ENTER instead of only ENTER to close the dialog. It has a rationale, probably too boring to describe in this context. Anyway, Yes, "just type and press enter" to close an --inputbox is already in the TODO list. Actually there is a plan to refactor the complete "form module", I hope to finish by August/September. <https://gitlab.com/alfix/bsddialog/-/blob/main/README.md#todo>. Please let me know if you need a revert now to solve immediate. bsddialog was designed and implemented for FreeBSD, bsdinstall is the first real use case, it was introduced in CURRENT for testing, changes and improvements. Suggestions, feedback and new ideas are welcome. > Not to mention that removing dynamic auto-sizing smacks international users in the face because “0 56” might look good to your English text but not i18n text. > > What’s that? This code is not i18n’d? > > Not yet — but fixing the size of the box is a step backwards regressing away from embracing i18n already patterned by bsdconfig. > > I observe. > — > Devin > width-auto-sizing for --inputbox is implemented but I disabled it temporarily, Because it can be improved. Properly the utility calls bsddialog_form() for each form-like, I' ll improve the auto-sizing by implementing a real inputbox() function, already in the TODO list. I used a fixed size like temporary solution because other scripts in bsdinstall RELEASE/CURRENT use fixed width [~40 - ~72]. (56 is only the dialog width, an user can type over 2000 unicode chars, the text will be shifted). bsddialog forms should support widechars already, at least for the typing field. So far I implemented the unicode support only for the forms to improve bsdinstall in the future. Indeed some user reported some problem with no-English chars (PRs are not related to bsddialog, the scripts use other tools, bsddialog can solve in the future): <https://bugs.freebsd.org/263745> <https://bugs.freebsd.org/257338> <https://bugs.freebsd.org/248968> I hope to import a new bsddialog version by September/October with an improved autosizing for inputbox and a complete unicode support for each dialog (this includes sizing and text-wrapping with multi bytes charachters). Currently I am replacing char with wchar_t in libbsddialog, the library will use widechars internally. Moreover, I was able to change my DE (XFCE) in Japanese and I am going to buy a Japanese keyboard to make testing easier. Of course, I'll investigate/try to integrade bsddialog with bsdconfig. Probably the problem with the auto-sizing is the different dialog/bsddialog text-wrapping algorithm; I am quite sure this problem exists for text (aka prompt) and menu items (radiolist, checklist). The challenge is that I cannot read the LGPL dialog code to avoid violating the license. I opened a public review for this commit with author/maintainer, <https://reviews.freebsd.org/D35285> it is possible to collaborate not only to observe. Alfonso > >> Jess >> >>> Delete f_dialog_inputbox_size() using libbsddialog autosizing. >>> >>> Reviewed by: bapt >>> Differential Revision: https://reviews.freebsd.org/D35285 >>> --- >>> usr.sbin/bsdinstall/scripts/hostname | 14 ++++++-------- >>> 1 file changed, 6 insertions(+), 8 deletions(-) >>> >>> diff --git a/usr.sbin/bsdinstall/scripts/hostname b/usr.sbin/bsdinstall/scripts/hostname >>> index b151ef15c690..23adbe68ead0 100755 >>> --- a/usr.sbin/bsdinstall/scripts/hostname >>> +++ b/usr.sbin/bsdinstall/scripts/hostname >>> @@ -48,6 +48,8 @@ f_include $BSDCFG_SHARE/dialog.subr >>> >>> ############################################################ GLOBALS >>> >>> +: ${BSDDIALOG_CANCEL=1} >>> + >>> # >>> # Strings that should be moved to an i18n file and loaded with f_include_lang() >>> # >>> @@ -71,21 +73,17 @@ SET_HOSTNAME='hostname -s "%s"' >>> dialog_hostname() >>> { >>> local prompt="$msg_please_choose_a_hostname" >>> - local hline= >>> + local hline="Use TAB and Enter to select $msg_ok" >>> local value="$*" >>> >>> - local height width >>> - f_dialog_inputbox_size height width \ >>> - "$DIALOG_TITLE" "$DIALOG_BACKTITLE" "$prompt" "$value" "$hline" >>> - >>> - $DIALOG \ >>> + bsddialog \ >>> --title "$DIALOG_TITLE" \ >>> --backtitle "$DIALOG_BACKTITLE" \ >>> --hline "$hline" \ >>> --ok-label "$msg_ok" \ >>> --no-cancel \ >>> --inputbox "$prompt" \ >>> - $height $width "$value" \ >>> + 0 56 "$value" \ >>> 2>&1 >&$DIALOG_TERMINAL_PASSTHRU_FD >>> } >>> >>> @@ -101,7 +99,7 @@ f_dialog_backtitle "$msg_freebsd_installer" >>> # Get user input >>> # >>> HOSTNAME=$( dialog_hostname "$HOSTNAME" ) >>> -[ $? -eq $DIALOG_CANCEL ] && exit 1 >>> +[ $? -eq $BSDDIALOG_CANCEL ] && exit 1 >>> >>> # >>> # Store the user's choice >>