menuconfig: Do not open code textbox scroll up/down
We don't need to explicitely use ncurses' scroll(). ncurses performs vertical-motion optimization at wrefresh() time. Using strace I confirmed that with the following patch curses still sends only the new line of text to the terminal when scrolling up/down one line at a time. Signed-off-by: Benjamin Poirier <bpoirier@suse.de> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
5e609addb1
commit
1a374ae619
1 changed files with 11 additions and 44 deletions
|
@ -166,40 +166,12 @@ do_resize:
|
||||||
case 'K': /* Previous line */
|
case 'K': /* Previous line */
|
||||||
case 'k':
|
case 'k':
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
if (!begin_reached) {
|
if (begin_reached)
|
||||||
int passed_end = 0;
|
break;
|
||||||
|
|
||||||
back_lines(page_length + 1);
|
back_lines(page_length + 1);
|
||||||
|
refresh_text_box(dialog, box, boxh, boxw, cur_y,
|
||||||
/* We don't call print_page() here but use
|
cur_x);
|
||||||
* scrolling to ensure faster screen update.
|
|
||||||
* However, 'end_reached' and 'page_length'
|
|
||||||
* should still be updated, and 'page' should
|
|
||||||
* point to start of next page. This is done
|
|
||||||
* by calling get_line() in the following
|
|
||||||
* 'for' loop. */
|
|
||||||
scrollok(box, TRUE);
|
|
||||||
wscrl(box, -1); /* Scroll box region down one line */
|
|
||||||
scrollok(box, FALSE);
|
|
||||||
page_length = 0;
|
|
||||||
for (i = 0; i < boxh; i++) {
|
|
||||||
if (!i) {
|
|
||||||
/* print first line of page */
|
|
||||||
print_line(box, 0, boxw);
|
|
||||||
wnoutrefresh(box);
|
|
||||||
} else
|
|
||||||
/* Called to update 'end_reached' and 'page' */
|
|
||||||
get_line();
|
|
||||||
if (!passed_end)
|
|
||||||
page_length++;
|
|
||||||
if (end_reached && !passed_end)
|
|
||||||
passed_end = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_position(dialog);
|
|
||||||
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
|
|
||||||
wrefresh(dialog);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'B': /* Previous page */
|
case 'B': /* Previous page */
|
||||||
case 'b':
|
case 'b':
|
||||||
|
@ -214,17 +186,12 @@ do_resize:
|
||||||
case 'J': /* Next line */
|
case 'J': /* Next line */
|
||||||
case 'j':
|
case 'j':
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
if (!end_reached) {
|
if (end_reached)
|
||||||
begin_reached = 0;
|
break;
|
||||||
scrollok(box, TRUE);
|
|
||||||
scroll(box); /* Scroll box region up one line */
|
back_lines(page_length - 1);
|
||||||
scrollok(box, FALSE);
|
refresh_text_box(dialog, box, boxh, boxw, cur_y,
|
||||||
print_line(box, boxh - 1, boxw);
|
cur_x);
|
||||||
wnoutrefresh(box);
|
|
||||||
print_position(dialog);
|
|
||||||
wmove(dialog, cur_y, cur_x); /* Restore cursor position */
|
|
||||||
wrefresh(dialog);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case KEY_NPAGE: /* Next page */
|
case KEY_NPAGE: /* Next page */
|
||||||
case ' ':
|
case ' ':
|
||||||
|
|
Loading…
Add table
Reference in a new issue