This code has been here for more than 20 years. The bug in the old days no longer matters.
Unified · Split
| @@ -18,22 +18,6 @@ · 17 unmodified lines | |||
| 18 | #endif | 18 | #endif |
| 19 | #include <ncurses.h> | 19 | #include <ncurses.h> |
| 20 | 20 | ||
| 21 | /* | ||
| 22 | * Colors in ncurses 1.9.9e do not work properly since foreground and | ||
| 23 | * background colors are OR'd rather than separately masked. This version | ||
| 24 | * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible | ||
| 25 | * with standard curses. The simplest fix (to make this work with standard | ||
| 26 | * curses) uses the wbkgdset() function, not used in the original hack. | ||
| 27 | * Turn it off if we're building with 1.9.9e, since it just confuses things. | ||
| 28 | */ | ||
| 29 | #if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) | ||
| 30 | #define OLD_NCURSES 1 | ||
| 31 | #undef wbkgdset | ||
| 32 | #define wbkgdset(w,p) /*nothing */ | ||
| 33 | #else | ||
| 34 | #define OLD_NCURSES 0 | ||
| 35 | #endif | ||
| 36 | |||
| 37 | #define TR(params) _tracef params | 21 | #define TR(params) _tracef params |
| 38 | 22 | ||
| 39 | #define KEY_ESC 27 | 23 | #define KEY_ESC 27 |
| @@ -63,15 +63,7 @@ static void do_print_item(WINDOW * win, const char *item, int line_y, · 62 unmodified lines | |||
| 63 | /* Clear 'residue' of last item */ | 63 | /* Clear 'residue' of last item */ |
| 64 | wattrset(win, dlg.menubox.atr); | 64 | wattrset(win, dlg.menubox.atr); |
| 65 | wmove(win, line_y, 0); | 65 | wmove(win, line_y, 0); |
| 66 | #if OLD_NCURSES | ||
| 67 | { | ||
| 68 | int i; | ||
| 69 | for (i = 0; i < menu_width; i++) | ||
| 70 | waddch(win, ' '); | ||
| 71 | } | ||
| 72 | #else | ||
| 73 | wclrtoeol(win); | 66 | wclrtoeol(win); |
| 74 | #endif | ||
| 75 | wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); | 67 | wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); |
| 76 | mvwaddstr(win, line_y, item_x, menu_item); | 68 | mvwaddstr(win, line_y, item_x, menu_item); |
| 77 | if (hotkey) { | 69 | if (hotkey) { |
| @@ -336,16 +336,7 @@ static void print_line(WINDOW * win, int row, int width) · 335 unmodified lines | |||
| 336 | waddnstr(win, line, MIN(strlen(line), width - 2)); | 336 | waddnstr(win, line, MIN(strlen(line), width - 2)); |
| 337 | 337 | ||
| 338 | /* Clear 'residue' of previous line */ | 338 | /* Clear 'residue' of previous line */ |
| 339 | #if OLD_NCURSES | ||
| 340 | { | ||
| 341 | int x = getcurx(win); | ||
| 342 | int i; | ||
| 343 | for (i = 0; i < width - x; i++) | ||
| 344 | waddch(win, ' '); | ||
| 345 | } | ||
| 346 | #else | ||
| 347 | wclrtoeol(win); | 339 | wclrtoeol(win); |
| 348 | #endif | ||
| 349 | } | 340 | } |
| 350 | 341 | ||
| 351 | /* | 342 | /* |