git: 7ef6e99752db - main - sade: Restore UI behavior like dialog(3)

From: Alfonso S. Siciliano <asiciliano_at_FreeBSD.org>
Date: Mon, 16 Oct 2023 12:09:56 UTC
The branch main has been updated by asiciliano:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ef6e99752db3c0fc7953a039050881c068b43fe

commit 7ef6e99752db3c0fc7953a039050881c068b43fe
Author:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
AuthorDate: 2023-10-16 12:06:06 +0000
Commit:     Alfonso S. Siciliano <asiciliano@FreeBSD.org>
CommitDate: 2023-10-16 12:06:06 +0000

    sade: Restore UI behavior like dialog(3)
    
    Restore UI behavior like previous disk menu implementation built on
    dialog(3):
    
     * Buttons of Create and Modify forms always active to close the
       dialogs just pressing Enter.
     * Disk menu indentation.
---
 usr.sbin/bsdinstall/partedit/diskmenu.c  | 8 ++++----
 usr.sbin/bsdinstall/partedit/gpart_ops.c | 4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/bsdinstall/partedit/diskmenu.c b/usr.sbin/bsdinstall/partedit/diskmenu.c
index f87c7714e5a7..55ef5a200658 100644
--- a/usr.sbin/bsdinstall/partedit/diskmenu.c
+++ b/usr.sbin/bsdinstall/partedit/diskmenu.c
@@ -48,14 +48,14 @@ diskmenu_show(const char *title, const char *text, struct partedit_item *items,
 	for (i = 0; i < nitems; i++) {
 		bsditems[i].prefix = "";
 		bsditems[i].on = false;
-		bsditems[i].depth = items[i].indentation;
+		bsditems[i].depth = 2 * items[i].indentation;
 		/* old menu sets max namelen to 10 */
 		bsditems[i].name = items[i].name;
 		humanize_number(size, 7, items[i].size, "B",
 		    HN_AUTOSCALE, HN_DECIMAL);
 		mp = items[i].mountpoint != NULL ? items[i].mountpoint : "";
-		asprintf(__DECONST(char**, &bsditems[i].desc), "%s %-15s %-10s",
-		    size, items[i].type, mp);
+		asprintf(__DECONST(char**, &bsditems[i].desc),
+		    "  %-9s %-15s %s", size, items[i].type, mp);
 		bsditems[i].bottomdesc = "";
 	}
 
@@ -86,5 +86,5 @@ diskmenu_show(const char *title, const char *text, struct partedit_item *items,
 		free((char *)bsditems[i].desc);
 	free(bsditems);
 
-	return output;
+	return (output);
 }
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c
index 92d1a367890c..b1d4d0f23315 100644
--- a/usr.sbin/bsdinstall/partedit/gpart_ops.c
+++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c
@@ -639,8 +639,10 @@ gpart_edit(struct gprovider *pp)
 	items[1].init = sizestr;
 
 editpart:
+	conf.button.always_active = true;
 	conf.title = "Edit Partition";
 	choice = bsddialog_form(&conf, "", 0, 0, 0, nitems, items, NULL);
+	conf.button.always_active = false;
 
 	if (choice == BSDDIALOG_CANCEL)
 		goto endedit;
@@ -1128,10 +1130,12 @@ addpartform:
 	if (interactive) {
 		conf.button.with_extra = true;
 		conf.button.extra_label = "Options";
+		conf.button.always_active = true;
 		conf.title = "Add Partition";
 		choice = bsddialog_form(&conf, "", 0, 0, 0, nitems, items, NULL);
 		conf.button.with_extra = false;
 		conf.button.extra_label = NULL;
+		conf.button.always_active = false;
 		switch (choice) {
 		case BSDDIALOG_OK:
 			break;