summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMoritz Maxeiner <moritz@ucworks.org>2017-01-26 19:46:46 +0100
committerDave Davenport <DaveDavenport@users.noreply.github.com>2017-01-26 19:46:46 +0100
commit6b9dc1d0819fbde20b35c8ab20592f57a445611c (patch)
tree7dbcbcfb331dbe4d0c43f8cfdbc5365f977b2156 /include
parent9941efa5f411348585a63efdacb1be382ab065ee (diff)
Combi mode: Bang mode prefixes with len>1 (#542)
* Combi mode: Bang mode prefixes with len>1 This is required to match on modes that share a prefix. Let 'power' and 'pass' be such modes for the following explanation: Previously, only the first character of after the bang was compared, so '!p' would always be matched to the 'pass' mode and there was no way to limit selection in combi mode to the 'power' mode. Now we can use prefixes of arbitrary length following the bang such as '!po' (matches 'power' mode), or '!pa' (matches 'pass' mode). Prefixes of length 1 are unchanged compared to the previous behaviour, i.e. '!p' will still match 'pass'. * Combi-mode prefixes should be utf-8 aware
Diffstat (limited to 'include')
-rw-r--r--include/helper.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/helper.h b/include/helper.h
index 5f530dbf..a74a162e 100644
--- a/include/helper.h
+++ b/include/helper.h
@@ -221,4 +221,17 @@ PangoAttrList *token_match_get_pango_attr ( ThemeHighlight th, GRegex **tokens,
*/
int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *str, glong slen );
/*@}*/
+
+/**
+ * @param a UTF-8 string to compare
+ * @param b UTF-8 string to compare
+ * @param n Maximum number of characters to compare
+ *
+ * Compares the `G_NORMALIZE_ALL_COMPOSE` forms of the two strings.
+ *
+ * @returns less than, equal to, or greater than zero if the first `n` characters (not bytes) of `a`
+ * are found, respectively, to be less than, to match, or be greater than the first `n`
+ * characters (not bytes) of `b`.
+ */
+int utf8_strncmp ( const char *a, const char* b, size_t n );
#endif // ROFI_HELPER_H