# Tests for region_highlight, true-color support, near-color support %prep if [[ $OSTYPE == cygwin ]]; then ZTST_unimplemented='the zsh/zpty module does not work on Cygwin' elif zmodload zsh/zpty 2> /dev/null; then zpty_start() { export PS1= PS2= zpty -d zpty zsh "${(q)ZTST_testdir}/../Src/zsh -fiV +Z" } zpty_input() { zpty -w zsh "$1" ${${(M)2:#nl}:+$'\n'} } zpty_line() { local REPLY integer i for (( i = 0; i < ${1:-1}; ++i )); do zpty -r zsh REPLY print -r -- ${REPLY%%($'\r\n'|$'\n')} done } zpty_stop() { # exit twice in case of check_jobs zpty -w zsh $'exit\nexit\n' # zpty gives no output when piped without these braces (?) { zpty -r zsh } | sed $'/[^[:space:]]/!d; s/\r$//;' zpty -d : } else ZTST_unimplemented='the zsh/zpty module is not available' fi %test zpty_start zpty_input 'stty 38400 columns 80 rows 24 tabs -icanon -iexten' nl zpty_input 'rh_widget() { BUFFER="ls"; region_highlight+=( 0 4 "fg=#12569a" ); echo yes; }' nl zpty_input 'zle -N rh_widget' nl zpty_input 'bindkey "\C-a" rh_widget' nl zpty_input 'zle -la | grep rh_widget' nl zpty_input 'bindkey | grep rh_widget' nl zpty_input $'\C-a' zpty_stop 0:region_highlight *>*ls* %clean zmodload -ui zsh/zpty # vim:ft=zsh