mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Make fish pager use non-universal variables as well for getting it's colors
darcs-hash:20060811145528-ac50b-26be05f363f353d87ebceccf73385cd1af1c88f2.gz
This commit is contained in:
parent
21de293a44
commit
72ad4e0d3b
3 changed files with 42 additions and 3 deletions
11
fish_pager.c
11
fish_pager.c
|
@ -138,14 +138,21 @@ typedef struct
|
||||||
|
|
||||||
static int get_color( int highlight )
|
static int get_color( int highlight )
|
||||||
{
|
{
|
||||||
|
wchar_t *val;
|
||||||
|
|
||||||
if( highlight < 0 )
|
if( highlight < 0 )
|
||||||
return FISH_COLOR_NORMAL;
|
return FISH_COLOR_NORMAL;
|
||||||
if( highlight >= (4) )
|
if( highlight >= (4) )
|
||||||
return FISH_COLOR_NORMAL;
|
return FISH_COLOR_NORMAL;
|
||||||
|
|
||||||
wchar_t *val = env_universal_get( hightlight_var[highlight]);
|
val = wgetenv( hightlight_var[highlight]);
|
||||||
|
|
||||||
|
if( !val )
|
||||||
|
{
|
||||||
|
val = env_universal_get( hightlight_var[highlight]);
|
||||||
|
}
|
||||||
|
|
||||||
if( val == 0 )
|
if( !val )
|
||||||
{
|
{
|
||||||
return FISH_COLOR_NORMAL;
|
return FISH_COLOR_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
28
wutil.c
28
wutil.c
|
@ -53,12 +53,14 @@
|
||||||
the \c wutil_wcs2str() function.
|
the \c wutil_wcs2str() function.
|
||||||
*/
|
*/
|
||||||
static char *tmp=0;
|
static char *tmp=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Buffer for converting narrow results to wide ones, used by the \c
|
Buffer for converting narrow results to wide ones, used by the \c
|
||||||
wutil_str2wcs() function. Avoid usign this without thinking about
|
wutil_str2wcs() function. Avoid usign this without thinking about
|
||||||
it, since sebseuent calls will overwrite previous values.
|
it, since subsequent calls will overwrite previous values.
|
||||||
*/
|
*/
|
||||||
static wchar_t *tmp2;
|
static wchar_t *tmp2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Length of the \c tmp buffer.
|
Length of the \c tmp buffer.
|
||||||
*/
|
*/
|
||||||
|
@ -518,3 +520,27 @@ const wchar_t *wgettext( const wchar_t *in )
|
||||||
return wres;
|
return wres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wchar_t *wgetenv( const wchar_t *name )
|
||||||
|
{
|
||||||
|
char *name_narrow =wutil_wcs2str(name);
|
||||||
|
char *res_narrow = getenv( name_narrow );
|
||||||
|
static string_buffer_t *out = 0;
|
||||||
|
|
||||||
|
if( !res_narrow )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( !out )
|
||||||
|
{
|
||||||
|
out = sb_halloc( global_context );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb_clear( out );
|
||||||
|
}
|
||||||
|
|
||||||
|
sb_printf( out, L"%s", res_narrow );
|
||||||
|
|
||||||
|
return (wchar_t *)out->buff;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
6
wutil.h
6
wutil.h
|
@ -128,4 +128,10 @@ wchar_t *wbasename( const wchar_t *path );
|
||||||
*/
|
*/
|
||||||
const wchar_t *wgettext( const wchar_t *in );
|
const wchar_t *wgettext( const wchar_t *in );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Wide character version of getenv
|
||||||
|
*/
|
||||||
|
wchar_t *wgetenv( const wchar_t *name );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue