diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2002-06-07 10:57:24 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2002-06-07 10:57:24 +0000 |
commit | 37199039b2666815e42072ba934001fadb53b183 (patch) | |
tree | 4f35f0f5e9dcbd5cb9b0d5ad3b415b42647607c2 | |
parent | 9e97cfa052cba672d68dd6e7dfd7628719eda5aa (diff) | |
download | zsh-37199039b2666815e42072ba934001fadb53b183.tar.gz zsh-37199039b2666815e42072ba934001fadb53b183.tar.xz zsh-37199039b2666815e42072ba934001fadb53b183.zip |
17301: improve zle -I.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Doc/Zsh/zle.yo | 23 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 2 |
3 files changed, 22 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog index 618d31c41..b9272bbbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-06-07 Peter Stephenson <pws@csr.com> + + * 17301 (doc slightly tweaked): Src/Zle/zle_thingy.c, + Doc/Zsh/zle.yo: make `zle -I' only invalidate the display on the + first call to prevent spurious extra command lines appearing. + 2002-06-06 Peter Stephenson <pws@csr.com> * 17293: Src/Zle/zle_main.c, Doc/Zsh/zle.yo: support poll() diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index bfdbbd736..28e49130a 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -472,8 +472,9 @@ example(if ztcp pwspc 2811; then fi) ) item(tt(-I))( -Unusually, this option is only useful em(outside) ordinary widget functions. -It invalidates the current zle display in preparation for output; usually +Unusually, this option is most useful outside ordinary widget functions, +though it may be used within if normal output to the terminal is required. +It invalidates the current zle display in preparation for output; typically this will be from a trap function. It has no effect if zle is not active. When a trap exits, the shell checks to see if the display needs restoring, hence the following will print output in such a way as not to @@ -481,17 +482,23 @@ disturb the line being edited: example(TRAPUSR1() { # Invalidate zle display - zle -I + [[ -o zle ]] && zle -I # Show output print Hello }) -Note that there are better ways of manipulating the display from within zle -widgets. In general, the trap function may need to test whether zle is -loaded before using this method; if it is not, there is no point in loading -it specially since the line editor will not be active. +In general, the trap function may need to test whether zle is active before +using this method (as shown in the example), since the tt(zsh/zle) module +may not even be loaded; if it is not, the command can be skipped. -The status is zero if zle was active, else one. +It is possible to call `tt(zle -I)' several times before control is +returned to the editor; the display will only be invalidated the first time +to minimise disruption. + +Note that there are normally better ways of manipulating the display from +within zle widgets; see, for example, `tt(zle -R)' above. + +The status is zero if the current zle display was invalidated, else one. ) item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)( Invoke the specified widget. This can only be done when ZLE is diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 2aef7ecd4..26fc49906 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -672,7 +672,7 @@ bin_zle_call(char *name, char **args, char *ops, char func) static int bin_zle_invalidate(char *name, char **args, char *ops, char func) { - if (zleactive) { + if (zleactive && !trashedzle) { trashzle(); return 0; } else |