summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-11-18 00:30:06 +0000
committerache <ache@FreeBSD.org>1994-11-18 00:30:06 +0000
commitb847ed27c47795d4538977ffa9f784ebc384dddb (patch)
tree589bc9c54c47152b2fedaa9aa06da7819239ce5e /gnu
parent91d0857ccb32ba699e6a61e0ad2a81d1b44ed952 (diff)
downloadFreeBSD-src-b847ed27c47795d4538977ffa9f784ebc384dddb.zip
FreeBSD-src-b847ed27c47795d4538977ffa9f784ebc384dddb.tar.gz
Save/restore attrs in line_edit now
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/libdialog/inputbox.c2
-rw-r--r--gnu/lib/libdialog/lineedit.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/gnu/lib/libdialog/inputbox.c b/gnu/lib/libdialog/inputbox.c
index 11e3566..a544ec0 100644
--- a/gnu/lib/libdialog/inputbox.c
+++ b/gnu/lib/libdialog/inputbox.c
@@ -97,7 +97,7 @@ int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int
while (key != ESC) {
if (button == -1) { /* Input box selected */
- key = line_edit(dialog, box_y, box_x, box_width, dialog_attr, first, instr);
+ key = line_edit(dialog, box_y, box_x, box_width, inputbox_attr, first, instr);
first = 0;
}
else
diff --git a/gnu/lib/libdialog/lineedit.c b/gnu/lib/libdialog/lineedit.c
index 7431d98..c32922d 100644
--- a/gnu/lib/libdialog/lineedit.c
+++ b/gnu/lib/libdialog/lineedit.c
@@ -29,6 +29,7 @@
int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr, int first, unsigned char *result)
{
int i, key;
+ chtype old_attr;
static int input_x, scroll;
static unsigned char instr[MAX_LEN+1];
unsigned char erase_char = erasechar();
@@ -37,6 +38,7 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr,
unsignec char werase_char = cur_term->Ottyb.c_cc[VWERASE];
#endif
+ old_attr = getattrs(dialog);
wattrset(dialog, attr);
keypad(dialog, TRUE);
@@ -93,7 +95,6 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr,
continue;
case KEY_LEFT:
if (input_x || scroll) {
- wattrset(dialog, inputbox_attr);
if (!input_x) {
int oldscroll = scroll;
scroll = scroll < box_width-1 ? 0 : scroll-(box_width-1);
@@ -110,7 +111,6 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr,
continue;
case KEY_RIGHT:
if (scroll+input_x < MAX_LEN) {
- wattrset(dialog, inputbox_attr);
if (!instr[scroll+input_x])
instr[scroll+input_x] = ' ';
if (input_x == box_width-1) {
@@ -137,7 +137,6 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr,
if (input_x || scroll) {
i = strlen(instr);
memmove(instr+scroll+input_x-1, instr+scroll+input_x, i-scroll+input_x+1);
- wattrset(dialog, inputbox_attr);
if (!input_x) {
int oldscroll = scroll;
scroll = scroll < box_width-1 ? 0 : scroll-(box_width-1);
@@ -166,7 +165,6 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr,
i++;
if (i < MAX_LEN) {
memmove(instr+scroll+input_x+1, instr+scroll+input_x, i-scroll+input_x);
- wattrset(dialog, inputbox_attr);
instr[scroll+input_x] = key;
if (input_x == box_width-1) {
scroll++;
@@ -188,6 +186,7 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int box_width, chtype attr,
}
}
ret:
+ wattrset(dialog, old_attr);
strcpy(result, instr);
return key;
}
OpenPOWER on IntegriCloud