mirror of
https://github.com/davatorium/rofi.git
synced 2025-03-17 17:14:42 -04:00
Cleanup previous test commit.
This commit is contained in:
parent
d02f43966e
commit
5ddcac2514
6 changed files with 14 additions and 13 deletions
|
@ -80,7 +80,7 @@ typedef int ( *menu_match_cb )( char **tokens, const char *input, int index, voi
|
|||
MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prompt,
|
||||
Time *time, int *shift,
|
||||
menu_match_cb mmc, void *mmc_data,
|
||||
int *selected_line ) __attribute__ ( ( nonnull ( 1, 3, 4, 9 ) ) );
|
||||
int *selected_line, int sorting ) __attribute__ ( ( nonnull ( 1, 3, 4, 9 ) ) );
|
||||
|
||||
void catch_exit ( __attribute__( ( unused ) ) int sig );
|
||||
|
||||
|
|
|
@ -73,13 +73,10 @@ 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,
|
||||
token_match, NULL, &selected_line );
|
||||
token_match, NULL, &selected_line, FALSE );
|
||||
|
||||
// We normally do not want to restart the loop.
|
||||
restart = FALSE;
|
||||
|
|
|
@ -1061,7 +1061,7 @@ static void calculate_window_position ( const workarea *mon, int *x, int *y, int
|
|||
}
|
||||
|
||||
MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prompt, Time *time,
|
||||
int *shift, menu_match_cb mmc, void *mmc_data, int *selected_line )
|
||||
int *shift, menu_match_cb mmc, void *mmc_data, int *selected_line , int sorting)
|
||||
{
|
||||
int retv = MENU_CANCEL;
|
||||
unsigned int i, j;
|
||||
|
@ -1184,7 +1184,7 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
|
|||
char **filtered = calloc ( num_lines, sizeof ( char* ) );
|
||||
int *line_map = calloc ( num_lines, sizeof ( int ) );
|
||||
int *distance = NULL;
|
||||
if ( config.levenshtein_sort ) {
|
||||
if ( sorting ) {
|
||||
distance = calloc ( num_lines, sizeof ( int ) );
|
||||
}
|
||||
unsigned int filtered_lines = 0;
|
||||
|
@ -1231,10 +1231,11 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
|
|||
// If each token was matched, add it to list.
|
||||
if ( match ) {
|
||||
line_map[j] = i;
|
||||
if ( config.levenshtein_sort ) {
|
||||
if ( sorting ) {
|
||||
distance[i] = levenshtein ( text->text, lines[i] );
|
||||
}
|
||||
// Try to look-up the selected line and highlight that.
|
||||
// This is needed 'hack' to fix the dmenu 'next row' modi.
|
||||
if(init == 0 && selected_line != NULL && (*selected_line) == i) {
|
||||
selected = j;
|
||||
init = 1;
|
||||
|
@ -1242,7 +1243,7 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
|
|||
j++;
|
||||
}
|
||||
}
|
||||
if ( config.levenshtein_sort ) {
|
||||
if ( sorting ) {
|
||||
qsort_r ( line_map, j, sizeof ( int ), lev_sort, distance );
|
||||
}
|
||||
// Update the filtered list.
|
||||
|
@ -1675,7 +1676,8 @@ SwitcherMode run_switcher_window ( char **input, void *data )
|
|||
}
|
||||
Time time;
|
||||
int selected_line = 0;
|
||||
MenuReturn mretv = menu ( list, lines, input, "window:", &time, NULL, window_match, ids, &selected_line );
|
||||
MenuReturn mretv = menu ( list, lines, input, "window:", &time, NULL,
|
||||
window_match, ids, &selected_line, config.levenshtein_sort );
|
||||
|
||||
if ( mretv == MENU_NEXT ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -213,7 +213,8 @@ SwitcherMode run_switcher_dialog ( char **input, void *data )
|
|||
cmd_list[1] = NULL;
|
||||
}
|
||||
|
||||
int mretv = menu ( cmd_list, cmd_list_length, input, "run:", NULL, &shift, token_match, NULL, &selected_line );
|
||||
int mretv = menu ( cmd_list, cmd_list_length, input, "run:",
|
||||
NULL, &shift, token_match, NULL, &selected_line, config.levenshtein_sort );
|
||||
|
||||
if ( mretv == MENU_NEXT ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -134,7 +134,7 @@ SwitcherMode script_switcher_dialog ( char **input, void *data )
|
|||
unsigned int new_length = 0;
|
||||
char **new_list = NULL;
|
||||
int mretv = menu ( list, length, input, prompt, NULL, NULL,
|
||||
token_match, NULL, &selected_line );
|
||||
token_match, NULL, &selected_line , FALSE);
|
||||
|
||||
if ( mretv == MENU_NEXT ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -230,7 +230,8 @@ SwitcherMode ssh_switcher_dialog ( char **input, void *data )
|
|||
|
||||
int shift = 0;
|
||||
int selected_line = 0;
|
||||
int mretv = menu ( cmd_list, cmd_list_length, input, "ssh:", NULL, &shift, token_match, NULL, &selected_line );
|
||||
int mretv = menu ( cmd_list, cmd_list_length, input, "ssh:",
|
||||
NULL, &shift, token_match, NULL, &selected_line, config.levenshtein_sort );
|
||||
|
||||
if ( mretv == MENU_NEXT ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
Loading…
Add table
Reference in a new issue