NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/47397: set_field_back(3) does not set background
>Number: 47397
>Category: lib
>Synopsis: set_field_back(3) does not set background
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 03 21:35:00 +0000 2013
>Originator: Julian Fagir
>Release: NetBSD 6.0-RELEASE
>Organization:
>Environment:
>Description:
When you try to set the background of a form field to an attribute, it will not
do so.
On ncurses, this call:
set_field_back(fields[0], A_UNDERLINE);
has the effect to underline the field. In nbcurses, it doesn't do anything. On
nbcurses, if you set the second option to a character, this is shown, but
A_UNDERLINE does not work.
Is this missing documentation or a general bug?
>How-To-Repeat:
Compile this piece of code with -lform, run it on a ncurses and a nbcurses
machine:
#include <form.h>
#include <form.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int
main(int arg, char *argv[])
{
int ch, j, i = 0;
WINDOW *mainwin;
FIELD *fields[2];
FORM *form;
char buf[512];
initscr();
keypad(stdscr, TRUE);
noecho();
cbreak();
mainwin = newwin(20, 70, 2, 2);
box(mainwin, 0, 0);
mvwprintw(mainwin, 1, 1, "Creating window...");
wrefresh(mainwin);
fields[0] = new_field(1, 20, 2, 1, 0, 0);
fields[1] = NULL;
form = new_form(fields);
set_form_win(form, mainwin);
set_form_sub(form, derwin(mainwin, 15, 60, 2, 2));
set_field_back(fields[0], A_UNDERLINE);
refresh();
post_form(form);
wrefresh(mainwin);
buf[0] = '\0';
while ((ch = getch()) != '\n') {
switch (ch) {
case KEY_LEFT:
form_driver(form, REQ_LEFT_CHAR);
i--;
break;
case KEY_RIGHT:
if (buf[i] != '\0') {
form_driver(form, REQ_RIGHT_CHAR);
i++;
}
break;
case KEY_END:
form_driver(form, REQ_END_LINE);
i = strlen(buf);
break;
case KEY_HOME:
form_driver(form, REQ_BEG_LINE);
i = 0;
break;
case '\b':
case KEY_BACKSPACE:
form_driver(form, REQ_DEL_PREV);
buf[i] = '\0';
i--;
break;
default:
if (i < sizeof(buf) - 2) {
form_driver(form, ch);
for (j = strlen(buf); j >= i; j--)
buf[j+1] = buf[j];
buf[i] = ch;
i++;
}
break;
}
refresh();
wrefresh(mainwin);
}
free_field(fields[1]);
unpost_form(form);
free_form(form);
endwin();
return 0;
}
>Fix:
Home |
Main Index |
Thread Index |
Old Index