Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jul 1998 22:45:32 +0200 (CEST)
From:      Stefan Eggers <seggers@semyam.dinoco.de>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Cc:        seggers@semyam.dinoco.de
Subject:   bin/7453: libdialog: small change to DITEM_RECREATE behavior
Message-ID:  <199807302045.WAA12487@semyam.dinoco.de>

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

>Number:         7453
>Category:       bin
>Synopsis:       libdialog: small change to DITEM_RECREATE behavior
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 30 14:00:00 PDT 1998
>Last-Modified:
>Originator:     Stefan Eggers
>Organization:
none
>Release:        FreeBSD 3.0-CURRENT i386
>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();
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807302045.WAA12487>