summaryrefslogtreecommitdiffstats
path: root/source/dialogs/combi.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2015-11-24 14:14:55 +0100
committerDave Davenport <qball@gmpclient.org>2015-11-24 14:14:55 +0100
commit6978b146f014ad8339b89dceeb990be2f148c35e (patch)
treeff670e48517941c8ba20a595ff1b0c443b185da4 /source/dialogs/combi.c
parentfa2bcd778c9840f660c28f007c1bd1456a8a7eb7 (diff)
[Combi] only textual map, when not using glob/regex mode.
Diffstat (limited to 'source/dialogs/combi.c')
-rw-r--r--source/dialogs/combi.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c
index 35e0f9ab..7c72aab4 100644
--- a/source/dialogs/combi.c
+++ b/source/dialogs/combi.c
@@ -174,22 +174,32 @@ static int combi_mode_match ( const Switcher *sw, char **tokens, int not_ascii,
int case_sensitive, unsigned int index )
{
CombiModePrivateData *pd = sw->private_data;
-
- for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
- if ( index >= pd->starts[i] && index < ( pd->starts[i] + pd->lengths[i] ) ) {
- if ( tokens && tokens[0][0] == '!' ) {
- if ( tokens[0][1] == pd->switchers[i]->name[0] ) {
- return pd->switchers[i]->token_match ( pd->switchers[i], &tokens[1], not_ascii, case_sensitive,
- index - pd->starts[i] );
- }
- return 0;
- }
- else {
+ if ( config.regex || config.glob ) {
+ // Bang support only works in text mode.
+ for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
+ if ( index >= pd->starts[i] && index < ( pd->starts[i] + pd->lengths[i] ) ) {
return pd->switchers[i]->token_match ( pd->switchers[i], tokens, not_ascii, case_sensitive,
index - pd->starts[i] );
}
}
}
+ else{
+ for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
+ if ( index >= pd->starts[i] && index < ( pd->starts[i] + pd->lengths[i] ) ) {
+ if ( tokens && tokens[0][0] == '!' ) {
+ if ( tokens[0][1] == pd->switchers[i]->name[0] ) {
+ return pd->switchers[i]->token_match ( pd->switchers[i], &tokens[1], not_ascii, case_sensitive,
+ index - pd->starts[i] );
+ }
+ return 0;
+ }
+ else {
+ return pd->switchers[i]->token_match ( pd->switchers[i], tokens, not_ascii, case_sensitive,
+ index - pd->starts[i] );
+ }
+ }
+ }
+ }
abort ();
return 0;
}
@@ -239,9 +249,7 @@ static char * combi_get_completion ( const Switcher *sw, unsigned int index )
int state;
str = pd->switchers[i]->mgrv ( index - pd->starts[i], (void *) pd->switchers[i], &state, TRUE );
}
- char *retv = g_strdup_printf ( "!%c %s", pd->switchers[i]->name[0], str );
- g_free ( str );
- return retv;
+ return str;
}
}
// Should never get here.