From 51d7159ba766ef5cfa9b606e98b57fc03c6ba7f8 Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 13 Aug 2006 11:46:02 +1000 Subject: [PATCH] Update fish_pager interface, first try - this is the second patch to redo the fish_pager interface. Both this one and the previous one breaks the display of completions darcs-hash:20060813014602-ac50b-3d30e3486021b1ffddf3f1a69e86ee51a6aac611.gz --- reader.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/reader.c b/reader.c index 69abbd2ab..388d9b284 100644 --- a/reader.c +++ b/reader.c @@ -1462,7 +1462,9 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp ) { int i; string_buffer_t cmd; + string_buffer_t msg; wchar_t * prefix_esc; + char *foo; if( !prefix || (wcslen(prefix)==0)) prefix_esc = wcsdup(L"\"\""); @@ -1470,6 +1472,7 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp ) prefix_esc = escape( prefix,1); sb_init( &cmd ); + sb_init( &msg ); sb_printf( &cmd, L"fish_pager %d %ls", // L"valgrind --track-fds=yes --log-file=pager.txt --leak-check=full ./fish_pager %d %ls", @@ -1478,24 +1481,32 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp ) free( prefix_esc ); + io_data_t *in= io_buffer_create( 1 ); + for( i=0; iparam2.out_buffer, foo, strlen(foo) ); + free( foo ); + term_donate(); - - io_data_t *out = io_buffer_create(); - + + io_data_t *out = io_buffer_create( 0 ); + out->next = in; + out->fd = 1; + eval( (wchar_t *)cmd.buff, out, TOP); term_steal(); io_buffer_read( out ); sb_destroy( &cmd ); - + sb_destroy( &msg ); int nil=0; b_append( out->param2.out_buffer, &nil, 1 ); @@ -1512,7 +1523,9 @@ static void run_pager( wchar_t *prefix, int is_quoted, array_list_t *comp ) free( str ); } + io_buffer_destroy( out); + io_buffer_destroy( in); }