Use right modifier

This commit is contained in:
QC 2015-07-09 20:44:12 +02:00
parent c4df969432
commit d549659f1e
2 changed files with 12 additions and 2 deletions

View File

@ -57,7 +57,7 @@ void i3_support_focus_window ( Window id )
char command[upm];
if ( strlen ( i3_socket_path ) > upm ) {
fprintf ( stderr, "Socket path is too long. %zd > %lu\n", strlen ( i3_socket_path ), upm );
fprintf ( stderr, "Socket path is too long. %zd > %zd\n", strlen ( i3_socket_path ), upm );
return;
}

View File

@ -727,7 +727,17 @@ static void menu_refilter ( MenuState *state, char **lines, menu_match_cb mmc, v
if ( match ) {
state->line_map[j] = i;
if ( sorting ) {
state->distance[i] = levenshtein ( state->text->text, lines[i] );
state->distance[i] = 0;
char **words = tokenize ( lines[i], case_sensitive );
for( int k = 0; tokens && tokens[k]; k++) {
for ( int j = 0; words && words[j]; j++) {
if (strcasecmp ( tokens[k], words[j] ) != 0)
state->distance[i] += levenshtein ( tokens[k], words[j] ) * strlen(tokens[k]);
else
state->distance[i] -= strlen (tokens[k]) << 1;
}
}
g_strfreev ( words );
}
j++;
}