Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: Fix indention when using menuconfig in text-onle consoles

When using menuconfig in a text-only console (no X started)
the indention was often two spaces wrong. This proved to be a ncurses
issue which are worked around by calling wrefresh more often.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

+18 -19
+18 -19
scripts/lxdialog/menubox.c
··· 94 94 } 95 95 if (selected) { 96 96 wmove(win, choice, ITEM_IDENT + 1); 97 - wrefresh(win); 98 97 } 99 98 free(menu_item); 99 + wrefresh(win); 100 100 } 101 101 102 102 /* ··· 125 125 126 126 y = y + height + 1; 127 127 wmove(win, y, x); 128 + wrefresh(win); 128 129 129 130 if ((height < item_no) && (scroll + height < item_no)) { 130 131 wattrset(win, darrow_attr); ··· 140 139 } 141 140 142 141 wmove(win, cur_y, cur_x); 142 + wrefresh(win); 143 143 } 144 144 145 145 /* ··· 156 154 print_button(win, " Help ", y, x + 24, selected == 2); 157 155 158 156 wmove(win, y, x + 1 + 12 * selected); 157 + wrefresh(win); 158 + } 159 + 160 + /* scroll up n lines (n may be negative) */ 161 + static void do_scroll(WINDOW *win, int *scroll, int n) 162 + { 163 + /* Scroll menu up */ 164 + scrollok(win, TRUE); 165 + wscrl(win, n); 166 + scrollok(win, FALSE); 167 + *scroll = *scroll + n; 159 168 wrefresh(win); 160 169 } 161 170 ··· 299 286 if (key == KEY_UP || key == '-') { 300 287 if (choice < 2 && scroll) { 301 288 /* Scroll menu down */ 302 - scrollok(menu, TRUE); 303 - wscrl(menu, -1); 304 - scrollok(menu, FALSE); 305 - 306 - scroll--; 289 + do_scroll(menu, &scroll, -1); 307 290 308 291 print_item(menu, items[scroll * 2 + 1], 0, FALSE, 309 292 (items[scroll * 2][0] != ':')); ··· 315 306 if ((choice > max_choice - 3) && 316 307 (scroll + max_choice < item_no)) { 317 308 /* Scroll menu up */ 318 - scrollok(menu, TRUE); 319 - wscrl(menu, 1); 320 - scrollok(menu, FALSE); 321 - 322 - scroll++; 309 + do_scroll(menu, &scroll, 1); 323 310 324 311 print_item(menu, items[(scroll + max_choice - 1) * 2 + 1], 325 312 max_choice - 1, FALSE, ··· 327 322 scrollok(menu, TRUE); 328 323 for (i = 0; (i < max_choice); i++) { 329 324 if (scroll > 0) { 330 - wscrl(menu, -1); 331 - scroll--; 325 + do_scroll(menu, &scroll, -1); 332 326 print_item(menu, items[scroll * 2 + 1], 0, FALSE, 333 327 (items[scroll * 2][0] != ':')); 334 328 } else { ··· 335 331 choice--; 336 332 } 337 333 } 338 - scrollok(menu, FALSE); 339 334 340 335 } else if (key == KEY_NPAGE) { 341 336 for (i = 0; (i < max_choice); i++) { 342 337 if (scroll + max_choice < item_no) { 343 - scrollok(menu, TRUE); 344 - wscrl(menu, 1); 345 - scrollok(menu, FALSE); 346 - scroll++; 338 + do_scroll(menu, &scroll, 1); 347 339 print_item(menu, items[(scroll + max_choice - 1) * 2 + 1], 348 340 max_choice - 1, FALSE, 349 341 (items [(scroll + max_choice - 1) * 2][0] != ':')); ··· 348 348 choice++; 349 349 } 350 350 } 351 - 352 351 } else 353 352 choice = i; 354 353