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

Re: How to call zle -U while drawing the prompt?



On May 26,  4:45pm, Duperon Georges wrote:
}
} * Call zle -U while drawing the prompt?
} * Or otherwise force zsh to either read all input just before I send
}     \e[6n to the terminal?

Make your call to zle -U from zle-line-init.

    autoload add-zle-hook-widget
    unget_user_input() {
      [[ -n "$userinput" ]] && zle -U "$userinput"
      unset userinput
    }
    add-zle-hook-widget line-init unget_user_input

If you're using a version of zsh that doesn't have add-zle-hook-widget
you can just do

    zle-line-init() {
      [[ -n "$userinput" ]] && zle -U "$userinput"
      unset userinput
    }
    zle -N zle-line-init

Obviously to do this userinput must be a global rather than a local.



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