Add option 'completion_ignore_case'
By default completion is now case sensitive.
(Partially fixes issue #48)
--- 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)
--- 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.