mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
step-coloring initial
set_color correction
This commit is contained in:
parent
25f9105a97
commit
234ed8f5da
2 changed files with 13 additions and 7 deletions
|
@ -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
|
||||
*/
|
||||
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 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);
|
||||
if( i != 0 )
|
||||
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 );
|
||||
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) );
|
||||
}
|
||||
|
||||
|
@ -442,7 +443,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
|||
writech( L' ');
|
||||
}
|
||||
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( L")", 1, 0 );
|
||||
}
|
||||
|
@ -454,7 +455,7 @@ static void completion_print_item( const wchar_t *prefix, comp_t *c, int width )
|
|||
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 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( j = 0; j < cols; j++ )
|
||||
|
@ -495,7 +500,7 @@ static void completion_print( int cols,
|
|||
|
||||
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)
|
||||
writestr( L" " );
|
||||
|
|
|
@ -280,7 +280,8 @@ void set_color(rgb_color_t c, rgb_color_t c2)
|
|||
Background is set
|
||||
*/
|
||||
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))
|
||||
|
|
Loading…
Reference in a new issue