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

Re: zle .redisplay sometimes eating up a line



On Mon, 15 Jul 2019 at 11:18, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
> What's your $ZSH_PATCHLEVEL?

zsh-5.7.1-101-g09385d3

> Could you post self-contained instructions for reproducing this?
> Something like this:
>
> 1. Start `zsh -df`.
> 2. Copy-paste this code. The code should not require Internet access.
> 3. Press and hold Ctrl+T.
>
> Roman.

The instructions will be not fully self-contained, as the issue
reveals itself with 3 plugins being loaded:

1. git clone https://github.com/geometry-zsh/geometry
2. git clone https://github.com/zsh-users/zsh-autosuggestions autos
3. git clone https://github.com/zsh-users/zsh-syntax-highlighting zsyh
4. zsh -dfi
5. source geometry/geometry.plugin.zsh
6. source autos/zsh-autosuggestions.zsh
7. source zsyh/zsh-syntax-highlighting.zsh
8. Paste the code (http://sprunge.us/SAkQxz):
deploy-code() {
[[ "$1" = <-> && ${#} -eq 1 ]] && {
    local alltext text IFS=$'\n' nl=$'\n'
     repeat 25; do read -r -u"$1" text; alltext+="${text:+$text$nl}"; done
    zle -F "$1"; exec {1}<&-
    eval "$alltext"
    return 0
}
local THEFD
exec {THEFD} < <(
    # The expansion is: if there is @sleep: pfx, then use what is after
    # it, otherwise substitute 0
    LANG=C sleep $(( 0.005 + ${${${(M)1#@sleep:}:+${1#@sleep:}}:-0} ))
    print -r -- ${1:#(@code|@sleep:*)} "${@[2,-1]}"
)
zle -N deploy-code
zle -w -F "$THEFD" deploy-code
}
deploy-code-widget() { BUFFER+='B'; deploy-code @sleep:0.5
"BUFFER+='a'; zle .redisplay;"; }
zle -N deploy-code-widget
bindkey "^T" deploy-code-widget

9. Press and long hold Ctrl-T

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



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