Permalink
Browse files

41_casecomp

from debian

Downloaded from http://www.phys.ethz.ch/~mweyland/casecomp.patch
this will modify tab completion so that uppercase letters will
only match to uppercase, while lowercase match bot
  • Loading branch information...
1 parent f7844dc commit 74aed26fb42452919f0fa5153124d3cdb0b965c7 ??? committed with youknowone Jun 13, 2012
Showing with 24 additions and 1 deletion.
  1. +2 −0 src/common/cfgfiles.c
  2. +20 −1 src/common/util.c
  3. +1 −0 src/common/util.h
  4. +1 −0 src/common/xchat.h
View
@@ -390,6 +390,8 @@ const struct prefs vars[] = {
{"completion_auto", P_OFFINT (nickcompletion), TYPE_BOOL},
{"completion_sort", P_OFFINT (completion_sort), TYPE_INT},
{"completion_suffix", P_OFFSET (nick_suffix), TYPE_STR},
+
+ {"completion_cinsens", P_OFFINT (completion_cinsens), TYPE_BOOL},
{"dcc_auto_chat", P_OFFINT (autodccchat), TYPE_INT},
{"dcc_auto_resume", P_OFFINT (autoresume), TYPE_BOOL},
View
@@ -1350,7 +1350,7 @@ rfc_ncasecmp (char *str1, char *str2, int n)
register unsigned char *s2 = (unsigned char *) str2;
register int res;
- while ((res = rfc_tolower (*s1) - rfc_tolower (*s2)) == 0)
+ while ((res = hal_casecomp(s1,s2)) == 0)
{
s1++;
s2++;
@@ -1361,6 +1361,25 @@ rfc_ncasecmp (char *str1, char *str2, int n)
return (res);
}
+int
+hal_casecomp ( char *s1, char *s2)
+{
+
+/* This function, called by rfc_ncasecmp, enables enhanced tab
+ * completition: It completes te<tab> to Test but not Te<tab> to
+ * test2. (This is useful if you have two users Test1 and test2 in
+ * the channel. Can be toggeled wit /set completion_cinsens (0|1)
+ *
+ * -- Mathias Weyland <mathias@weyland.ch>, 6.9.2004
+*/
+ if((*s2 - rfc_tolower (*s2)) || prefs.completion_cinsens)
+ {
+ return (rfc_tolower (*s1) - rfc_tolower (*s2));
+ } else {
+ return (*s1 - *s2);
+ }
+}
+
const unsigned char rfc_tolowertab[] =
{ 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
View
@@ -26,6 +26,7 @@ char *file_part (char *file);
void for_files (char *dirname, char *mask, void callback (char *file));
int rfc_casecmp (const char *, const char *);
int rfc_ncasecmp (char *, char *, int);
+int hal_casecomp ( char *s1, char *s2);
int buf_get_line (char *, char **, int *, int len);
char *nocasestrstr (const char *text, const char *tofind);
char *country (char *);
View
@@ -210,6 +210,7 @@ struct xchatprefs
unsigned int userlistbuttons;
unsigned int showhostname_in_userlist;
unsigned int nickcompletion;
+ unsigned int completion_cinsens;
unsigned int completion_amount;
unsigned int tabchannels;
unsigned int paned_userlist;

0 comments on commit 74aed26

Please sign in to comment.