Add an option to change the matching negation character.

Fixes: #877
This commit is contained in:
Dave Davenport 2018-12-14 16:58:26 +01:00
parent 30e500450d
commit 6b96ae123b
5 changed files with 9 additions and 1 deletions

View File

@ -152,4 +152,6 @@ Settings config = {
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
.combi_hide_mode_prefix = FALSE,
.matching_negate_char = '-',
};

View File

@ -118,6 +118,8 @@ rofi.scroll-method: 0
! rofi.max-history-size: 25
! "Hide the prefix mode prefix on the combi view." Set from: Default
! rofi.combi-hide-mode-prefix: false
! "Set the character used to negate the matching. ('\0' to disable)" Set from: Default
! rofi.matching-negate-char: -
! "Pidfile location" Set from: File
rofi.pid: /tmp/rofi.pid
! "Paste primary selection" Set from: File

View File

@ -177,6 +177,8 @@ typedef struct
/** Maximum history length per mode. */
unsigned int max_history_size;
gboolean combi_hide_mode_prefix;
char matching_negate_char;
} Settings;
/** Global Settings structure. */
extern Settings config;

View File

@ -221,7 +221,7 @@ static rofi_int_matcher * create_regex ( const char *input, int case_sensitive )
GRegex * retv = NULL;
gchar *r;
rofi_int_matcher *rv = g_malloc0 ( sizeof ( rofi_int_matcher ) );
if ( input && input[0] == '-' ) {
if ( input && input[0] == config.matching_negate_char ) {
rv->invert = 1;
input++;
}

View File

@ -214,6 +214,8 @@ static XrmOption xrmOptions[] = {
"Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
{ xrm_Boolean, "combi-hide-mode-prefix", { .snum = &config.combi_hide_mode_prefix }, NULL,
"Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT },
{ xrm_Char, "matching-negate-char", { .charc= &config.matching_negate_char }, NULL,
"Set the character used to negate the matching. ('\\0' to disable)", CONFIG_DEFAULT },
};
/** Dynamic array of extra options */