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

Re: How to avoid infinite recursion in ZLE widgets

Peter Stephenson wrote on Fri, 25 Sep 2020 15:43 +0100:
> > On 25 September 2020 at 15:19 Peter Slížik <peter.slizik@xxxxxxxxx> wrote:
> > By the way, the documentation says that zle -R should be called after
> > changing the command line from within a ZLE widget.
> >
> > However, when playing with LBUFFER and RBUFFER I realized that zle -R is
> > not needed and the changes are visible immediately.
> > 
> > Why is it so?  
> You only need to call zle -R either if you are passing it an argument
> to show, or if you are bypassing the editor interface somehow so it
> doesn't know the display has changed.  If you use any of the special
> variables or a zle command to update the command line then ZLE's
> internals are all consistent and you don't need any special action.

diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 84be010e1..885366c8c 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -502,7 +502,8 @@ ifnzman(noderef(Completion Widgets))\
 item(tt(-R) [ tt(-c) ] [ var(display-string) ] [ var(string) ... ])(
 Redisplay the command line; this is to be called from within a user-defined
-widget to allow changes to become visible.  If a var(display-string) is
+widget to allow changes made directly to the terminal (bypassing ZLE) to become
+visible.  If a var(display-string) is
 given and not empty, this is shown in the status line (immediately
 below the line being edited).

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