NetBSD Problem Report #17480
Received: (qmail 17420 invoked by uid 605); 4 Jul 2002 16:19:13 -0000
Message-Id: <200207050224.g652O7210680@elysium>
Date: Fri, 5 Jul 2002 12:24:07 +1000 (EST)
From: rtr@wasabisystems.com
Sender: gnats-bugs-owner@netbsd.org
Reply-To: rtr@wasabisystems.com
To: gnats-bugs@gnats.netbsd.org
Subject: libform, field movement behavior destroys fields, leaves characters
X-Send-Pr-Version: 3.95
>Number: 17480
>Category: lib
>Synopsis: libform, field movement behavior destroys fields, leaves characters
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: blymn
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 04 16:20:01 +0000 2002
>Closed-Date: Sun Jul 28 21:14:55 +0000 2002
>Last-Modified: Sun Jan 05 21:18:01 +0000 2003
>Originator: rob/tyler
>Release: NetBSD 1.6B (-current build July 3)
>Organization:
Wasabi Systems
>Environment:
System: NetBSD elysium 1.6B NetBSD 1.6B (elysium) #0: Wed Jul 3 00:39:26 EST 2002 rtr@elysium:/usr/src/sys/arch/i386/compile/elysium i386
Architecture: i386
Machine: i386
>Description:
There are two problems included in this PR the second more annoying.
1. fields have no fore/back visibility while buffer is NULL.
2. Rmoving and adding characters to fields "messes" them up.
>How-To-Repeat:
1. Create editable form fields, set the fore/back attribute to A_REVERSE
when program is run form fields don't appear as A_REVERSE until
buffer contains something (this may include zero length string).
A work around is to set the buffer to "". This may be intended
behavior but it's not particularly useful.
2. Removing and adding characters to fields "messes" them up.
Run the included program with the following key sequence in order
to view all problems. It's likely they're all related.
- hold 'f' (or any other printable key) until both fields are full.
- hold backspace to attempt to remove all characters in field 2
- All characters will be removed with exception to first character
which appears to the left of the cursor.
- It's necessary to move to the end of field in order to backspace
this charater (unpleasant)
- press arrow up once, press arrow right once this should move
cursor to end of field one but doesn't. It moves to second last
position of field one (unpleasant)
- hold backspace to attempt to remove all characters in field 1
- all characters except character that was right of the cursor will
be removed. Then cursor itself will disappear once it reaches
first position of field (unpleasant)
- Arrow down once to move back to field 2
- First position of field 2 disappears completely and will remain
unusable. This can be observed by arrow key up again to leave the
field. (unpleasant)
/* begin code snippet */
#include <form.h>
FORM *form;
FIELD *fields[5];
int
main(int argc, char **argv)
{
int c;
initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);
fields[0] = new_field(1, 6, 0, 0, 0, 0);
fields[1] = new_field(1, 6, 0, 8, 0, 0);
fields[2] = new_field(1, 6, 1, 0, 0, 0);
fields[3] = new_field(1, 6, 1, 8, 0, 0);
fields[4] = NULL;
/* labels */
set_field_buffer(fields[0], 0, "One:");
set_field_buffer(fields[2], 0, "Two:");
field_opts_off(fields[0], O_ACTIVE);
field_opts_off(fields[2], O_ACTIVE);
set_field_fore(fields[1], A_REVERSE);
set_field_fore(fields[3], A_REVERSE);
set_field_back(fields[1], A_REVERSE);
set_field_back(fields[3], A_REVERSE);
/* necessary if we want to "see" the fields */
set_field_buffer(fields[1], 0, "");
set_field_buffer(fields[3], 0, "");
form = new_form(fields);
set_form_sub(form, stdscr);
post_form(form);
for (;;) {
switch (c = getch()) {
case KEY_UP:
form_driver(form, REQ_UP_FIELD);
break;
case KEY_RIGHT:
form_driver(form, REQ_END_FIELD);
break;
case KEY_DOWN:
form_driver(form, REQ_DOWN_FIELD);
break;
case KEY_BACKSPACE:
form_driver(form, REQ_DEL_PREV);
break;
default:
form_driver(form, c);
}
refresh();
}
/* don't bother cleaning up after ourselves */
endwin();
}
/* end code snippet */
>Fix:
1. Could initialize buffer to "" or apply fore/back attribute while
buffer is NULL.
2. Don't know, looks ugly.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: lib-bug-people->blymn
Responsible-Changed-By: wiz
Responsible-Changed-When: Thu Jul 4 09:21:56 PDT 2002
Responsible-Changed-Why:
Brett is the libform guru.
State-Changed-From-To: open->feedback
State-Changed-By: blymn
State-Changed-When: Sat Jul 27 23:11:20 PDT 2002
State-Changed-Why:
Sent diff to submitter for testing, waiting for feedback.
State-Changed-From-To: feedback->closed
State-Changed-By: perry
State-Changed-When: Sun Jul 28 14:13:31 PDT 2002
State-Changed-Why:
closed at request of submitter
he says the patch has fixed the problem
From: Tyler Retzlaff <rtr@wasabisystems.com>(by way of Erik E. Fair)
To: NetBSD GNATS Problem Report Tracking System <gnats-bugs@gnats.netbsd.org>
Cc:
Subject: Re: lib/17480
Date: Sun, 5 Jan 2003 13:15:24 -0800
As far as I'm concerned this patch has fixed the problem and the pr can
be closed.
Excellent work,
--
Tyler Retzlaff <rtr@wasabisystems.com> http://www.wasabisystems.com
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.