1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-07-17 18:51:02 +02:00

38356: allow integers as curses colours

This commit is contained in:
Sebastian Gniazdowski 2016-04-29 13:34:19 +02:00 committed by Peter Stephenson
parent 7fc0c2d57d
commit fea013b8e8
3 changed files with 23 additions and 4 deletions

View file

@ -1,6 +1,9 @@
2016-04-29 Peter Stephenson <p.stephenson@samsung.com>
* Sebastian: 39354: Src/Modules/curses.c: alter internal return
* Sebastian: 38356: Src/Modules/curses.c, Doc/Zsh/mod_curses.yo:
allow integers as colours in curses.
* Sebastian: 38354: Src/Modules/curses.c: alter internal return
code so as not to mask curses error code.
2016-04-26 Barton E. Schaefer <schaefer@zsh.org>

View file

@ -111,7 +111,11 @@ Each var(fg_col)tt(/)var(bg_col) attribute (to be read as
for character output. The color tt(default) is sometimes available
(in particular if the library is ncurses), specifying the foreground
or background color with which the terminal started. The color pair
tt(default/default) is always available.
tt(default/default) is always available. To use more than the 8 named
colors (red, green, etc.) construct the var(fg_col)tt(/)var(bg_col)
pairs where var(fg_col) and var(bg_col) are decimal integers, e.g
tt(128/200). The maximum color value is 254 if the terminal supports
256 colors.
tt(bg) overrides the color and other attributes of all characters in the
window. Its usual use is to set the background initially, but it will

View file

@ -350,8 +350,20 @@ zcurses_colorget(const char *nam, char *colorpair)
}
*bg = '\0';
f = zcurses_color(cp);
b = zcurses_color(bg+1);
// cp/bg can be {number}/{number} or {name}/{name}
if( cp[0] >= '0' && cp[0] <= '9' ) {
f = atoi(cp);
} else {
f = zcurses_color(cp);
}
if( (bg+1)[0] >= '0' && (bg+1)[0] <= '9' ) {
b = atoi(bg+1);
} else {
b = zcurses_color(bg+1);
}
if (f==-2 || b==-2) {
if (f == -2)