zsh-users
 help / color / mirror / code / Atom feed
From: "Jesper Nygårds" <jesper.nygards@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Disabling prompt refresh
Date: Tue, 14 Feb 2017 08:20:51 +0100	[thread overview]
Message-ID: <CABZhJg894=k7EFmjsM2koiavAF6JXe=9EU66vxzth-jQu0CvyQ@mail.gmail.com> (raw)
In-Reply-To: <170213095400.ZM5106@torch.brasslantern.com>

[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]

This is perfect for my needs. Thank you, Bart.


On Mon, Feb 13, 2017 at 6:54 PM, Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Feb 13,  3:31pm, Jesper Nygards wrote:
> }
> } Is there a way to either disable the prompt refresh while the message is
> } displayed, or, alternatively, to redisplay the message after a prompt
> } refresh?
>
> The simplest approach might be to not use "zle -M" at all:
>
>   _show_dirs() {
>     POSTDISPLAY=$'\n'"${$(dirs -vl)//$'\t'/  }"
>   }
>
> To answer your question, though -- you would need to have the functions
> coordinate somehow, e.g.:
>
>   typeset -gH _prompt_message
>   _show_dirs() {
>     _prompt_message="${$(dirs -vl)//$'\t'/  }"
>     zle -M "_prompt_message"
>   }
>   schedprompt() {
>     emulate -L zsh
>     zmodload -i zsh/sched
>
>     integer i=${"${(@)zsh_scheduled_events#*:*:}"[(I)schedprompt]}
>     (( i )) && sched -$i
>
>     zle && zle reset-prompt &&
>     [[ -n $_prompt_message ]] && zle -M "$_prompt_message"
>
>     sched +30 schedprompt
>   }
>   clear-prompt-message() {
>     _prompt_message=
>   }
>   autoload add-zsh-hook
>   add-zsh-hook precmd clear-prompt-message
>
> (I'm guessing schedprompt is also a precmd hook but didn't want to assume.)
>
> You could instead in schedprompt do
>
>     [[ -z $_prompt_message ]] && zle && zle reset-prompt
>
> to disable the redraw.
>

      reply	other threads:[~2017-02-14  7:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 14:31 Jesper Nygårds
2017-02-13 17:54 ` Bart Schaefer
2017-02-14  7:20   ` Jesper Nygårds [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='CABZhJg894=k7EFmjsM2koiavAF6JXe=9EU66vxzth-jQu0CvyQ@mail.gmail.com' \
    --to=jesper.nygards@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).