X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_bkgd.c;h=1dcae90d6ad955c1576f46a556fb54635d078a18;hp=aa1db21e4fa8f5f050b8fc0ae64a55eecf2dd91c;hb=1f7a36fe16b11bb4aab51be89bbc1b0f75936b78;hpb=9d37907c2305ee3dc7b829e98a465c3def2074f0 diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c index aa1db21e..1dcae90d 100644 --- a/ncurses/base/lib_bkgd.c +++ b/ncurses/base/lib_bkgd.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2014,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,7 +37,9 @@ #include -MODULE_ID("$Id: lib_bkgd.c,v 1.53 2019/08/17 20:59:41 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.55 2020/03/02 01:34:48 tom Exp $") + +static const NCURSES_CH_T blank = NewChar(BLANK_TEXT); /* * Set the window's background information. @@ -142,6 +145,14 @@ wbkgrnd(WINDOW *win, const ARG_CH_T ch) SetPair(new_bkgd, 0); } + /* avoid setting background-character to a null */ + if (CharOf(new_bkgd) == 0) { + NCURSES_CH_T tmp_bkgd = blank; + SetAttr(tmp_bkgd, AttrOf(new_bkgd)); + SetPair(tmp_bkgd, GetPair(new_bkgd)); + new_bkgd = tmp_bkgd; + } + memset(&old_bkgd, 0, sizeof(old_bkgd)); (void) wgetbkgrnd(win, &old_bkgd);