Draw passed line with passed attrs on enter of line_edit()

and redraw it with default attrs on exit.
This commit is contained in:
Andrey A. Chernov 1994-11-18 01:46:32 +00:00
parent d31ec8c65b
commit df5add3f69
3 changed files with 11 additions and 3 deletions

View File

@ -94,6 +94,8 @@ int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int
first = 1;
strcpy(instr, result);
wattrset(dialog, dialog_attr);
while (key != ESC) {
if (button == -1) { /* Input box selected */

View File

@ -48,10 +48,10 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int flen, int box_width, cht
i = strlen(instr);
input_x = i % box_width;
scroll = i - input_x;
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++)
waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
}
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++)
waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
wmove(dialog, box_y, box_x + input_x);
for (;;) {
@ -185,6 +185,11 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int flen, int box_width, cht
}
ret:
wattrset(dialog, old_attr);
wmove(dialog, box_y, box_x);
for (i = 0; i < box_width; i++)
waddch(dialog, instr[scroll+i] ? instr[scroll+i] : ' ');
wmove(dialog, box_y, input_x + box_x);
wrefresh(dialog);
strcpy(result, instr);
return key;
}

View File

@ -647,6 +647,7 @@ static int get_search_term(WINDOW *win, unsigned char *search_term, int height,
wattrset(win, searchbox_title_attr);
wmove(win, y, x+box_width/2-4);
waddstr(win, " Search ");
wattrset(win, dialog_attr);
box_width -= 2;
search_term[0] = '\0';