mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 02:31:18 -03:00
step-coloring initial
set_color correction
This commit is contained in:
@@ -389,7 +389,7 @@ static int print_max( const wchar_t *str, int max, int has_more )
|
|||||||
/**
|
/**
|
||||||
Print the specified item using at the specified amount of space
|
Print the specified item using at the specified amount of space
|
||||||
*/
|
*/
|
||||||
static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
static void completion_print_item( const wchar_t *prefix, comp_t *c, int width, const rgb_color_t& bgc )
|
||||||
{
|
{
|
||||||
int comp_width=0, desc_width=0;
|
int comp_width=0, desc_width=0;
|
||||||
int written=0;
|
int written=0;
|
||||||
@@ -427,9 +427,10 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
|||||||
const wcstring &comp = c->comp.at(i);
|
const wcstring &comp = c->comp.at(i);
|
||||||
if( i != 0 )
|
if( i != 0 )
|
||||||
written += print_max( L" ", comp_width - written, 2 );
|
written += print_max( L" ", comp_width - written, 2 );
|
||||||
set_color( get_color(HIGHLIGHT_PAGER_PREFIX),rgb_color_t::normal() );
|
// set_color( get_color(HIGHLIGHT_PAGER_PREFIX), rgb_color_t::normal() );
|
||||||
|
set_color( get_color(HIGHLIGHT_PAGER_PREFIX), bgc );
|
||||||
written += print_max( prefix, comp_width - written, comp.empty()?0:1 );
|
written += print_max( prefix, comp_width - written, comp.empty()?0:1 );
|
||||||
set_color( get_color(HIGHLIGHT_PAGER_COMPLETION),rgb_color_t::ignore() );
|
set_color( get_color(HIGHLIGHT_PAGER_COMPLETION), bgc );
|
||||||
written += print_max( comp.c_str(), comp_width - written, i!=(c->comp.size()-1) );
|
written += print_max( comp.c_str(), comp_width - written, i!=(c->comp.size()-1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +443,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
|||||||
writech( L' ');
|
writech( L' ');
|
||||||
}
|
}
|
||||||
written += print_max( L"(", 1, 0 );
|
written += print_max( L"(", 1, 0 );
|
||||||
set_color( get_color( HIGHLIGHT_PAGER_DESCRIPTION ), rgb_color_t::ignore() );
|
set_color( get_color( HIGHLIGHT_PAGER_DESCRIPTION ), bgc );
|
||||||
written += print_max( c->desc.c_str(), desc_width, 0 );
|
written += print_max( c->desc.c_str(), desc_width, 0 );
|
||||||
written += print_max( L")", 1, 0 );
|
written += print_max( L")", 1, 0 );
|
||||||
}
|
}
|
||||||
@@ -454,7 +455,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
|||||||
writech( L' ');
|
writech( L' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set_color( rgb_color_t::normal(), rgb_color_t::normal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -482,6 +483,10 @@ static void completion_print( int cols,
|
|||||||
int rows = (lst.size()-1)/cols+1;
|
int rows = (lst.size()-1)/cols+1;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
rgb_color_t b1 = rgb_color_t::normal();
|
||||||
|
rgb_color_t b2 = rgb_color_t( "#0D0D0D" );
|
||||||
|
b2.set_underline( false );
|
||||||
|
|
||||||
for( i = row_start; i<row_stop; i++ )
|
for( i = row_start; i<row_stop; i++ )
|
||||||
{
|
{
|
||||||
for( j = 0; j < cols; j++ )
|
for( j = 0; j < cols; j++ )
|
||||||
@@ -495,7 +500,7 @@ static void completion_print( int cols,
|
|||||||
|
|
||||||
el = lst.at(j*rows + i );
|
el = lst.at(j*rows + i );
|
||||||
|
|
||||||
completion_print_item( prefix, el, width[j] - (is_last?0:2) );
|
completion_print_item( prefix, el, width[j] - (is_last?0:2), i%2?b2:b1 );
|
||||||
|
|
||||||
if( !is_last)
|
if( !is_last)
|
||||||
writestr( L" " );
|
writestr( L" " );
|
||||||
|
|||||||
@@ -280,7 +280,8 @@ void set_color(rgb_color_t c, rgb_color_t c2)
|
|||||||
Background is set
|
Background is set
|
||||||
*/
|
*/
|
||||||
bg_set=1;
|
bg_set=1;
|
||||||
c = (c2==rgb_color_t::white())?rgb_color_t::black():rgb_color_t::white();
|
if ( c==c2 )
|
||||||
|
c = (c2==rgb_color_t::white())?rgb_color_t::black():rgb_color_t::white();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (enter_bold_mode != 0) && (strlen(enter_bold_mode) > 0))
|
if( (enter_bold_mode != 0) && (strlen(enter_bold_mode) > 0))
|
||||||
|
|||||||
Reference in New Issue
Block a user