i am thinking there is a flaw in the ANSI code,
and this program demonstrates this 'flaw'.  when
the 'inverse' attribute is set on the ANSI color
string, the 'clear to EOL' ANSI string does so
without respect to the 'inverse' attribute.

for example:

NORMAL
Foreground=White
Background=Red
CLEAR-TO-EOL=Red Background.

INVERSE
Foreground=Red
Background=White
CLEAR-TO-EOL=Red Background.
(it makes more sense for CLEAR-TO-EOL
to make a White Background in this instance).

///////////////////////////////////////////////////////////////////////////////
int main            (int argc, char* argv[]) {

//         ESC  [     [at]  ;    3     [fg]  ;    4     [bg]  m
char a[]={ 0x1b,0x5b, 0x30, 0x3b,0x33, 0x37, 0x3b,0x34, 0x31, 0x6d };
char b[]={ 0x1b,0x5b, 0x31, 0x3b,0x33, 0x37, 0x3b,0x34, 0x31, 0x6d };
char c[]={ 0x1b,0x5b, 0x37, 0x3b,0x33, 0x37, 0x3b,0x34, 0x31, 0x6d };
char d[]={ 0x1b,0x5b, 0x30, 0x3b,0x33, 0x31, 0x3b,0x34, 0x37, 0x6d };
char e[]={ 0x1b,0x5b, 0x31, 0x3b,0x33, 0x31, 0x3b,0x34, 0x37, 0x6d };
char f[]={ 0x1b,0x5b, 0x37, 0x3b,0x33, 0x31, 0x3b,0x34, 0x37, 0x6d };

char k[]={ 0x1b,0x5b,0x4b }; // clear to EOL ...

char* s="0123456789";

write(STDO, a, 10); write(STDO, k,  3); write(STDO, s, 10); printf("\n");
write(STDO, b, 10); write(STDO, k,  3); write(STDO, s, 10); printf("\n");
write(STDO, c, 10); write(STDO, k,  3); write(STDO, s, 10); printf("\n");
write(STDO, d, 10); write(STDO, k,  3); write(STDO, s, 10); printf("\n");
write(STDO, e, 10); write(STDO, k,  3); write(STDO, s, 10); printf("\n");
write(STDO, f, 10); write(STDO, k,  3); write(STDO, s, 10); printf("\n");

// 'c' and 'f' do not "inverse" the "clear to EOL" ...

exit(0); }
///////////////////////////////////////////////////////////////////////////////
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to