summaryrefslogtreecommitdiffstats
path: root/source/view.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-05-26 08:39:33 +0200
committerDave Davenport <qball@gmpclient.org>2016-05-26 08:39:33 +0200
commit0e86050db8d3e20a93fada37724d9c8d59386c55 (patch)
tree835d1e58c9652b8d708a17074c6c922c74f60025 /source/view.c
parent7aff2ae243f4d15875a5a6d567112400a727e642 (diff)
Fix combi mode 'bang' behaviour, improve levenshtein with combi
Diffstat (limited to 'source/view.c')
-rw-r--r--source/view.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/view.c b/source/view.c
index 8473d859..6a565aab 100644
--- a/source/view.c
+++ b/source/view.c
@@ -464,7 +464,7 @@ static RofiViewState * __rofi_view_state_create ( void )
typedef struct _thread_state
{
RofiViewState *state;
- GRegex **tokens;
+ GRegex **tokens;
unsigned int start;
unsigned int stop;
unsigned int count;
@@ -500,7 +500,9 @@ static void filter_elements ( thread_state *t, G_GNUC_UNUSED gpointer user_data
if ( config.levenshtein_sort ) {
// This is inefficient, need to fix it.
char * str = mode_get_completion ( t->state->sw, i );
- t->state->distance[i] = levenshtein ( t->state->text->text, str );
+ char * input = mode_preprocess_input ( t->state->sw, t->state->text->text );
+ t->state->distance[i] = levenshtein ( input, str );
+ g_free(input);
g_free ( str );
}
t->count++;
@@ -925,7 +927,9 @@ static void rofi_view_draw ( RofiViewState *state, cairo_t *d )
int x_offset = state->border;
if ( state->rchanged ) {
- GRegex **tokens = tokenize ( state->text->text, config.case_sensitive );
+ char *input = mode_preprocess_input ( state->sw, state->text->text );
+ GRegex **tokens = tokenize ( input, config.case_sensitive );
+ 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 );
@@ -1248,7 +1252,9 @@ static void rofi_view_refilter ( RofiViewState *state )
TICK_N ( "Filter start" );
if ( strlen ( state->text->text ) > 0 ) {
unsigned int j = 0;
- GRegex **tokens = tokenize ( state->text->text, config.case_sensitive );
+ gchar *input = mode_preprocess_input ( state->sw, state->text->text );
+ GRegex **tokens = tokenize ( input, config.case_sensitive );
+ g_free ( input );
/**
* On long lists it can be beneficial to parallelize.
* If number of threads is 1, no thread is spawn.
@@ -1632,7 +1638,7 @@ RofiViewState *rofi_view_create ( Mode *sw,
state->finalize = finalize;
// Request the lines to show.
- state->num_lines = mode_get_num_entries ( sw );
+ state->num_lines = mode_get_num_entries ( sw );
TICK_N ( "Startup notification" );