Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: compinstall: list-prompt



While I'm not at it, here's an addition to compinstall to handle
list-prompt.  It doesn't handle select-prompt, since that's more cosmetic
--- scrolling in menu select works without it.

Index: Completion/Core/compinstall
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/compinstall,v
retrieving revision 1.6
diff -u -r1.6 compinstall
--- Completion/Core/compinstall	2000/04/11 20:25:30	1.6
+++ Completion/Core/compinstall	2000/04/18 13:02:39
@@ -943,11 +943,13 @@
 }
 
 __ci_do_list_format() {
-  local key format groupn verbose autod
+  local key format groupn verbose listp autod
   __ci_get_this_style format format
   [[ -n $format ]] && format=${(Q)format}
   __ci_get_this_style group-name groupn
   __ci_get_this_style verbose verbose
+  __ci_get_this_style list-prompt listp
+  [[ -n $listp ]] && listp=${(Q)listp}
   __ci_get_this_style auto-description autod
   [[ -n $autod ]] && autod=${(Q)autod}
 
@@ -965,7 +967,9 @@
 
 3.  Make completion verbose, using option descriptions etc. (on by default).
 
-4.  Make single-valued options prompt use the value's description as
+4.  Allow scrolling of long completion lists and set the prompt.
+
+5.  Make single-valued options display the value's description as
     part of the option's description.
 
 q.  Return without saving.
@@ -1036,6 +1040,19 @@
           esac
 	 ;;
       4) print "\
+Normally, 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.  Instead, 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', as well as font-control sequences such
+as %B, %U, %S.  Quotes will be added automatically.  Hit return to keep the
+current value.
+"
+	 vared -eh -p 'prompt> ' -c listp
+	 ;;
+      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',
@@ -1063,6 +1080,8 @@
   __ci_set_this_style format format
   __ci_set_this_style group-name groupn
   __ci_set_this_style verbose verbose
+  [[ -n $listp ]] && listp=${(qq)listp}
+  __ci_set_this_style list-prompt listp
   [[ -n $autod ]] && autod=${(qq)autod}
   __ci_set_this_style auto-description autod
 }
@@ -1268,7 +1287,8 @@
          *** compinstall: display and insertion options ***
 
 1.  Change appearance of completion lists:  allows descriptions of
-    completions to appear, and sorting of different types of completions.
+    completions to appear, sorting of different types of completions,
+    and scrolling of completion lists.
 
 2.  Change how completions are inserted: includes options for sorting,
     and keeping the original or an unambiguous prefix with correction etc.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



Messages sorted by: Reverse Date, Date, Thread, Author