# HG changeset patch # User Mikael Berthe # Date 1289481196 -3600 # Node ID c1f9a4d47e052860117623e785a8096374fc8905 # Parent 3655f52687f0756fb2f10ba6b1b8733224a7b9d4 Add option 'completion_ignore_case' By default completion is now case sensitive. (Partially fixes issue #48) diff -r 3655f52687f0 -r c1f9a4d47e05 mcabber/mcabber/compl.c --- a/mcabber/mcabber/compl.c Wed Nov 10 17:36:26 2010 +0100 +++ b/mcabber/mcabber/compl.c Thu Nov 11 14:13:16 2010 +0100 @@ -36,6 +36,7 @@ #include "utf8.h" #include "roster.h" #include "events.h" +#include "settings.h" #include "logprint.h" // Completion structure @@ -135,17 +136,23 @@ { compl *c; GSList *sl_cat; + gint (*cmp)(const char *s1, const char *s2, size_t n); size_t len = strlen(prefix); if (InputCompl) { // This should not happen, but hey... cancel_completion(); } + if (settings_opt_get_int("completion_ignore_case")) + cmp = &strncasecmp; + else + cmp = &strncmp; + c = g_new0(compl, 1); // Build the list of matches for (sl_cat = compl_cat; sl_cat; sl_cat = g_slist_next(sl_cat)) { char *word = sl_cat->data; - if (!strncasecmp(prefix, word, len)) { + if (!cmp(prefix, word, len)) { if (strlen(word) != len) { gchar *compval; if (suffix) diff -r 3655f52687f0 -r c1f9a4d47e05 mcabber/mcabberrc.example --- a/mcabber/mcabberrc.example Wed Nov 10 17:36:26 2010 +0100 +++ b/mcabber/mcabberrc.example Thu Nov 11 14:13:16 2010 +0100 @@ -126,6 +126,10 @@ # running you can use "/roster display"). #set roster_display_filter = ofdna_ +# By default command line completion is case-sensitive; this can be changed +# by setting the option 'completion_ignore_case' to 1. +#set completion_ignore_case = 0 + # Typing notifications, Chat States, Events (XEP-22/85) # Set disable_chatstates to 1 if you don't want to use typing notifications. # Note: changing this option once mcabber is running has no effect.