[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A Bug in ncurses 5.0-11
From: |
E Bryant |
Subject: |
A Bug in ncurses 5.0-11 |
Date: |
Mon, 02 Apr 2001 16:06:06 -0600 |
The attached file (tstopts.c) provides a short program illustrating the
problem. Please excuse its lack of elegance as I am just learning C and
NCURSES.
PROBLEM: Once the form has been created the O_AUTOSKIP can not be
turned off in field zero. It can be turned off before the creation.
Maybe this is not considered a bug???
I tried this on two computers in both xterm and console windows.
Before I sent this I poked around at gnu.org to see what I could find.
Ernie Bryant
ps If anyone has time can you tell me how to differentiate TAB from
SHIFT-TAB when inputing via getch. I get the same result from both??
/* test forms */
#include <ncurses.h>
#include <form.h>
#include <signal.h>
#include <string.h>
int initialize();
int tstf();
static void finish(int sig);
/* MAIN PROGRAM FOR TEST */
int main(int argc, char *argv[])
{
int ret = 0;
void *op;
clear();
ret = initialize();
ret = bkgd(COLOR_PAIR(COLOR_WHITE));
ret = tstf();
finish(0);
return 0;
}
/********INITIALIZE**********/
int initialize()
{
int n, m;
char *p;
void *op = NULL;
(void) signal(SIGINT, finish);
(void) initscr();
keypad(stdscr,TRUE);
(void) nonl();
(void) cbreak();
(void) noecho();
if (has_colors())
{
start_color();
init_pair(COLOR_WHITE, COLOR_BLACK, COLOR_WHITE);
init_pair(COLOR_RED, COLOR_RED, COLOR_WHITE);
init_pair(COLOR_BLUE,COLOR_BLUE, COLOR_WHITE);
}
return 0;
}
/* TEST FIELD_OPTS_OFF */
int tstf()
{
FIELD *tfld[4];
FIELD **csp=&tfld[0];
FORM *tfm;
WINDOW *wfm;
WINDOW *swfm;
int m, n, c, ret, kee[11], sl, row;
for(n=0;n<4;n++)
tfld[n] = NULL;
row = 6;
tfld[0] = new_field(1,1,row,6,0,0);
tfld[1] = new_field(1,1,row,12,0,0);
tfld[2] = new_field(1,10,row,16,0,0);
/****** NOTE ********/
/* With the new_form statement here, field_opts_off doesn't work for tfld[0]
*/
tfm = new_form(csp);
for(n=0;n < 3; n++){
field_opts_off(tfld[n],O_AUTOSKIP);
field_opts_on(tfld[n],O_BLANK);
}
/***** NOTE *****/
/* With the new_form statement here, field_opts_off does work for tfld[0] */
/* tfm = new_form(csp);*/
post_form(tfm);
for(n=0; n<3;n++){
set_field_fore(tfld[n],COLOR_PAIR(COLOR_RED));
set_field_back(tfld[n],COLOR_PAIR(COLOR_WHITE));
set_field_buffer(tfld[n],0,"1");
}
mvaddstr(1,0,"Values of field_opts for tfld[1-3]; should all be 01677");
mvaddstr(4,0,"Enter ALPHA-NUM char, Press TAB to change field, RETURN to
exit");
move(2,5);
printw("%o %o %o", field_opts(tfld[0]), field_opts(tfld[1]),
field_opts(tfld[2]));
for(;;){
if((c=getch()) == KEY_BACKSPACE){
ret = form_driver(tfm,REQ_LEFT_CHAR);
ret = form_driver(tfm,REQ_DEL_CHAR);
beep();
}
else if(c == '\r'){
ret = form_driver(tfm,REQ_VALIDATION);
break;
}
else if(c > ' ' && c < 128){
ret = form_driver(tfm,c);
if(ret == E_REQUEST_DENIED){
form_driver(tfm, REQ_OVL_MODE);
form_driver(tfm,c);
form_driver(tfm, REQ_INS_MODE);
}
}
else if(c == '\011'){
ret = form_driver(tfm, REQ_NEXT_FIELD);
}
else
beep();
}
unpost_form(tfm);
free_form(tfm);
free_field(tfld[0]);
return ret;
}
/**********FINISH**********/
static void finish(int sig)
{
endwin();
exit(0);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- A Bug in ncurses 5.0-11,
E Bryant <=