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

Re: How to avoid infinite recursion in ZLE widgets

On Sat, Sep 26, 2020 at 11:27 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>  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).

I think the original documentation was correct. Consider this snippet:

    function a() {
      zle -R
      sleep 1
    zle -N a
    bindkey '^A' a

    function b() {
      sleep 1
    zle -N b
    bindkey '^B' b

If you press Ctrl+A, "foo" will appear immediately, followed by "bar"
after one second. However, if you press Ctrl+B, "foobar" will appear
after one second. The only difference between the two widgets is that
the first invokes `zle -R` after appending "foo" to BUFFER but the
second doesn't.


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