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

Re: Non-patch: zle argument handling



"Bart Schaefer" wrote:
> } For user-defined widgets, we could have a special function to allow
> } them to feep and a special option to zle that will suppress the feep
> } for any other widget, so that simple zle -N's work without extra error
> } handling.
> 
> I presume that in this scheme an un-suppressed feep() would abort the
> widget, as I believe currently happens?

Actually, it doesn't seem to at the moment.  I haven't been keeping track
of this, so I don't know if it's changed, but
  testwidget() { zle transpose-words; LBUFFER="${LBUFFER}Ha."; }
both beeps and inserts "Ha." when there's only one word on the line.
On the other hand, with an `&&' between the two it now works as expected
--- this is certainly new and is now the favo[u]red mechanism for returning
early.

> }  item(tt(-k) [ var(num) ])(
> }  Read only one (or var(num)) characters.  All are assigned to the first
> }  var(name), without word splitting.  This flag is ignored when tt(-q) is
> }  present.  Input is read from the terminal unless one of tt(-u) or tt(-p)
> } -is present.
> } +is present.  May be called from a zle widget with no tt(-u)
> } +or tt(-p) argument, in which case it will use zle to retrieve a key.
> }  )
> 
> Does this imply when called from that var(num) is ignored and exactly one
> key is read regardless?  That seems broken to me.  If that's not what it
> means, then what difference does it make that zle is involved?  Things
> should only get documented if they are visible behavior changes; and then
> what you need to document is the behavior, not the implementation.

No, var(num) is still used.  The difference is that it now works with zle.
The version below is simplified.

--- /temp/pws/zsh-3.1.5/Doc/Zsh/builtins.yo.a2	Mon Jun 21 09:16:32 1999
+++ /temp/pws/zsh-3.1.5/Doc/Zsh/builtins.yo	Mon Jun 21 09:28:19 1999
@@ -682,15 +682,13 @@
 With this flag set the return value is zero only if the character was
 `tt(y)' or `tt(Y)'.  Note that this always reads from the terminal, even
 if used with the tt(-p) or tt(-u) or tt(-z) flags or with redirected input.
-May be called from a zle widget, in which case it will use zle to retrieve
-a key.
+This option may also be used within zle widgets.
 )
 item(tt(-k) [ var(num) ])(
 Read only one (or var(num)) characters.  All are assigned to the first
 var(name), without word splitting.  This flag is ignored when tt(-q) is
 present.  Input is read from the terminal unless one of tt(-u) or tt(-p)
-is present.  May be called from a zle widget with no tt(-u)
-or tt(-p) argument, in which case it will use zle to retrieve a key.
+is present.  This option may also be used within zle widgets.
 )
 item(tt(-z))(
 Read one entry from the editor buffer stack and assign it to the first
--- /temp/pws/zsh-3.1.5/Doc/Zsh/zle.yo.a2	Mon Jun 21 09:20:35 1999
+++ /temp/pws/zsh-3.1.5/Doc/Zsh/zle.yo	Mon Jun 21 09:21:04 1999
@@ -103,8 +103,7 @@
 can execute any normal shell command.  They can also run other widgets
 (whether built-in or user-defined) using the tt(zle) builtin command.
 They can use tt(read -k) or tt(read -q) to read characters from standard
-input, which will use the appropriate tt(zle) key input mechanism.
-Finally, they can examine and edit the ZLE buffer being edited by
+input.  Finally, they can examine and edit the ZLE buffer being edited by
 reading and setting the special parameters described below.
 
 cindex(parameters, editor)

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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