From 480a29594e62cd11c2c19abb42008472fcd9fa10 Mon Sep 17 00:00:00 2001 From: axel Date: Tue, 22 Aug 2006 23:58:15 +1000 Subject: [PATCH] Minor tweaks to previous fish_pager patch to fix two bugs darcs-hash:20060822135815-ac50b-35d9f643385ec29f9d8f93ca83d01e060de93cc7.gz --- complete.h | 11 ----------- exec.c | 2 -- fish_pager.c | 28 ++++++++++++++++------------ reader.c | 5 +++-- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/complete.h b/complete.h index 5abd44530..ebae4a1d9 100644 --- a/complete.h +++ b/complete.h @@ -53,17 +53,6 @@ */ #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 completion grouping, e.g. when putting completions with the same diff --git a/exec.c b/exec.c index eac0e11ce..25f8ead63 100644 --- a/exec.c +++ b/exec.c @@ -1055,8 +1055,6 @@ void exec( job_t *j ) case INTERNAL_BUFFER: { - debug( 0, L"fork internal buffer" ); - pid = fork(); if( pid == 0 ) diff --git a/fish_pager.c b/fish_pager.c index 291a16eb5..f5a1ce3d3 100644 --- a/fish_pager.c +++ b/fish_pager.c @@ -990,9 +990,9 @@ void destroy() void read_array( FILE* file, array_list_t *comp ) { char buffer[BUFSIZE]; - char c; + int c; int i; - wchar_t *wcs; + wchar_t *wcs, *unescaped; while( !feof( file ) ) { @@ -1000,24 +1000,28 @@ void read_array( FILE* file, array_list_t *comp ) while( i < BUFSIZE-1 ) { c = getc( file ); - if( c == '\n' || c == PAGER_EOT ) + if( c == EOF ) { - break; + return; + + } + if( c == '\n' ) + { + break; } buffer[ i++ ] = c; } + buffer[ i ] = '\0'; wcs = str2wcs( buffer ); if( wcs ) - { - al_push( comp, wcs ); - } - if( c == PAGER_EOT ) - { - break; - } + { + unescaped = unescape( wcs, 0 ); + al_push( comp, unescaped ); + free( wcs ); + } } } @@ -1042,7 +1046,7 @@ int main( int argc, char **argv ) debug( 3, L"prefix is '%ls'", prefix ); if( argc > 3 ) - { + { for( i=3; iparam2.out_buffer, foo, strlen(foo) );