1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-03 04:23:42 -05:00

Auto-switch when only one match is made.

This commit is contained in:
QC 2013-02-03 20:28:12 +01:00
parent b9aecca0bc
commit 3ef6f83f32

View file

@ -734,7 +734,12 @@ int menu(char **lines, char **input, char *prompt, int selected, Time *time)
else
// Down or Tab
if (key == XK_Down || key == XK_Tab) {
if (key == XK_Down || key == XK_Tab)
{
if(filtered_lines == 1) {
chosen = 1;
break;
}
int length_prefix = calculate_common_prefix(filtered, max_lines);
printf("Prefix: %s:%d\n", filtered[0], length_prefix);
if(length_prefix) {
@ -744,9 +749,9 @@ int menu(char **lines, char **input, char *prompt, int selected, Time *time)
textbox_text(text, str);
textbox_cursor_end(text);
free(str);
} else {
selected = selected < filtered_lines-1 ? MIN(filtered_lines-1, selected+1): 0;
}
else
selected = selected < filtered_lines-1 ? MIN(filtered_lines-1, selected+1): 0;
}
}
menu_draw(text, boxes, max_lines, selected, filtered);