Re: git: 6368dcb29228 - main - bsdinstall hostname: Replace dialog with bsddialog

From: Devin Teske <dteske_at_freebsd.org>
Date: Sun, 17 Jul 2022 04:36:03 UTC

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.
> 

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


> 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
>