aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBenjamin Poirier <bpoirier@suse.de>2012-08-23 14:55:07 -0400
committerMichal Marek <mmarek@suse.cz>2012-09-27 12:09:24 -0400
commit1a374ae6191e9c440f1953a264a94d38173737be (patch)
treed242376e9d1d57e824e9b8c14a71ef5b446ee495 /scripts
parent5e609addb1bd963ce1a1929f2012c8dd04ca8620 (diff)
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/lxdialog/textbox.c55
1 files changed, 11 insertions, 44 deletions
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c
index 506a095c387c..3b3c5c470bf8 100644
--- a/scripts/kconfig/lxdialog/textbox.c
+++ b/scripts/kconfig/lxdialog/textbox.c
@@ -166,40 +166,12 @@ do_resize:
166 case 'K': /* Previous line */ 166 case 'K': /* Previous line */
167 case 'k': 167 case 'k':
168 case KEY_UP: 168 case KEY_UP:
169 if (!begin_reached) { 169 if (begin_reached)
170 int passed_end = 0; 170 break;
171
172 back_lines(page_length + 1);
173
174 /* We don't call print_page() here but use
175 * scrolling to ensure faster screen update.
176 * However, 'end_reached' and 'page_length'
177 * should still be updated, and 'page' should
178 * point to start of next page. This is done
179 * by calling get_line() in the following
180 * 'for' loop. */
181 scrollok(box, TRUE);
182 wscrl(box, -1); /* Scroll box region down one line */
183 scrollok(box, FALSE);
184 page_length = 0;
185 for (i = 0; i < boxh; i++) {
186 if (!i) {
187 /* print first line of page */
188 print_line(box, 0, boxw);
189 wnoutrefresh(box);
190 } else
191 /* Called to update 'end_reached' and 'page' */
192 get_line();
193 if (!passed_end)
194 page_length++;
195 if (end_reached && !passed_end)
196 passed_end = 1;
197 }
198 171
199 print_position(dialog); 172 back_lines(page_length + 1);
200 wmove(dialog, cur_y, cur_x); /* Restore cursor position */ 173 refresh_text_box(dialog, box, boxh, boxw, cur_y,
201 wrefresh(dialog); 174 cur_x);
202 }
203 break; 175 break;
204 case 'B': /* Previous page */ 176 case 'B': /* Previous page */
205 case 'b': 177 case 'b':
@@ -214,17 +186,12 @@ do_resize:
214 case 'J': /* Next line */ 186 case 'J': /* Next line */
215 case 'j': 187 case 'j':
216 case KEY_DOWN: 188 case KEY_DOWN:
217 if (!end_reached) { 189 if (end_reached)
218 begin_reached = 0; 190 break;
219 scrollok(box, TRUE); 191
220 scroll(box); /* Scroll box region up one line */ 192 back_lines(page_length - 1);
221 scrollok(box, FALSE); 193 refresh_text_box(dialog, box, boxh, boxw, cur_y,
222 print_line(box, boxh - 1, boxw); 194 cur_x);
223 wnoutrefresh(box);
224 print_position(dialog);
225 wmove(dialog, cur_y, cur_x); /* Restore cursor position */
226 wrefresh(dialog);
227 }
228 break; 195 break;
229 case KEY_NPAGE: /* Next page */ 196 case KEY_NPAGE: /* Next page */
230 case ' ': 197 case ' ':