From 1e524fbc7a956ee94c1a75165f27dc72d7818fcd Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 18 Mar 2007 09:16:23 +1000 Subject: [PATCH] Fix occasional shoowing of the same completion twice. Than ks to Tassilo Horn for the bug report. darcs-hash:20070317231623-ac50b-a9447aa60d0ca654713a5391a3f6137d29d98916.gz --- reader.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/reader.c b/reader.c index 8d8fda9f9..bfa51a3a7 100644 --- a/reader.c +++ b/reader.c @@ -498,19 +498,23 @@ static void remove_duplicates( array_list_t *l ) { int in, out; const wchar_t *prev; + completion_t *first; + if( al_get_count( l ) == 0 ) return; - - prev = (wchar_t *)al_get( l, 0 ); + + first = (completion_t *)al_get( l, 0 ); + prev = first->completion; + for( in=1, out=1; in < al_get_count( l ); in++ ) { completion_t *curr = (completion_t *)al_get( l, in ); - + if( wcscmp( prev, curr->completion )!=0 ) { al_set( l, out++, curr ); - prev = curr->completion; } + prev = curr->completion; } al_truncate( l, out ); }