zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Cc: Duperon Georges <jahvascriptmaniac@gmail.com>
Subject: Re: How to call zle -U while drawing the prompt?
Date: Fri, 26 May 2017 17:10:54 -0700	[thread overview]
Message-ID: <170526171054.ZM25198@torch.brasslantern.com> (raw)
In-Reply-To: <CAKQnwqadKiW_UTJPzERKzE=EEpEggSjq3cG8EHNKyznC5V1WHA@mail.gmail.com>

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.


      reply	other threads:[~2017-05-27  0:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 14:45 Dupéron Georges
2017-05-27  0:10 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170526171054.ZM25198@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=jahvascriptmaniac@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).