watch: Support ANSI 39,49 reset sequences
ANSI colour sequences 39 and 49 reset the foreground and background colours respectively. This feature was missing from watch using the colour "-c" option. References: Fixes #73 https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
This commit is contained in:
parent
a935a65b77
commit
c0256bb2d2
1
NEWS
1
NEWS
@ -24,6 +24,7 @@ procps-ng-NEXT
|
|||||||
* top: provide proper multi-byte string handling issue #68
|
* top: provide proper multi-byte string handling issue #68
|
||||||
* watch: define HOST_NAME_MAX where not defined Debian #830734
|
* watch: define HOST_NAME_MAX where not defined Debian #830734
|
||||||
* vmstat: Fix alignment for disk partition format issue #69
|
* vmstat: Fix alignment for disk partition format issue #69
|
||||||
|
* watch: Support ANSI 39,49 reset sequences issue #73
|
||||||
|
|
||||||
procps-ng-3.3.12
|
procps-ng-3.3.12
|
||||||
----------------
|
----------------
|
||||||
|
6
watch.c
6
watch.c
@ -184,6 +184,12 @@ static int set_ansi_attribute(const int attrib)
|
|||||||
case 27: /* unset inversed */
|
case 27: /* unset inversed */
|
||||||
attributes &= ~A_REVERSE;
|
attributes &= ~A_REVERSE;
|
||||||
break;
|
break;
|
||||||
|
case 39:
|
||||||
|
fg_col = 0;
|
||||||
|
break;
|
||||||
|
case 49:
|
||||||
|
bg_col = 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (attrib >= 30 && attrib <= 37) { /* set foreground color */
|
if (attrib >= 30 && attrib <= 37) { /* set foreground color */
|
||||||
fg_col = attrib - 30 + 1;
|
fg_col = attrib - 30 + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user