From seggers@semyam.dinoco.de  Thu Jul 30 13:53:18 1998
Received: from tim.xenologics.com (tim.xenologics.com [194.77.5.24])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA20150
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 Jul 1998 13:53:14 -0700 (PDT)
          (envelope-from seggers@semyam.dinoco.de)
Received: (from uucp@localhost)
	by tim.xenologics.com (8.8.5/8.8.8) with UUCP id WAA29878
	for FreeBSD-gnats-submit@freebsd.org; Thu, 30 Jul 1998 22:51:03 +0200 (MET DST)
Received: (from seggers@localhost)
	by semyam.dinoco.de (8.8.8/8.8.8) id WAA12487;
	Thu, 30 Jul 1998 22:45:32 +0200 (CEST)
	(envelope-from seggers)
Message-Id: <199807302045.WAA12487@semyam.dinoco.de>
Date: Thu, 30 Jul 1998 22:45:32 +0200 (CEST)
From: Stefan Eggers <seggers@semyam.dinoco.de>
Reply-To: seggers@semyam.dinoco.de
To: FreeBSD-gnats-submit@freebsd.org
Cc: seggers@semyam.dinoco.de
Subject: libdialog: small change to DITEM_RECREATE behavior
X-Send-Pr-Version: 3.2

>Number:         7453
>Category:       bin
>Synopsis:       libdialog: small change to DITEM_RECREATE behavior
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 30 14:00:00 PDT 1998
>Closed-Date:    Thu Aug 6 23:15:28 PDT 1998
>Last-Modified:  Thu Aug  6 23:15:45 PDT 1998
>Originator:     Stefan Eggers
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
none
>Environment:

	-current from a few days ago.

>Description:

	When using a checkbox a DITEM_RECREATE from a fire callback
caused the values of choice and scroll to be set back to 0.  This
resulted in the user getting to the top of the list.

	This behavior conflicts with what I intend to do with my
changes to sysinstall which introduce display of which packages get
added as a dependency.  See the separate PR.

	The most simple change is making checkboxes behave a little
bit different now.  They retain the old position - nothing else gets
changed in the logic.

	The only alternative I see is changing the includes files and
add a flag similar to DITEM_RECREATE but retaining the old position.
If that is the prefered solution to this interface problem I will make
patches for that, too.

>How-To-Repeat:

	Just try the sysinstall patches w/o this patch.  It's very
annoying to use anything having a dependency!

>Fix:
	
Index: checklist.c
===================================================================
RCS file: /usr2/FreeBSD/CVSROOT/src/gnu/lib/libdialog/checklist.c,v
retrieving revision 1.33
diff -u -r1.33 checklist.c
--- checklist.c	1997/10/12 12:09:45	1.33
+++ checklist.c	1998/07/30 20:35:25
@@ -45,6 +45,7 @@
     unsigned char **items = NULL;
     dialogMenuItem *ditems;
     int list_width, check_x, item_x;
+    int remember_position, remember_choice, remember_scroll;
 
     /* Allocate space for storing item on/off status */
     if ((status = alloca(sizeof(int) * abs(cnt))) == NULL) {
@@ -53,8 +54,17 @@
 	exit(-1);
     }
     
+    remember_position = 0;
+    remember_choice = 0; /* avoid useless warnings from compiler */
+    remember_scroll = 0; /* avoid useless warnings from compiler */
 draw:
     choice = scroll = button = 0;
+    if (remember_position)
+    {
+	remember_position = 0;
+	choice = remember_choice;
+	scroll = remember_scroll;
+    }
     /* Previous calling syntax, e.g. just a list of strings? */
     if (cnt >= 0) {
 	items = it;
@@ -349,6 +359,9 @@
 			    break;
 			}
 			else if (st & DITEM_RECREATE) {
+			    remember_position = 1;
+			    remember_choice = choice;
+			    remember_scroll = scroll;
 			    delwin(list);
 			    delwin(dialog);
 			    dialog_clear();
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: phk 
State-Changed-When: Fri Jul 31 02:12:53 PDT 1998 
State-Changed-Why:  
what impact do you expect this change to have on other users of libdialog, 
including the "stock" sysinstall ? 

From: Stefan Eggers <seggers@semyam.dinoco.de>
To: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Cc: seggers@semyam.dinoco.de
Subject: Re: bin/7453: libdialog: small change to DITEM_RECREATE behavior 
Date: Fri, 31 Jul 1998 14:40:33 +0200

 After some more thinking about implications of this I finally found
 a case where these patches might make a program break.  Looking for
 an alternative solution I found DITEM_REDRAW which seems to do what
 I need but is undocumented.
 
 Please close this PR.
 
 Stefan.
State-Changed-From-To: feedback->closed 
State-Changed-By: phk 
State-Changed-When: Thu Aug 6 23:15:28 PDT 1998 
State-Changed-Why:  
per authors request 
>Unformatted:
