diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-09-29 08:32:09 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-09-29 08:40:25 +0200 |
commit | ebffe5503d1709f00d4d7d85f0db4f8fe1dc4f42 (patch) | |
tree | c35dca4f2e9abeb271eeca3560b2ef83d3ff2831 /include | |
parent | a1ea3e268f92e9edcce6a794d98929effb036675 (diff) |
Implement support for specifying negated match
- Prepending - inverts the matching result.
- Fix logic window/drun browser.
- Breaks API as argument token_match callback changed.
- Update tests.
Fixes: #665
Diffstat (limited to 'include')
-rw-r--r-- | include/helper-theme.h | 2 | ||||
-rw-r--r-- | include/helper.h | 6 | ||||
-rw-r--r-- | include/mode-private.h | 4 | ||||
-rw-r--r-- | include/mode.h | 3 | ||||
-rw-r--r-- | include/rofi-types.h | 10 | ||||
-rw-r--r-- | include/view-internal.h | 2 |
6 files changed, 19 insertions, 8 deletions
diff --git a/include/helper-theme.h b/include/helper-theme.h index b2ed659b..451320df 100644 --- a/include/helper-theme.h +++ b/include/helper-theme.h @@ -43,7 +43,7 @@ * * @returns the updated retv list. */ -PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, GRegex **tokens, const char *input, PangoAttrList *retv ); +PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, rofi_int_matcher **tokens, const char *input, PangoAttrList *retv ); /** * @param pfd Pango font description to validate. diff --git a/include/helper.h b/include/helper.h index a120ebab..b761e647 100644 --- a/include/helper.h +++ b/include/helper.h @@ -61,14 +61,14 @@ int helper_parse_setup ( char * string, char ***output, int *length, ... ); * * @returns a newly allocated array of regex objest */ -GRegex **tokenize ( const char *input, int case_sensitive ); +rofi_int_matcher **tokenize ( const char *input, int case_sensitive ); /** * @param tokens Array of regex objects * * Frees the array of regex expressions. */ -void tokenize_free ( GRegex ** tokens ); +void tokenize_free ( rofi_int_matcher ** tokens ); /** * @param key The key to search for @@ -136,7 +136,7 @@ int find_arg ( const char * const key ); * * @returns TRUE when matches, FALSE otherwise */ -int helper_token_match ( GRegex * const *tokens, const char *input ); +int helper_token_match ( rofi_int_matcher * const *tokens, const char *input ); /** * @param cmd The command to execute. * diff --git a/include/mode-private.h b/include/mode-private.h index 14021183..a106c0bc 100644 --- a/include/mode-private.h +++ b/include/mode-private.h @@ -31,7 +31,7 @@ #include <gmodule.h> /** ABI version to check if loaded plugin is compatible. */ -#define ABI_VERSION 0x00000005 +#define ABI_VERSION 0x00000006 /** * @param data Pointer to #Mode object. @@ -84,7 +84,7 @@ typedef char * ( *_mode_get_completion )( const Mode *sw, unsigned int selected_ * * @returns 1 when it matches, 0 if not. */ -typedef int ( *_mode_token_match )( const Mode *data, GRegex **tokens, unsigned int index ); +typedef int ( *_mode_token_match )( const Mode *data, rofi_int_matcher **tokens, unsigned int index ); /** * @param sw The #Mode pointer diff --git a/include/mode.h b/include/mode.h index 9b013ef3..d4acead9 100644 --- a/include/mode.h +++ b/include/mode.h @@ -29,6 +29,7 @@ #define ROFI_MODE_H #include <cairo.h> +#include <rofi-types.h> /** * @defgroup MODE Mode * @@ -164,7 +165,7 @@ ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int sel * * @returns TRUE if matches */ -int mode_token_match ( const Mode *mode, GRegex **tokens, unsigned int selected_line ); +int mode_token_match ( const Mode *mode, rofi_int_matcher **tokens, unsigned int selected_line ); /** * @param mode The mode to query diff --git a/include/rofi-types.h b/include/rofi-types.h index d9bae009..11255218 100644 --- a/include/rofi-types.h +++ b/include/rofi-types.h @@ -225,4 +225,14 @@ typedef struct rofi_range_pair unsigned int start; unsigned int stop; } rofi_range_pair; + + +/** + * Internal structure for matching. + */ +typedef struct rofi_int_matcher_t { + GRegex *regex; + gboolean invert; +} rofi_int_matcher; + #endif // INCLUDE_ROFI_TYPES_H diff --git a/include/view-internal.h b/include/view-internal.h index 23d3ea71..ded7f9a6 100644 --- a/include/view-internal.h +++ b/include/view-internal.h @@ -126,7 +126,7 @@ struct RofiViewState } mouse; /** Regexs used for matching */ - GRegex **tokens; + rofi_int_matcher **tokens; }; /** @} */ #endif |