Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Fix "default" color in zsh/curses
- X-seq: zsh-workers 38354
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] Fix "default" color in zsh/curses
- Date: Thu, 28 Apr 2016 22:24:27 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=h1RSN2VEFm1ebNt0UyV40pzbbUAS02GfqINCNHw09Uc=; b=lJI5z2Vm7z9K6QzbdWfs5hq9Mma0DKdwOdUl8Gf7nEFM2wZA2BR+cCgtW7xtw28vxc UW9sO5OYq8anqN42QMUYCUS2xqnW9ZPZPd9f90w2w0o1OpC7o3dV/RakvW5u/noMxbBq za9mzQiCgeIXo+itDN7Z3BSV7jO2Ag1DnO1UvIf6FcV9Ms9nkXUK7sTnKhMViWn4g594 2VYNjj7jzWkKskSDT9Zjp94gfB2I2uJvCOeOcmGmRgOTp2JwU7K3kqYT4Fkxp857SVs4 XCUrnKPqukW3l3sHI0XHzNALhavx53Ma7PHWSdlq0B6VuMty0bJvYX9xNFBP/nAPPvu5 rARA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello,
a curses documentation tells:
"The first function, use_default_colors() tells the curses library to
assign terminal default foreground/background colors to color number
-1. So init_pair(x,COLOR_RED,-1) will initialize pair x as red on
default background and init_pair(x,-1,COLOR_BLUE) will initialize pair
x as default foreground on blue."
curses.c correctly has:
#ifdef HAVE_USE_DEFAULT_COLORS
{"default", -1},
#endif
However, following function uses -1 as error code:
static short
zcurses_color(const char *color)
{
struct zcurses_namenumberpair *zc;
for(zc=(struct zcurses_namenumberpair *)zcurses_colors;zc->name;zc++)
if (!strcmp(color, zc->name)) {
return (short)zc->number;
}
return (short)-1;
}
The line "return (short)zc->number;" will return -1 for "default"
color and this will result in error message. All the patch does is
making -2 to be error code, so that -1 can be passed on to
curses/ncurses.
Best regards,
Sebastian Gniazdowski
Attachment:
default_zcurses_fix.patch
Description: Binary data
Messages sorted by:
Reverse Date,
Date,
Thread,
Author