Fix erroneous blinking in emacs (sgr with >15 fg but <16 bg)
This commit is contained in:
@@ -437,21 +437,16 @@ std::string Renditions::sgr( void ) const
|
|||||||
if ( inverse ) ret.append( ";7" );
|
if ( inverse ) ret.append( ";7" );
|
||||||
if ( invisible ) ret.append( ";8" );
|
if ( invisible ) ret.append( ";8" );
|
||||||
|
|
||||||
if ( foreground_color > 37 ) { /* use 256-color set */
|
if ( foreground_color
|
||||||
char col[ 64 ];
|
&& (foreground_color <= 37) ) {
|
||||||
snprintf( col, 64, "m\033[38;5;%d", foreground_color - 30 );
|
/* ANSI foreground color */
|
||||||
ret.append( col );
|
|
||||||
} else if ( foreground_color ) {
|
|
||||||
char col[ 8 ];
|
char col[ 8 ];
|
||||||
snprintf( col, 8, ";%d", foreground_color );
|
snprintf( col, 8, ";%d", foreground_color );
|
||||||
ret.append( col );
|
ret.append( col );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( background_color > 47 ) { /* use 256-color set */
|
if ( background_color
|
||||||
char col[ 64 ];
|
&& (background_color <= 47) ) {
|
||||||
snprintf( col, 64, "m\033[48;5;%d", background_color - 40 );
|
|
||||||
ret.append( col );
|
|
||||||
} else if ( background_color ) {
|
|
||||||
char col[ 8 ];
|
char col[ 8 ];
|
||||||
snprintf( col, 8, ";%d", background_color );
|
snprintf( col, 8, ";%d", background_color );
|
||||||
ret.append( col );
|
ret.append( col );
|
||||||
@@ -459,6 +454,18 @@ std::string Renditions::sgr( void ) const
|
|||||||
|
|
||||||
ret.append( "m" );
|
ret.append( "m" );
|
||||||
|
|
||||||
|
if ( foreground_color > 37 ) { /* use 256-color set */
|
||||||
|
char col[ 64 ];
|
||||||
|
snprintf( col, 64, "\033[38;5;%dm", foreground_color - 30 );
|
||||||
|
ret.append( col );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( background_color > 47 ) { /* use 256-color set */
|
||||||
|
char col[ 64 ];
|
||||||
|
snprintf( col, 64, "\033[48;5;%dm", background_color - 40 );
|
||||||
|
ret.append( col );
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user