zsh-workers
 help / color / mirror / code / Atom feed
From: Andrey Borzenkov <arvidjaar@newmail.ru>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: Re: Broken completion with UTF-8 description
Date: Sat, 7 Oct 2006 11:58:38 +0400	[thread overview]
Message-ID: <200610071158.38918.arvidjaar@newmail.ru> (raw)
In-Reply-To: <200609211722.k8LHMOQ5008776@news01.csr.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 21 September 2006 21:22, Peter Stephenson wrote:
> > +#define INTERMATCH_GAP 2
>
> Ah, I see you've found another undocumented magic number used without
> any indication.  I found a few of those.

well, it was documented just not consistently used everywhere.

Index: Src/Zle/comp.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/comp.h,v
retrieving revision 1.15
diff -u -p -r1.15 comp.h
- --- Src/Zle/comp.h	7 Mar 2006 12:52:28 -0000	1.15
+++ Src/Zle/comp.h	7 Oct 2006 07:57:13 -0000
@@ -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
+
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.67
diff -u -p -r1.67 compresult.c
- --- Src/Zle/compresult.c	6 Oct 2006 16:48:42 -0000	1.67
+++ Src/Zle/compresult.c	7 Oct 2006 07:57:14 -0000
@@ -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.  */
 
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.98
diff -u -p -r1.98 computil.c
- --- Src/Zle/computil.c	5 Oct 2006 21:53:27 -0000	1.98
+++ Src/Zle/computil.c	7 Oct 2006 07:57:15 -0000
@@ -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);

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFJ14uR6LMutpd94wRAg2sAJ0UEGWlS8a71UgyyrvsLymk9bMdEwCeOsUD
HOonqPkgXe2cAo/JfTaxXNI=
=mk3C
-----END PGP SIGNATURE-----


  parent reply	other threads:[~2006-10-07  7:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-17 14:53 Andrey Borzenkov
2006-09-17 19:16 ` Peter Stephenson
2006-09-21 17:04   ` PATCH: " Andrey Borzenkov
2006-09-21 17:22     ` Peter Stephenson
2006-09-21 17:44       ` Andrey Borzenkov
2006-10-07  7:58       ` Andrey Borzenkov [this message]
2006-09-21 20:02     ` Peter Stephenson
2006-09-23  7:05       ` Andrey Borzenkov
2006-09-23  7:36         ` Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200610071158.38918.arvidjaar@newmail.ru \
    --to=arvidjaar@newmail.ru \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).