zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@cambridgesiliconradio.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: compinstall
Date: Mon, 15 May 2000 12:56:58 +0100	[thread overview]
Message-ID: <0FUL00J09NUXSH@la-la.cambridgesiliconradio.com> (raw)

This modifies compinstall to support the long and long-list keywords for
menu selection.  I have also moved configuration of scrolling in lists to
the more logical position of just after menu selction.

Index: Completion/Core/compinstall
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/compinstall,v
retrieving revision 1.12
diff -u -r1.12 compinstall
--- Completion/Core/compinstall	2000/05/10 08:46:46	1.12
+++ Completion/Core/compinstall	2000/05/15 11:54:13
@@ -1053,9 +1053,7 @@
 
 3.  Make completion verbose, using option descriptions etc. (on by default).
 
-4.  Allow scrolling of long completion lists and set the prompt.
-
-5.  Make single-valued options display the value's description as
+4.  Make single-valued options display the value's description as
     part of the option's description.
 
 q.  Return without saving.
@@ -1126,25 +1124,6 @@
           esac
 	 ;;
       4) print "\
-You can make completion lists scroll when they don't fit on the screen.
-To do this, edit a prompt to show when scrolling is active; an empty string
-turns this feature off.  It can contain \`%l' to show the number of matches
-as \`current_number/total_number', \`%p' to show the fraction of the way
-down the list, or font-control sequences such as %B, %U, %S and the
-corresponding %b, %u, %s; quotes will be added automatically.  Note that
-this is the default behaviour; delete the whole line to turn it off, in
-which case the display of completions which don't fit on the screen is
-controlled by the LISTMAX parameter (currently ${LISTMAX:-unset}), which
-specifies the maximum number to show without asking.  Hit return to keep
-the current value.
-"
-         [[ -z $haslistp ]] &&
-	   listp='%SAt %p: Hit TAB for more, or the character to insert%s'
-	 vared -eh -p 'prompt> ' -c listp
-	 # Unconditionally use listp; will become '' if empty.
-	 haslistp=1
-	 ;;
-      5) print "\
 Many commands have options which take a single argument.  In some cases,
 completion is not set up to describe the option even though it has a
 description for the argument.  You can enter a string containing \`%d',
@@ -1172,8 +1151,6 @@
   __ci_set_this_style format format
   __ci_set_this_style group-name groupn
   __ci_set_this_style verbose verbose
-  [[ -n $haslistp ]] && listp=${(qq)listp}
-  __ci_set_this_style list-prompt listp
   [[ -n $autod ]] && autod=${(qq)autod}
   __ci_set_this_style auto-description autod
 }
@@ -1267,6 +1244,9 @@
 
   __ci_get_this_style list-colors listc
   __ci_get_this_style menu menu
+  __ci_get_this_style list-prompt listp
+  [[ -n $listp ]] && haslistp=1
+  listp=${(Q)listp}
 
   while true; do
     clear
@@ -1277,6 +1257,8 @@
 
 2.   Use cursor keys to select completions from completion lists.
 
+3.   Allow scrolling of long selection lists and set the prompt.
+
 q.   Return without saving.
 0.   Done setting options for insertion.
 "
@@ -1325,13 +1307,17 @@
 - 0 or 1, to turn this feature on unconditionally
 - a higher number to turn this feature on when there are that many
   completions
+- an \`l' for \`long' to turn it on for completions which don't fit on the
+  screen
+- an \`ll' for \`long list' to turn it on for completions which don't fit
+  on the screen, even for commands which only do listing of completions.
 - a negative number to turn this feature off
 - an empty line to leave the setting the way it is.
 "
          while true; do
            vared -eh -p 'value> ' select
-	   [[ -z $select || $select = (-|)<-> ]] && break;
-	   print "Type a number or an empty line." >&2
+	   [[ -z $select || $select = ((-|)<->|l#) ]] && break;
+	   print "Type a number, l, ll, or an empty line." >&2
 	 done
 	 amenu=(${=menu})
 	 elt=${amenu[(i)*select*]}
@@ -1344,6 +1330,18 @@
 	        fi
 		menu="$amenu"
 		;;
+	   l#) if [[ $select = l ]]; then
+                 select=long
+               else
+                 select=long-list
+               fi
+               if [[ -n $elt ]]; then
+                 amenu[$elt]="select=$select"
+               else
+                 amenu=($amenu "select=$select")
+               fi
+	       menu="$amenu"
+               ;;
 	   -<->) if [[ -n $elt ]]; then
 		    # i never liked the way indexing was done anyway
 		    if [[ $elt -eq 1 ]]; then
@@ -1356,6 +1354,28 @@
 		 ;;
 	 esac
          ;;
+      3) print "\
+You can make completion lists scroll when they don't fit on the screen.
+Note this is different from scrolling in menu selection --- a more basic
+pager is used which should work even with fairly stupid terminals.
+
+To enable this, edit a prompt to show when scrolling is active; an empty 
+string turns this feature off.  It can contain \`%l' to show the number of
+matches as \`current_number/total_number', \`%p' to show the fraction of
+the way down the list, or font-control sequences such as %B, %U, %S and the
+corresponding %b, %u, %s; quotes will be added automatically.  Note that
+this is the default behaviour; delete the whole line to turn it off, in
+which case the display of completions which don't fit on the screen is
+controlled by the LISTMAX parameter (currently ${LISTMAX:-unset}), which
+specifies the maximum number to show without asking.  Hit return to keep
+the current value.
+"
+         [[ -z $haslistp ]] &&
+	   listp='%SAt %p: Hit TAB for more, or the character to insert%s'
+	 vared -eh -p 'prompt> ' -c listp
+	 # Unconditionally use listp; will become '' if empty.
+	 haslistp=1
+	 ;;
       q) return 1
          ;;
     esac
@@ -1363,6 +1383,8 @@
 
   __ci_set_this_style list-colors listc
   __ci_set_this_style menu menu
+  [[ -n $haslistp ]] && listp=${(qq)listp}
+  __ci_set_this_style list-prompt listp
 
   return 0
 }
@@ -1385,7 +1407,8 @@
 2.  Change how completions are inserted: includes options for sorting,
     and keeping the original or an unambiguous prefix with correction etc.
 
-3.  Configure coloured/highlighted completion lists and selection of items.
+3.  Configure coloured/highlighted completion lists, selection of items
+    and scrolling.
 
 4.  Change whether old-style \`compctl' completions will be used.
 
-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


             reply	other threads:[~2000-05-15 11:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-15 11:56 Peter Stephenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-04-27 20:40 Peter Stephenson

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=0FUL00J09NUXSH@la-la.cambridgesiliconradio.com \
    --to=pws@cambridgesiliconradio.com \
    --cc=zsh-workers@sunsite.auc.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).