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

Re: Limiting height of completion menu



 ❦ 19 décembre 2020 14:15 -08, Bart Schaefer:

>> It also resets $LINES in my case.
>
> Yeah, I just noticed that.  Sometimes you have to save ZLE from itself.
>
> half-lines () {
>         print -n $(tput sc)
>         LINES=$((LINES/2))
>         print -n $(tput rc)
> }

It doesn't seem to fix the garbled non-select completion.

This simpler solution seems to work for me:

zstyle -e ':completion:*' menu 'reply=(yes=$((LINES/2)) select)'
_vbe_half-lines() {
    LINES=$((LINES/2))
}
_vbe_full-lines() {
    # Force terminal query
    LINES=0
}
add-zsh-hook preexec _vbe_full-lines
add-zle-hook-widget line-init _vbe_half-lines

Its scope is wider than completion, but it doesn't seem to break
anything for me.
-- 
10.0 times 0.1 is hardly ever 1.0.
            - The Elements of Programming Style (Kernighan & Plauger)




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