From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27242 invoked from network); 16 Aug 2006 20:33:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Aug 2006 20:33:10 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 8420 invoked from network); 16 Aug 2006 20:33:04 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Aug 2006 20:33:04 -0000 Received: (qmail 12427 invoked by alias); 16 Aug 2006 20:33:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22612 Received: (qmail 12417 invoked from network); 16 Aug 2006 20:33:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 16 Aug 2006 20:33:01 -0000 Received: (qmail 8004 invoked from network); 16 Aug 2006 20:33:01 -0000 Received: from mtaout01-winn.ispmail.ntl.com (81.103.221.47) by a.mx.sunsite.dk with SMTP; 16 Aug 2006 20:32:59 -0000 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20060816203257.VMXV15018.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Wed, 16 Aug 2006 21:32:57 +0100 Received: from pwslaptop.csr.com ([81.107.41.155]) by aamtaout03-winn.ispmail.ntl.com with ESMTP id <20060816203256.OEBR11710.aamtaout03-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Wed, 16 Aug 2006 21:32:56 +0100 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.7/8.13.7) with ESMTP id k7GKWsTd005627 for ; Wed, 16 Aug 2006 21:32:55 +0100 Message-Id: <200608162032.k7GKWsTd005627@pwslaptop.csr.com> From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: complist.c comments, part 1 Date: Wed, 16 Aug 2006 21:32:54 +0100 Comments for the more obscure static variables used in complist.c. More as I feel inclined. One variable turned out not to need documenting, or indeed existing. Index: Src/Zle/complist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v retrieving revision 1.93 diff -u -r1.93 complist.c --- Src/Zle/complist.c 15 Aug 2006 21:19:35 -0000 1.93 +++ Src/Zle/complist.c 16 Aug 2006 20:29:19 -0000 @@ -36,7 +36,13 @@ * type. */ +/* + * menu-select widget: used to test if it's already loaded. + */ static Widget w_menuselect; +/* + * Similarly for the menuselect and listscroll keymaps. + */ static Keymap mskeymap, lskeymap; /* Indixes into the terminal string arrays. */ @@ -389,16 +395,92 @@ /* Information about the list shown. */ -static int noselect, mselect, inselect, mcol, mline, mcols, mlines, mmlen; +/* + * noselect: 1 if complistmatches indicated we shouldn't do selection. + * Tested in domenuselect. + * mselect: Local copy of the index of the currently selected match. + * Initialised to the gnum entry of the current match for + * each completion. + * inselect: 1 if we already selecting matches; tested in complistmatches() + * mcol: The column for the selected completion. As we never scroll + * horizontally this applies both the screen and the logical array. + * mline: The line for the selected completion in the logical array of + * all matches, not all of which may be on screen at once. + * mcols: Local copy of columns used in sizing arrays. + * mlines: The number of lines in the logical array of all matches, + * initialised from listdat.nlines. + */ +static int noselect, mselect, inselect, mcol, mline, mcols, mlines; +/* + * selected: Used to signal between domenucomplete() and menuselect() + * that a selected entry has been found. Or something. + * mlbeg: The first line of the logical array of all matches that + * fits on screen. + * mlend: The line after the last that fits on screen. + * mscroll: 1 if the scrolling prompt is shown on screen. + * mrestlines: The number of screen lines remaining to be processed. + */ static int selected, mlbeg = -1, mlend = 9999999, mscroll, mrestlines; +/* + * mnew: 1 if a new selection menu is being displayed. + * mlastcols: stored value of mcols for use in calculating mnew. + * mlastlines: stored value of mlines for use in calculating mnew. + * mhasstat: Indicates if the status line is present (but maybe not + * yet printed). + * mfirstl: The first line of the logical array of all matches to + * be shown on screen, -1 if this has not yet been determined. + * mlastm: The index of the selected match in some circumstances; used + * if an explicit number for a match is passed to compprintfmt(); + * initialised from the total number of matches. I realise this + * isn't very illuminating. + */ static int mnew, mlastcols, mlastlines, mhasstat, mfirstl, mlastm; +/* + * mlprinted: Used to signal the number of additional lines printed + * when outputting matches (as argument passing is a bit + * screwy within the completion system). + * molbeg: The last value of mlbeg; -1 if invalid, -42 if, er, very + * invalid. Used in calculations of how much to draw. + * mocol: The last value of mcol. + * moline: The last value of mline. + * mstatprinted: Indicates that the status line has now been printed, + * c.f. mhasstat. + */ static int mlprinted, molbeg = -2, mocol = 0, moline = 0, mstatprinted; +/* + * mstatus: The message printed when scrolling. + * mlistp: The message printed when merely listing. + */ static char *mstatus, *mlistp; +/* + * mtab is the logical array of all matches referred to above. It + * contains mcols*mlines entries. These entries contain a pointer to + * the match structure which is in use at a particular point. Note + * that for multiple line entries lines after the first contain NULL. + * + * mmtabp is a pointer to the selected entry in mtab. + */ static Cmatch **mtab, **mmtabp; +/* + * Used to indicate that the list has changed and needs redisplaying. + */ static int mtab_been_reallocated; +/* + * Array and pointer for the match group in exactly the same layout + * as mtab and mmtabp. + */ static Cmgroup *mgtab, *mgtabp; +/* + * Contains information about the colours to be used for entries. + * Sometimes mcolors is passed as an argument even though it's + * availabel to all the functions. + */ static struct listcols mcolors; #ifdef DEBUG +/* + * Allow us to keep track of pointer arithmetic for mgtab; could + * just as well have been for mtab but wasn't. + */ int mgtabsize; #endif @@ -1539,7 +1621,6 @@ mcol = 0; mmtabp = mtab + mm; mgtabp = mgtab + mm; - mmlen = mcols; zcputs(&mcolors, g->name, COL_MA); } else if ((m->flags & CMF_NOLIST) && mcolors.files[COL_HI] && mcolors.files[COL_HI]->col) @@ -1601,7 +1682,6 @@ mline = ml; mmtabp = mtab + mx + mm; mgtabp = mgtab + mx + mm; - mmlen = width; zcputs(&mcolors, g->name, COL_MA); } else if (m->flags & CMF_NOLIST) zcputs(&mcolors, g->name, COL_HI); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/