summaryrefslogtreecommitdiffstats
path: root/source/view.c
diff options
context:
space:
mode:
authorDave Davenport <DaveDavenport@users.noreply.github.com>2018-06-13 11:57:23 +0200
committerGitHub <noreply@github.com>2018-06-13 11:57:23 +0200
commitbdb6abef4a2b3cd3c02443038f43af74fd1bc987 (patch)
tree87bdccfad5df3647003c9b10cf094b0fe9293ddb /source/view.c
parent9909fb3d7108c2cea200848d3e2a766f46be2f3b (diff)
Sorting cleanup (#816)
* Add `-sorting-method` option remove weird -sort-levenshtein. * Fix test for updated cmdline options. * Update manpage
Diffstat (limited to 'source/view.c')
-rw-r--r--source/view.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/view.c b/source/view.c
index 0a67893a..1d8bcdcf 100644
--- a/source/view.c
+++ b/source/view.c
@@ -607,11 +607,15 @@ static void filter_elements ( thread_state *ts, G_GNUC_UNUSED gpointer user_data
// This is inefficient, need to fix it.
char * str = mode_get_completion ( t->state->sw, i );
glong slen = g_utf8_strlen ( str, -1 );
- if ( config.levenshtein_sort || config.matching_method != MM_FUZZY ) {
- t->state->distance[i] = levenshtein ( t->pattern, t->plen, str, slen );
- }
- else {
- t->state->distance[i] = rofi_scorer_fuzzy_evaluate ( t->pattern, t->plen, str, slen );
+ switch ( config.sorting_method_enum )
+ {
+ case SORT_FZF:
+ t->state->distance[i] = rofi_scorer_fuzzy_evaluate ( t->pattern, t->plen, str, slen );
+ break;
+ case SORT_NORMAL:
+ default:
+ t->state->distance[i] = levenshtein ( t->pattern, t->plen, str, slen );
+ break;
}
g_free ( str );
}