Skip to content

Commit

Permalink
gui: fix wbkgrndset for non-wide ncurses by fallback to wbkgdset (issue
Browse files Browse the repository at this point in the history
weechat#1343)

cchar_t, setcchar and wbkgrndset are actually widec ncurses features,
not ext-colors features, but NCURSES_WIDECHAR doesn't accurately reflect
their existence so NCURSES_EXT_COLORS is used instead.
  • Loading branch information
sim642 committed May 4, 2019
1 parent c7b242f commit 5910bcf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/curses/gui-curses-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ gui_window_clear (WINDOW *window, int fg, int bg)
else
bg = gui_weechat_colors[bg & GUI_COLOR_EXTENDED_MASK].background;

#ifdef NCURSES_EXT_COLORS
cchar_t c;
setcchar (&c, L" ", attrs, gui_color_get_pair (fg, bg), NULL);
wbkgrndset (window, &c);
#else
wbkgdset (window, ' ' | COLOR_PAIR (gui_color_get_pair (fg, bg)) | attrs);
#endif
werase (window);
wmove (window, 0, 0);
}
Expand All @@ -207,10 +211,16 @@ gui_window_clear (WINDOW *window, int fg, int bg)
void
gui_window_clrtoeol (WINDOW *window)
{
#ifdef NCURSES_EXT_COLORS
cchar_t c;
setcchar (&c, L" ", A_NORMAL, gui_color_get_pair (gui_window_current_style_fg,
gui_window_current_style_bg), NULL);
wbkgrndset (window, &c);
#else
wbkgdset (window,
' ' | COLOR_PAIR (gui_color_get_pair (gui_window_current_style_fg,
gui_window_current_style_bg)));
#endif
wclrtoeol (window);
}

Expand Down

0 comments on commit 5910bcf

Please sign in to comment.