2023-03-04 16:55:36

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH 1/2] menuconfig: delete shadows, reclaim vertical space

Menuconfig has lots of vertical space wasted: on my system there are
17 lines of useful information about config options and 14 lines of
useless fluff: legend, horizontal separators and shadows.

Sitation is even worse on smaller terminals because fixed vertical lines
do not go away, but config option lines do decreasing informational
density even more.

Delete shadows and increase menu size to reclaim vertical space.

Signed-off-by: Alexey Dobriyan <[email protected]>
---

scripts/kconfig/lxdialog/checklist.c | 2 --
scripts/kconfig/lxdialog/dialog.h | 1 -
scripts/kconfig/lxdialog/inputbox.c | 2 --
scripts/kconfig/lxdialog/menubox.c | 6 ++----
scripts/kconfig/lxdialog/textbox.c | 2 --
scripts/kconfig/lxdialog/util.c | 22 ----------------------
scripts/kconfig/lxdialog/yesno.c | 2 --
7 files changed, 2 insertions(+), 35 deletions(-)

--- a/scripts/kconfig/lxdialog/checklist.c
+++ b/scripts/kconfig/lxdialog/checklist.c
@@ -130,8 +130,6 @@ int dialog_checklist(const char *title, const char *prompt, int height,
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -206,7 +206,6 @@ void print_button(WINDOW * win, const char *label, int y, int x, int selected);
void print_title(WINDOW *dialog, const char *title, int width);
void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box,
chtype border);
-void draw_shadow(WINDOW * win, int y, int x, int height, int width);

int first_alpha(const char *string, const char *exempt);
int dialog_yesno(const char *title, const char *prompt, int height, int width);
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -52,8 +52,6 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -183,7 +183,7 @@ int dialog_menu(const char *title, const char *prompt,
if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN)
return -ERRDISPLAYTOOSMALL;

- height -= 4;
+ height -= 2;
width -= 5;
menu_height = height - 10;

@@ -191,9 +191,7 @@ int dialog_menu(const char *title, const char *prompt,

/* center dialog box on screen */
x = (getmaxx(stdscr) - width) / 2;
- y = (getmaxy(stdscr) - height) / 2;
-
- draw_shadow(stdscr, y, x, height, width);
+ y = 2;

dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -88,8 +88,6 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height,
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);

--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -491,28 +491,6 @@ draw_box(WINDOW * win, int y, int x, int height, int width,
}
}

-/*
- * Draw shadows along the right and bottom edge to give a more 3D look
- * to the boxes
- */
-void draw_shadow(WINDOW * win, int y, int x, int height, int width)
-{
- int i;
-
- if (has_colors()) { /* Whether terminal supports color? */
- wattrset(win, dlg.shadow.atr);
- wmove(win, y + height, x + 2);
- for (i = 0; i < width; i++)
- waddch(win, winch(win) & A_CHARTEXT);
- for (i = y + 1; i < y + height + 1; i++) {
- wmove(win, i, x + width);
- waddch(win, winch(win) & A_CHARTEXT);
- waddch(win, winch(win) & A_CHARTEXT);
- }
- wnoutrefresh(win);
- }
-}
-
/*
* Return the position of the first alphabetic character in a string.
*/
--- a/scripts/kconfig/lxdialog/yesno.c
+++ b/scripts/kconfig/lxdialog/yesno.c
@@ -41,8 +41,6 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width)
x = (getmaxx(stdscr) - width) / 2;
y = (getmaxy(stdscr) - height) / 2;

- draw_shadow(stdscr, y, x, height, width);
-
dialog = newwin(height, width, y, x);
keypad(dialog, TRUE);



2023-03-04 16:56:36

by Alexey Dobriyan

[permalink] [raw]
Subject: [PATCH 2/2] menuconfig: reclaim 1 more vertical line

Empty line after legend is waste, use it for config options.

Signed-off-by: Alexey Dobriyan <[email protected]>
---

scripts/kconfig/lxdialog/menubox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -185,7 +185,7 @@ int dialog_menu(const char *title, const char *prompt,

height -= 2;
width -= 5;
- menu_height = height - 10;
+ menu_height = height - 9;

max_choice = MIN(menu_height, item_count());


2023-03-04 17:53:03

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 2/2] menuconfig: reclaim 1 more vertical line

Hi,

On 3/4/23 08:56, Alexey Dobriyan wrote:
> Empty line after legend is waste, use it for config options.
>

I don't see an empty line after the legend. For me this patch
truncates the menu_instructions[] text from 4 lines to 3 lines,
dropping good/useful help text.

menu_instructions[] was already truncated before this patch
(in an 80x30 size terminal window).

What size terminal are you using?

> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
>
> scripts/kconfig/lxdialog/menubox.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/scripts/kconfig/lxdialog/menubox.c
> +++ b/scripts/kconfig/lxdialog/menubox.c
> @@ -185,7 +185,7 @@ int dialog_menu(const char *title, const char *prompt,
>
> height -= 2;
> width -= 5;
> - menu_height = height - 10;
> + menu_height = height - 9;
>
> max_choice = MIN(menu_height, item_count());
>

--
~Randy

2023-03-04 17:56:14

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 1/2] menuconfig: delete shadows, reclaim vertical space

Hi,

On 3/4/23 08:55, Alexey Dobriyan wrote:
> Menuconfig has lots of vertical space wasted: on my system there are
> 17 lines of useful information about config options and 14 lines of
> useless fluff: legend, horizontal separators and shadows.
>
> Sitation is even worse on smaller terminals because fixed vertical lines
> do not go away, but config option lines do decreasing informational
> density even more.
>
> Delete shadows and increase menu size to reclaim vertical space.
>
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
>
> scripts/kconfig/lxdialog/checklist.c | 2 --
> scripts/kconfig/lxdialog/dialog.h | 1 -
> scripts/kconfig/lxdialog/inputbox.c | 2 --
> scripts/kconfig/lxdialog/menubox.c | 6 ++----
> scripts/kconfig/lxdialog/textbox.c | 2 --
> scripts/kconfig/lxdialog/util.c | 22 ----------------------
> scripts/kconfig/lxdialog/yesno.c | 2 --
> 7 files changed, 2 insertions(+), 35 deletions(-)
>

This patch works for me, but since the right side shadow is
also being removed, the one column (width) that it had
occupied might as well be used (reclaimed) instead of just
going to waste.

Thanks.
--
~Randy

2023-03-04 18:53:22

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH 2/2] menuconfig: reclaim 1 more vertical line

On Sat, Mar 04, 2023 at 09:52:55AM -0800, Randy Dunlap wrote:
> Hi,
>
> On 3/4/23 08:56, Alexey Dobriyan wrote:
> > Empty line after legend is waste, use it for config options.
> >
>
> I don't see an empty line after the legend. For me this patch
> truncates the menu_instructions[] text from 4 lines to 3 lines,
> dropping good/useful help text.

OK, I do need to test this one on more screen sizes.

> menu_instructions[] was already truncated before this patch
> (in an 80x30 size terminal window).
>
> What size terminal are you using?

135 x 31

> > Signed-off-by: Alexey Dobriyan <[email protected]>
> > ---
> >
> > scripts/kconfig/lxdialog/menubox.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/scripts/kconfig/lxdialog/menubox.c
> > +++ b/scripts/kconfig/lxdialog/menubox.c
> > @@ -185,7 +185,7 @@ int dialog_menu(const char *title, const char *prompt,
> >
> > height -= 2;
> > width -= 5;
> > - menu_height = height - 10;
> > + menu_height = height - 9;
> >
> > max_choice = MIN(menu_height, item_count());
> >
>
> --
> ~Randy

2023-03-04 18:54:50

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH 1/2] menuconfig: delete shadows, reclaim vertical space

On Sat, Mar 04, 2023 at 09:56:08AM -0800, Randy Dunlap wrote:
> Hi,
>
> On 3/4/23 08:55, Alexey Dobriyan wrote:
> > Menuconfig has lots of vertical space wasted: on my system there are
> > 17 lines of useful information about config options and 14 lines of
> > useless fluff: legend, horizontal separators and shadows.
> >
> > Sitation is even worse on smaller terminals because fixed vertical lines
> > do not go away, but config option lines do decreasing informational
> > density even more.
> >
> > Delete shadows and increase menu size to reclaim vertical space.
> >
> > Signed-off-by: Alexey Dobriyan <[email protected]>
> > ---
> >
> > scripts/kconfig/lxdialog/checklist.c | 2 --
> > scripts/kconfig/lxdialog/dialog.h | 1 -
> > scripts/kconfig/lxdialog/inputbox.c | 2 --
> > scripts/kconfig/lxdialog/menubox.c | 6 ++----
> > scripts/kconfig/lxdialog/textbox.c | 2 --
> > scripts/kconfig/lxdialog/util.c | 22 ----------------------
> > scripts/kconfig/lxdialog/yesno.c | 2 --
> > 7 files changed, 2 insertions(+), 35 deletions(-)
> >
>
> This patch works for me, but since the right side shadow is
> also being removed, the one column (width) that it had
> occupied might as well be used (reclaimed) instead of just
> going to waste.

Horizontal space is not really important because monitors are wider
than taller and our config option descriptions are quite short.

2023-03-05 06:20:03

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 1/2] menuconfig: delete shadows, reclaim vertical space



On 3/4/23 10:54, Alexey Dobriyan wrote:
> On Sat, Mar 04, 2023 at 09:56:08AM -0800, Randy Dunlap wrote:
>> Hi,
>>
>> On 3/4/23 08:55, Alexey Dobriyan wrote:
>>> Menuconfig has lots of vertical space wasted: on my system there are
>>> 17 lines of useful information about config options and 14 lines of
>>> useless fluff: legend, horizontal separators and shadows.
>>>
>>> Sitation is even worse on smaller terminals because fixed vertical lines
>>> do not go away, but config option lines do decreasing informational
>>> density even more.
>>>
>>> Delete shadows and increase menu size to reclaim vertical space.
>>>
>>> Signed-off-by: Alexey Dobriyan <[email protected]>
>>> ---
>>>
>>> scripts/kconfig/lxdialog/checklist.c | 2 --
>>> scripts/kconfig/lxdialog/dialog.h | 1 -
>>> scripts/kconfig/lxdialog/inputbox.c | 2 --
>>> scripts/kconfig/lxdialog/menubox.c | 6 ++----
>>> scripts/kconfig/lxdialog/textbox.c | 2 --
>>> scripts/kconfig/lxdialog/util.c | 22 ----------------------
>>> scripts/kconfig/lxdialog/yesno.c | 2 --
>>> 7 files changed, 2 insertions(+), 35 deletions(-)
>>>
>>
>> This patch works for me, but since the right side shadow is
>> also being removed, the one column (width) that it had
>> occupied might as well be used (reclaimed) instead of just
>> going to waste.
>
> Horizontal space is not really important because monitors are wider
> than taller and our config option descriptions are quite short.

Yeah, but there is no reason not to reclaim the one horizontal column.
This does it for me: (lightly tested)

diff -- a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -184,7 +184,7 @@ do_resize:
return -ERRDISPLAYTOOSMALL;

height -= 2;
- width -= 5;
+ width -= 4;
menu_height = height - 10;


We might also be able to reduce the length of menu_instructions[]
and put more of it into the other Help text if that interests you.

--
~Randy