about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/comp.h4
-rw-r--r--Src/Zle/compresult.c4
-rw-r--r--Src/Zle/computil.c17
4 files changed, 15 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e904e6a4..44d0db361 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-07  Andrey Borzenkov <bor@zsh.org>
+
+	* 22831: Src/Zle/comp.h, Src/Zle/compresult.c, Src/Zle/computil.c:
+	make CM_SPACE definition global and use it consistently in
+	compresults and compdescribe to lay out matches
+
 2006-10-06  Peter Stephenson  <pws@csr.com>
 
 	* 10791: Src/Zle/compresult.c: accumulated completions
diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h
index e88f8b927..1b1530492 100644
--- a/Src/Zle/comp.h
+++ b/Src/Zle/comp.h
@@ -407,3 +407,7 @@ struct chdata {
     Cmatch cur;			/* current match or NULL */
 };
 
+/* The number of columns to leave empty between rows of matches. */
+
+#define CM_SPACE  2
+
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 0fb50ad0e..2dabe2c35 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -30,10 +30,6 @@
 #include "complete.mdh"
 #include "compresult.pro"
 
-/* The number of columns to leave empty between rows of matches. */
-
-#define CM_SPACE  2
-
 /* This counts how often the list of completions was invalidated.
  * Can be used to detect if we have a new list.  */
 
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index f13397e5e..ce70dee72 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -33,13 +33,6 @@
 
 /* Help for `_describe'. */
 
-/*
- * FIXME this should be defined globally. I have to find other places
- * where it is used
- * */
-
-#define INTERMATCH_GAP 2
-
 typedef struct cdset *Cdset;
 typedef struct cdstr *Cdstr;
 typedef struct cdrun *Cdrun;
@@ -161,7 +154,7 @@ cd_group(int maxg)
                 for (str2 = (set2 == set1 ? str1->next : set2->strs);
                      str2; str2 = str2->next)
                     if (str2->desc && !strcmp(str1->desc, str2->desc)) {
-                        width += INTERMATCH_GAP + str2->width;
+                        width += CM_SPACE + str2->width;
                         if (width > cd_state.maxmlen || num == maxg)
                             break;
                         if (width > cd_state.maxglen)
@@ -276,7 +269,7 @@ cd_prep()
 
         cd_state.gprew = 0;
         for (i = 0; i < cd_state.maxg; i++) {
-            cd_state.gprew += wids[i] + INTERMATCH_GAP;
+            cd_state.gprew += wids[i] + CM_SPACE;
 	}
 
         if (cd_state.gprew > cd_state.maxmlen && cd_state.maxglen > 1)
@@ -631,7 +624,7 @@ cd_get(char **params)
 		 *     max prefix length (cd_state.pre) +
 		 *     max padding (cd_state.premaxw generously :) +
 		 *     separator length (cd_state.slen) +
-		 *     inter matches gap (INTERMATCH_GAP) +
+		 *     inter matches gap (CM_SPACE) +
 		 *     max description length (cd_state.suf) +
 		 *     trailing \0
 		 */
@@ -648,7 +641,7 @@ cd_get(char **params)
                     *mp++ = ztrdup(str->match);
 		    strcpy(p, str->str);
 		    p += str->len;
-                    memset(p, ' ', (l = (cd_state.premaxw - str->width + INTERMATCH_GAP)));
+                    memset(p, ' ', (l = (cd_state.premaxw - str->width + CM_SPACE)));
 		    p += l;
 		    strcpy(p, cd_state.sep);
 		    p += cd_state.slen;
@@ -750,7 +743,7 @@ cd_get(char **params)
                     }
 
                     strcpy(dbuf, cd_state.sep);
-		    remw = columns - cd_state.gprew - cd_state.swidth - INTERMATCH_GAP;
+		    remw = columns - cd_state.gprew - cd_state.swidth - CM_SPACE;
 		    p = pp = dbuf + cd_state.slen;
 		    d = str->desc;
 		    w = MB_METASTRWIDTH(d);