Mercurial > mplayer.hg
changeset 35847:25af0fce844f
Keep GUI history entries in order.
Currently, if an entry is to be added to the GUI history and this entry
is already existing, it is swapped with the top entry. This breaks
history sequence and is confusing.
Move this entry to the top while leaving the other ones in their order.
Patch by Hans-Dieter Kosch, hdkosch kabelbw de.
author | ib |
---|---|
date | Sun, 10 Mar 2013 14:25:02 +0000 |
parents | 1994a2fd15f4 |
children | 19863172756d |
files | gui/dialog/fileselect.c |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/dialog/fileselect.c Sun Mar 10 12:46:45 2013 +0000 +++ b/gui/dialog/fileselect.c Sun Mar 10 14:25:02 2013 +0000 @@ -386,18 +386,24 @@ static void fs_PersistantHistory( char * subject ) { unsigned int i; + char * entry; if ( fsType != fsVideoSelector ) return; for ( i=0;i < FF_ARRAY_ELEMS(fsHistory);i++ ) if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) ) { - char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp; - return; + entry=fsHistory[i]; + break; } - nfree( fsHistory[FF_ARRAY_ELEMS(fsHistory) - 1] ); - for ( i=FF_ARRAY_ELEMS(fsHistory) - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1]; - fsHistory[0]=gstrdup( subject ); + if ( i >= FF_ARRAY_ELEMS(fsHistory) ) + { + i=FF_ARRAY_ELEMS(fsHistory)-1; + nfree( fsHistory[i] ); + entry=gstrdup( subject ); + } + for ( ;i;i-- ) fsHistory[i]=fsHistory[i - 1]; + fsHistory[0]=entry; } /* ----------------------------------------------- */