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 | 18 | #endif |
| 19 | 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 | 21 | #define TR(params) _tracef params |
| 38 | 22 | |
| 39 | 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 | 63 | /* Clear 'residue' of last item */ |
| 64 | 64 | wattrset(win, dlg.menubox.atr); |
| 65 | 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 | 66 | wclrtoeol(win); |
| 74 | −#endif | |
| 75 | 67 | wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); |
| 76 | 68 | mvwaddstr(win, line_y, item_x, menu_item); |
| 77 | 69 | if (hotkey) { |
| @@ -336,16 +336,7 @@ static void print_line(WINDOW * win, int row, int width) · 335 unmodified lines | ||
| 336 | 336 | waddnstr(win, line, MIN(strlen(line), width - 2)); |
| 337 | 337 | |
| 338 | 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 | 339 | wclrtoeol(win); |
| 348 | −#endif | |
| 349 | 340 | } |
| 350 | 341 | |
| 351 | 342 | /* |