mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Minor tweaks to previous fish_pager patch to fix two bugs
darcs-hash:20060822135815-ac50b-35d9f643385ec29f9d8f93ca83d01e060de93cc7.gz
This commit is contained in:
parent
dfe3dc1429
commit
480a29594e
4 changed files with 19 additions and 27 deletions
11
complete.h
11
complete.h
|
@ -53,17 +53,6 @@
|
||||||
*/
|
*/
|
||||||
#define COMPLETE_SEP_STR L"\004"
|
#define COMPLETE_SEP_STR L"\004"
|
||||||
|
|
||||||
/**
|
|
||||||
Sent to the fish_pager to signify the end of input
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PAGER_EOT '\003'
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sent to the fish_pager to signify the end of input
|
|
||||||
*/
|
|
||||||
#define PAGER_EOT_STR L"\003"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Separator between completion items in fish_pager. This is used for
|
Separator between completion items in fish_pager. This is used for
|
||||||
completion grouping, e.g. when putting completions with the same
|
completion grouping, e.g. when putting completions with the same
|
||||||
|
|
2
exec.c
2
exec.c
|
@ -1055,8 +1055,6 @@ void exec( job_t *j )
|
||||||
case INTERNAL_BUFFER:
|
case INTERNAL_BUFFER:
|
||||||
{
|
{
|
||||||
|
|
||||||
debug( 0, L"fork internal buffer" );
|
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
|
||||||
if( pid == 0 )
|
if( pid == 0 )
|
||||||
|
|
28
fish_pager.c
28
fish_pager.c
|
@ -990,9 +990,9 @@ void destroy()
|
||||||
void read_array( FILE* file, array_list_t *comp )
|
void read_array( FILE* file, array_list_t *comp )
|
||||||
{
|
{
|
||||||
char buffer[BUFSIZE];
|
char buffer[BUFSIZE];
|
||||||
char c;
|
int c;
|
||||||
int i;
|
int i;
|
||||||
wchar_t *wcs;
|
wchar_t *wcs, *unescaped;
|
||||||
|
|
||||||
while( !feof( file ) )
|
while( !feof( file ) )
|
||||||
{
|
{
|
||||||
|
@ -1000,24 +1000,28 @@ void read_array( FILE* file, array_list_t *comp )
|
||||||
while( i < BUFSIZE-1 )
|
while( i < BUFSIZE-1 )
|
||||||
{
|
{
|
||||||
c = getc( file );
|
c = getc( file );
|
||||||
if( c == '\n' || c == PAGER_EOT )
|
if( c == EOF )
|
||||||
{
|
{
|
||||||
break;
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
if( c == '\n' )
|
||||||
|
{
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[ i++ ] = c;
|
buffer[ i++ ] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[ i ] = '\0';
|
buffer[ i ] = '\0';
|
||||||
|
|
||||||
wcs = str2wcs( buffer );
|
wcs = str2wcs( buffer );
|
||||||
if( wcs )
|
if( wcs )
|
||||||
{
|
{
|
||||||
al_push( comp, wcs );
|
unescaped = unescape( wcs, 0 );
|
||||||
}
|
al_push( comp, unescaped );
|
||||||
if( c == PAGER_EOT )
|
free( wcs );
|
||||||
{
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1042,7 +1046,7 @@ int main( int argc, char **argv )
|
||||||
debug( 3, L"prefix is '%ls'", prefix );
|
debug( 3, L"prefix is '%ls'", prefix );
|
||||||
|
|
||||||
if( argc > 3 )
|
if( argc > 3 )
|
||||||
{
|
{
|
||||||
for( i=3; i<argc; i++ )
|
for( i=3; i<argc; i++ )
|
||||||
{
|
{
|
||||||
wchar_t *wcs = str2wcs( argv[i] );
|
wchar_t *wcs = str2wcs( argv[i] );
|
||||||
|
|
5
reader.c
5
reader.c
|
@ -1485,10 +1485,11 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp )
|
||||||
|
|
||||||
for( i=0; i<al_get_count( comp); i++ )
|
for( i=0; i<al_get_count( comp); i++ )
|
||||||
{
|
{
|
||||||
wchar_t *el = (wchar_t*)al_get( comp, i );
|
wchar_t *el = escape((wchar_t*)al_get( comp, i ), 0);
|
||||||
|
|
||||||
sb_printf( &msg, L"%ls\n", el );
|
sb_printf( &msg, L"%ls\n", el );
|
||||||
|
free( el );
|
||||||
}
|
}
|
||||||
sb_printf( &msg, PAGER_EOT_STR );
|
|
||||||
|
|
||||||
foo = wcs2str( (wchar_t *)msg.buff );
|
foo = wcs2str( (wchar_t *)msg.buff );
|
||||||
b_append( in->param2.out_buffer, foo, strlen(foo) );
|
b_append( in->param2.out_buffer, foo, strlen(foo) );
|
||||||
|
|
Loading…
Reference in a new issue