Test to see if this fixes issue from Rafi.

This commit is contained in:
QC 2014-08-03 16:44:14 +02:00
parent 5a8a249fa6
commit d02f43966e
2 changed files with 9 additions and 0 deletions

View File

@ -73,6 +73,9 @@ SwitcherMode dmenu_switcher_dialog ( char **input, void *data )
char **list = get_dmenu ( &length );
int restart = FALSE;
// Force off sorting. (TODO: should be an argument to menu, and not hacking the user config.)
config.levenshtein_sort = FALSE;
do {
int shift = 0;
int mretv = menu ( list, length, input, dmenu_prompt, NULL, &shift,

View File

@ -1211,6 +1211,7 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
KeySym prev_key = 0;
unsigned int selected = 0;
int last_offset = 0;
int init = 0;
if ( selected_line != NULL ) {
if ( *selected_line >= 0 && *selected_line <= num_lines ) {
selected = *selected_line;
@ -1233,6 +1234,11 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
if ( config.levenshtein_sort ) {
distance[i] = levenshtein ( text->text, lines[i] );
}
// Try to look-up the selected line and highlight that.
if(init == 0 && selected_line != NULL && (*selected_line) == i) {
selected = j;
init = 1;
}
j++;
}
}