mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Minor code tweaks: A few extra input validations, spelling corrections, etc
darcs-hash:20060710223956-ac50b-22d3b2adf570872564abf7ab68bb223d0c4a5308.gz
This commit is contained in:
parent
746a602515
commit
bb04df2ac9
4 changed files with 23 additions and 11 deletions
|
@ -1965,6 +1965,9 @@ void complete( const wchar_t *cmd,
|
||||||
|
|
||||||
CHECK( cmd, );
|
CHECK( cmd, );
|
||||||
CHECK( comp, );
|
CHECK( comp, );
|
||||||
|
|
||||||
|
// debug( 1, L"Complete '%ls'", cmd );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
If we are completing a variable name or a tilde expansion user
|
If we are completing a variable name or a tilde expansion user
|
||||||
|
@ -2062,7 +2065,7 @@ void complete( const wchar_t *cmd,
|
||||||
|
|
||||||
prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L"");
|
prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L"");
|
||||||
|
|
||||||
// fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token );
|
// debug( 0, L"on_command: %d, %ls %ls\n", on_command, current_command, current_token );
|
||||||
if( !had_cmd )
|
if( !had_cmd )
|
||||||
{
|
{
|
||||||
on_command=1;
|
on_command=1;
|
||||||
|
|
2
main.c
2
main.c
|
@ -90,7 +90,7 @@ static int read_init()
|
||||||
if( chdir( cwd ) == -1 )
|
if( chdir( cwd ) == -1 )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
If we can't change back to previos irectory, we'll stay in
|
If we can't change back to previos directory, we'll stay in
|
||||||
~. Should be a sane default behavior.
|
~. Should be a sane default behavior.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
25
output.c
25
output.c
|
@ -123,6 +123,7 @@ static void output_destroy()
|
||||||
|
|
||||||
void output_set_writer( int (*writer)(char) )
|
void output_set_writer( int (*writer)(char) )
|
||||||
{
|
{
|
||||||
|
CHECK( writer, );
|
||||||
out = writer;
|
out = writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +146,6 @@ void set_color( int c, int c2 )
|
||||||
is_underline |= (c&FISH_COLOR_UNDERLINE)!=0;
|
is_underline |= (c&FISH_COLOR_UNDERLINE)!=0;
|
||||||
is_underline |= (c2&FISH_COLOR_UNDERLINE)!=0;
|
is_underline |= (c2&FISH_COLOR_UNDERLINE)!=0;
|
||||||
|
|
||||||
// debug( 1, L"WOO %d %d %d", is_bold, c&FISH_COLOR_BOLD,c2&FISH_COLOR_BOLD);
|
|
||||||
|
|
||||||
c = c&(~(FISH_COLOR_BOLD|FISH_COLOR_UNDERLINE));
|
c = c&(~(FISH_COLOR_BOLD|FISH_COLOR_UNDERLINE));
|
||||||
c2 = c2&(~(FISH_COLOR_BOLD|FISH_COLOR_UNDERLINE));
|
c2 = c2&(~(FISH_COLOR_BOLD|FISH_COLOR_UNDERLINE));
|
||||||
|
|
||||||
|
@ -367,9 +366,8 @@ int writeb( tputs_arg_t b )
|
||||||
|
|
||||||
int writembs( char *str )
|
int writembs( char *str )
|
||||||
{
|
{
|
||||||
if( !str )
|
CHECK( str, 1 );
|
||||||
return 1;
|
|
||||||
|
|
||||||
return tputs(str,1,&writeb)==ERR?1:0;
|
return tputs(str,1,&writeb)==ERR?1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +408,8 @@ int writech( wint_t ch )
|
||||||
void writestr( const wchar_t *str )
|
void writestr( const wchar_t *str )
|
||||||
{
|
{
|
||||||
char *pos;
|
char *pos;
|
||||||
|
|
||||||
|
CHECK( str, );
|
||||||
|
|
||||||
// while( *str )
|
// while( *str )
|
||||||
// writech( *str++ );
|
// writech( *str++ );
|
||||||
|
@ -465,7 +465,11 @@ void writestr( const wchar_t *str )
|
||||||
void writestr_ellipsis( const wchar_t *str, int max_width )
|
void writestr_ellipsis( const wchar_t *str, int max_width )
|
||||||
{
|
{
|
||||||
int written=0;
|
int written=0;
|
||||||
int tot = my_wcswidth(str);
|
int tot;
|
||||||
|
|
||||||
|
CHECK( str, );
|
||||||
|
|
||||||
|
tot = my_wcswidth(str);
|
||||||
|
|
||||||
if( tot <= max_width )
|
if( tot <= max_width )
|
||||||
{
|
{
|
||||||
|
@ -497,11 +501,16 @@ void writestr_ellipsis( const wchar_t *str, int max_width )
|
||||||
int write_escaped_str( const wchar_t *str, int max_len )
|
int write_escaped_str( const wchar_t *str, int max_len )
|
||||||
{
|
{
|
||||||
|
|
||||||
wchar_t *out = escape( str, 1 );
|
wchar_t *out;
|
||||||
int i;
|
int i;
|
||||||
int len = my_wcswidth( out );
|
int len;
|
||||||
int written=0;
|
int written=0;
|
||||||
|
|
||||||
|
CHECK( str, 0 );
|
||||||
|
|
||||||
|
out = escape( str, 1 );
|
||||||
|
len = my_wcswidth( out );
|
||||||
|
|
||||||
if( max_len && (max_len < len))
|
if( max_len && (max_len < len))
|
||||||
{
|
{
|
||||||
for( i=0; (written+wcwidth(out[i]))<=(max_len-1); i++ )
|
for( i=0; (written+wcwidth(out[i]))<=(max_len-1); i++ )
|
||||||
|
|
|
@ -24,7 +24,7 @@ for idx in (seq (count $PATH))
|
||||||
end
|
end
|
||||||
|
|
||||||
if count $erase_idx >/dev/null
|
if count $erase_idx >/dev/null
|
||||||
set -e PATH[(echo $erase_idx)]
|
set -e PATH[(echo $erase_idx)]
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue