Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Dec 2010 13:49:27 +0300
From:      Eygene Ryabinkin <rea@freebsd.org>
To:        Eitan Adler <lists@eitanadler.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: questions relating to ncurses and dialog(1)
Message-ID:  <mTCTzW2G0UPrQ1HQyzT/aSiKc%2B8@QsmfhJNucgI88DfvPJdT1/nyboE>
In-Reply-To: <AANLkTi=EqukSOUOP0hvFHmR6=5%2BcNgiba5tQdmy-V8F-@mail.gmail.com>
References:  <AANLkTi=EqukSOUOP0hvFHmR6=5%2BcNgiba5tQdmy-V8F-@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--BYl/BInBdgsQr4gH
Content-Type: multipart/mixed; boundary="ynll37MX3Fmyj3VY"
Content-Disposition: inline


--ynll37MX3Fmyj3VY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Thu, Dec 30, 2010 at 07:03:44PM -0500, Eitan Adler wrote:
> 2) The "help" screen just doesn't show up despite having text and a
> border and not generating any errors (which are all checked)

You're using 'frameCols' while calculating
windowStatList[HELP].rowStart, so your window is starting somewhere
around line 76 at the 80x25 terminal, thus it is just invisible.
Use 'frameRows' and you'll get something that will be top-aligned
with the buttons.

There's one more thing: the lone 'dialog4ports --hfile=3D<foo>'
will dump core, because prev is NULL in this case.

The attached patch should fix the first item and will apply
a quick-fix for the second one.
--=20
Eygene Ryabinkin                                        ,,,^..^,,,
[ Life's unfair - but root password helps!           | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]

--ynll37MX3Fmyj3VY
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0001-Fix-help-handling.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 824820c0c938bf677728314477664f190448a648 Mon Sep 17 00:00:00 2001
=46rom: Eygene Ryabinkin <rea@freebsd.org>
Date: Fri, 31 Dec 2010 13:46:08 +0300
Subject: [PATCH] Fix help handling

- we should use frame's rows when calculating the starting line
  for the help window;
- we should check if there was a previous argument that can have
  --hfile for it.

The latter fix is a quick one, we should really check that the
previous argument was one of the --option, --radio or --input.

Signed-off-by: Eygene Ryabinkin <rea@freebsd.org>
---
 dialog4ports.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dialog4ports.c b/dialog4ports.c
index 026b0b9..cc7a9f8 100644
--- a/dialog4ports.c
+++ b/dialog4ports.c
@@ -385,6 +385,8 @@ parseArguments(const int argc, char * argv[])
 			stage =3D OPEN;
 		}
 		else if (stage =3D=3D PREV_HFILE) {
+			if (prev =3D=3D NULL)
+				errx(EX_USAGE, "--hfile requires previous --option, --radio or --input=
 option.");
 			prev->longDescrFile =3D argv[arg];
 			stage =3D OPEN;
 		}
@@ -632,7 +634,7 @@ main(int argc, char* argv[])
 	else
 		windowStatList[LICENCE].colStart =3D 0;
=20
-	windowStatList[HELP].rowStart =3D frameCols - windowStatList[EXIT].rows -=
 windowStatList[LICENCE].rows;
+	windowStatList[HELP].rowStart =3D frameRows - windowStatList[EXIT].rows -=
 windowStatList[LICENCE].rows;
 	windowStatList[HELP].colStart =3D 0 ;
 	windowStatList[HELP].rows =3D 6;
 	windowStatList[HELP].cols =3D frameCols;
--=20
1.7.3.2


--ynll37MX3Fmyj3VY--

--BYl/BInBdgsQr4gH
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iF4EAREIAAYFAk0dtTYACgkQFq+eroFS7PtIjgD8DJui9Aq6dC8iktuKYrXWYnJv
wGn6pKf7Ip52PeobX/4A/0QSqoGy8nnH9JM1gIaOL1aYnf++z93oLh2jWrXCL3rX
=49Io
-----END PGP SIGNATURE-----

--BYl/BInBdgsQr4gH--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?mTCTzW2G0UPrQ1HQyzT/aSiKc%2B8>