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

Re: Disabling prompt refresh



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


On Mon, Feb 13, 2017 at 6:54 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
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.
>


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