diff options
author | axel <axel@liljencrantz.se> | 2005-10-25 21:03:52 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2005-10-25 21:03:52 +1000 |
commit | ddcb84aa07607bbd274edb89ddc4371d8d7aa27f (patch) | |
tree | 018e34432ab3bc2da81e63765405fc1c1ed210dc /reader.c | |
parent | d33229324517aff751901d83aa66c6f24eba0bdc (diff) |
Fix problem bug breaking completion in commands with multiple subshells
darcs-hash:20051025110352-ac50b-fff319ddcbafb722b9bc3c61aa1b250b290716a5.gz
Diffstat (limited to 'reader.c')
-rw-r--r-- | reader.c | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -1548,9 +1548,9 @@ void reader_sanity_check() void reader_current_subshell_extent( wchar_t **a, wchar_t **b ) { - wchar_t *buffcpy = wcsdup( data->buff ); wchar_t *begin, *end; - + wchar_t *pos; + if( a ) *a=0; if( b ) @@ -1559,35 +1559,41 @@ void reader_current_subshell_extent( wchar_t **a, wchar_t **b ) if( !data ) return; + pos = data->buff; + while( 1 ) { int bc, ec; - - if( expand_locate_subshell( buffcpy, + + if( expand_locate_subshell( pos, &begin, &end, 1 ) <= 0) { - begin=buffcpy; - end = buffcpy + wcslen(data->buff); + begin=data->buff; + end = data->buff + wcslen(data->buff); break; } - bc = begin-buffcpy; - ec = end-buffcpy; + + if( !end ) + { + end = data->buff + wcslen(data->buff); + } + + bc = begin-data->buff; + ec = end-data->buff; + if(( bc < data->buff_pos ) && (ec >= data->buff_pos) ) { begin++; - - //fwprintf( stderr, L"Subshell!\n" ); break; } - *begin=0; + pos = end+1; } if( a ) - *a = data->buff + (begin-buffcpy); + *a = begin; if( b ) - *b = data->buff + (end-buffcpy); - free( buffcpy ); + *b = end; } static void reader_current_job_or_process_extent( wchar_t **a, |