[/trunk] Changeset 134 by mikael
* Completion: add a space after each completion option...
* Completion: does not work when there are several spaces after the command
--- a/mcabber/src/compl.c Mon Apr 25 20:56:23 2005 +0000
+++ b/mcabber/src/compl.c Tue Apr 26 09:36:50 2005 +0000
@@ -135,6 +135,7 @@
{
GSList *sl_cat;
category *cat;
+ char *nword;
// Look for category
for (sl_cat=Categories; sl_cat; sl_cat = g_slist_next(sl_cat)) {
if (categ == ((category*)sl_cat->data)->flag)
@@ -147,8 +148,20 @@
} else
cat = (category*)sl_cat->data;
+ // If word is not space-terminated, we add one trailing space
+ for (nword = (char*)word; *nword; nword++)
+ ;
+ if (nword > word) nword--;
+ if (*nword != ' ') { // Add a space
+ nword = g_new(char, strlen(word)+2);
+ strcpy(nword, word);
+ strcat(nword, " ");
+ } else { // word is fine
+ nword = g_strdup(word);
+ }
+
// TODO Check word does not already exist
- cat->words = g_slist_append(cat->words, g_strdup(word)); // TODO sort
+ cat->words = g_slist_append(cat->words, nword); // TODO sort
}
// compl_get_category_list()
--- a/mcabber/src/screen.c Mon Apr 25 20:56:23 2005 +0000
+++ b/mcabber/src/screen.c Tue Apr 26 09:36:50 2005 +0000
@@ -807,8 +807,9 @@
}
if (*p == '"' && *(p-1) != '\\') {
quote = TRUE;
- } else if (*p == ' ' && *(p-1) != ' ') {
- row++;
+ } else if (*p == ' ') {
+ if (*(p-1) != ' ')
+ row++;
*p_row = p+1;
}
}