bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-ncurses] Optical change in dialog passwordbox


From: Thomas Dickey
Subject: Re: [bug-ncurses] Optical change in dialog passwordbox
Date: Sat, 22 May 2021 19:29:24 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Fri, May 21, 2021 at 10:05:04AM +0200, Dr. Werner Fink wrote:
> On 2021/05/20 15:58:09 +0200, Dr. Werner Fink wrote:
> > Hi,
> > 
> > in older versions of dialog the command
> > 
> >   dialog --insecure --passwordbox "Enter root password" 0 0
> > 
> > show
> > 
> >   +----------------------------+
> >   | Enter root password        |
> >   | +------------------------+ |
> >   | |                        | |
> >   | +------------------------+ |
> >   +----------------------------+
> >   | <   OK    > <Abbrechen>    |
> >   +----------------------------+
> > 
> > with current dialog:
> > 
> >   +----------------------------+
> >   | Enter root password        |
> >   | +------------------------+ |
> >   | |                        | |
> >   | +------------------------+ |
> >   |                            |
> >   |                            |
> >   +----------------------------+  
> >   |   <  OK  >  <Cancel>       |
> >   +----------------------------+  
> > 
> > and this extra empty line cause a soft failur here in out QA test suite
> > 
> > Werner
> > 
> 
> This seems to restore the old layout
> 
> --- inputbox.c
> +++ inputbox.c  2021-05-21 08:00:13.324086975 +0000
> @@ -39,7 +39,7 @@
>  
>  #define BTN_HIGH 1
>  #define HDR_HIGH 1
> -#define MIN_HIGH (HDR_HIGH + (MARGIN * 2 + 1) + (BTN_HIGH + MARGIN * 2))
> +#define MIN_HIGH (HDR_HIGH + (MARGIN + 1) + (BTN_HIGH + MARGIN))
>  #define MIN_WIDE 26
>  
>  /*
> 
> I'd like to ask what the rational is for the doubling of the margins?

I think we're talking about this change. In testing, I ran into a case
where the box wasn't big enough, and seeing that the code wasn't parameterized
properly, replaced some constants with an expression.

You're saying that the expression isn't correct (I'll make a note to
see if I can verify that against whatever testcase -- whether from someone's
email or one of the sample scripts I don't recall).

--------------------------------------------------------------------------------
REV:1.93                inputbox.c          2021/01/17 16:36:37       tom
tags:            t20210509, t20210324, t20210319, t20210306, t20210117

   increase min-high so the text-field doesn't overlap the button-box

--- inputbox.c  2020/11/23 00:49:57     1.92
+++ inputbox.c  2021/01/17 16:36:37     1.93
@@ -1,9 +1,9 @@
 /*
- *  $Id: inputbox.c,v 1.91 2020/03/27 20:25:40 tom Exp $
+ *  $Id: inputbox.c,v 1.92 2020/11/23 00:49:57 tom Exp $
  *
  *  inputbox.c -- implements the input box
  *
- *  Copyright 2000-2019,2020 Thomas E. Dickey
+ *  Copyright 2000-2020,2021 Thomas E. Dickey
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU Lesser General Public License, version 2.1
@@ -37,6 +37,11 @@
        DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ), \
        DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP )
 
+#define BTN_HIGH 1
+#define HDR_HIGH 1
+#define MIN_HIGH (HDR_HIGH + (MARGIN * 2 + 1) + (BTN_HIGH + MARGIN * 2))
+#define MIN_WIDE 26
+
 /*
  * Display a dialog box for entering a string
  */
@@ -107,13 +112,13 @@
     key = fkey = 0;
 
     if (init != NULL) {
-       dlg_auto_size(title, prompt, &height, &width, 5,
-                     MIN(MAX(dlg_count_columns(init) + 7, 26),
+       dlg_auto_size(title, prompt, &height, &width, MIN_HIGH,
+                     MIN(MAX(dlg_count_columns(init) + 7, MIN_WIDE),
                          SCOLS - (dialog_vars.begin_set ?
                                   dialog_vars.begin_x : 0)));
        chr_offset = (int) strlen(init);
     } else {
-       dlg_auto_size(title, prompt, &height, &width, 5, 26);
+       dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MIN_WIDE);
     }
     dlg_button_layout(buttons, &width);
     dlg_print_size(height, width);
--------------------------------------------------------------------------------

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]