summaryrefslogtreecommitdiffstats
path: root/include/rofi.h
diff options
context:
space:
mode:
authorTom Hinton <tom.hinton@cse.org.uk>2015-10-01 12:16:41 +0100
committerTom Hinton <tom.hinton@cse.org.uk>2015-10-01 12:16:41 +0100
commitaf6a4b83ebdb83f24b6913b372e207bcf245ea0c (patch)
treef55afd8e2ccadb7829900d9d14eebc78e48a3b53 /include/rofi.h
parent574bf2da828b4e3ab0ce3ce7fccd58879db60430 (diff)
Make normal filtering of plain ASCII lines faster
This patch adds a field lines_not_ascii to the MenuState structure. The nth entry is 0 unless the nth member of MenuState.lines has a non-ascii codepoint in it. All comparison functions (menu_match_cb type) take an additional argument to tell them if the thing they are matching is not_ascii. They can use this to determine whether to collate and case-fold the input (for non-ascii strings), or whether to use strstr/strcasestr (for ascii strings). The change is not currently implemented for flex matching, due to my laziness. However, it should be a simple enough matter to add. For my large input of 400,000 lines, this reduces typical filtering time to about ten microseconds from about 2 seconds.
Diffstat (limited to 'include/rofi.h')
-rw-r--r--include/rofi.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/rofi.h b/include/rofi.h
index bf7ee333..1aff2350 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -78,7 +78,7 @@ typedef enum
*
* @returns 1 when it matches, 0 if not.
*/
-typedef int ( *menu_match_cb )( char **tokens, const char *input, int case_sensitive, unsigned int index, Switcher *data );
+typedef int ( *menu_match_cb )( char **tokens, const char *input, int not_ascii, int case_sensitive, unsigned int index, Switcher *data );
/**
* @param sw the Switcher to show.