diff options
author | axel <axel@liljencrantz.se> | 2005-12-13 04:30:55 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2005-12-13 04:30:55 +1000 |
commit | 9c32709fe1c48b30ca49150b955fb756d11ece44 (patch) | |
tree | bab9b1f0ed7cdeac2e9df0201a55f3e8b10a81f2 /reader.c | |
parent | 00bdd2cb484e9aa72c557d6d4b9968b79815cb99 (diff) |
Fix infinite loop in token search
darcs-hash:20051212183055-ac50b-a40c21f801978094e4ae5b3f6f5d84276eb956e7.gz
Diffstat (limited to 'reader.c')
-rw-r--r-- | reader.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1889,6 +1889,7 @@ static void handle_token_history( int forward, int reset ) } + current_pos = data->token_history_pos; if( forward || data->search_pos < (al_get_count( &data->search_prev )-1) ) @@ -1930,6 +1931,7 @@ static void handle_token_history( int forward, int reset ) history already contains the search string itself, if so return, otherwise add it. */ + const wchar_t *last = al_get( &data->search_prev, al_get_count( &data->search_prev ) -1 ); if( wcscmp( last, data->search_buff ) ) { @@ -1942,6 +1944,9 @@ static void handle_token_history( int forward, int reset ) } else { + + debug( 3, L"new '%ls'", data->token_history_buff ); + for( tok_init( &tok, data->token_history_buff, TOK_ACCEPT_UNFINISHED ); tok_has_next( &tok); tok_next( &tok )) @@ -1952,11 +1957,12 @@ static void handle_token_history( int forward, int reset ) { if( wcsstr( tok_last( &tok ), data->search_buff ) ) { -// fwprintf( stderr, L"Found token at pos %d\n", tok_get_pos( &tok ) ); + debug( 3, L"Found token at pos %d\n", tok_get_pos( &tok ) ); if( tok_get_pos( &tok ) >= current_pos ) { break; } + debug( 3, L"ok pos" ); if( !contains( tok_last( &tok ), &data->search_prev ) ) { |