1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Indent don't use partial match.

This commit is contained in:
Dave Davenport 2016-06-16 22:23:55 +02:00
parent 57336b96f0
commit 7a2435a23b
5 changed files with 39 additions and 35 deletions

View file

@ -163,7 +163,7 @@ static gchar *glob_to_regex ( const char *input )
}
static GRegex * create_regex ( const char *input, int case_sensitive )
{
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), G_REGEX_MATCH_PARTIAL, NULL )
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
GRegex *retv = NULL;
if ( config.glob ) {
gchar *r = glob_to_regex ( input );
@ -196,7 +196,11 @@ static GRegex * create_regex ( const char *input, int case_sensitive )
}
GRegex **tokenize ( const char *input, int case_sensitive )
{
if ( input == NULL || strlen ( input ) == 0 ) {
if ( input == NULL ) {
return NULL;
}
size_t len = strlen ( input );
if ( len == 0 ) {
return NULL;
}
@ -365,7 +369,7 @@ int token_match ( GRegex **tokens, const char *input )
// Do a tokenized match.
if ( tokens ) {
for ( int j = 0; match && tokens[j]; j++ ) {
match = g_regex_match ( (GRegex *) tokens[j], input, G_REGEX_MATCH_PARTIAL, NULL );
match = g_regex_match ( (GRegex *) tokens[j], input, 0, NULL );
}
}
return match;

View file

@ -76,7 +76,7 @@ struct xkb_stuff xkb = {
.compose = {
.table = NULL,
.state = NULL
}
}
};
char *config_path = NULL;
// Array of modi.

View file

@ -499,7 +499,7 @@ static void filter_elements ( thread_state *t, G_GNUC_UNUSED gpointer user_data
char * str = mode_get_completion ( t->state->sw, i );
char * input = mode_preprocess_input ( t->state->sw, t->state->text->text );
t->state->distance[i] = levenshtein ( input, str );
g_free(input);
g_free ( input );
g_free ( str );
}
t->count++;
@ -928,7 +928,7 @@ static void rofi_view_draw ( RofiViewState *state, cairo_t *d )
if ( state->rchanged ) {
char *input = mode_preprocess_input ( state->sw, state->text->text );
GRegex **tokens = tokenize ( input, config.case_sensitive );
g_free(input);
g_free ( input );
// Move, resize visible boxes and show them.
for ( i = 0; i < max_elements && ( i + offset ) < state->filtered_lines; i++ ) {
unsigned int ex = ( ( i ) / state->max_rows ) * ( element_width + config.line_margin );