From 1e204d36c1fab9884f65618ccca019d8cd5f9386 Mon Sep 17 00:00:00 2001 From: kj-sh604 Date: Wed, 16 Jul 2025 22:10:52 -0400 Subject: refactor: update `zsh-fast-syntax-highlighting` plugin --- .../zsh-fast-syntax-highlighting/.fast-zts-read-all | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .config/shell/zsh-fast-syntax-highlighting/.fast-zts-read-all (limited to '.config/shell/zsh-fast-syntax-highlighting/.fast-zts-read-all') diff --git a/.config/shell/zsh-fast-syntax-highlighting/.fast-zts-read-all b/.config/shell/zsh-fast-syntax-highlighting/.fast-zts-read-all new file mode 100644 index 0000000..96c52ab --- /dev/null +++ b/.config/shell/zsh-fast-syntax-highlighting/.fast-zts-read-all @@ -0,0 +1,17 @@ +# $1 - file-descriptor to be read from +# $2 - name of output variable (default: REPLY) + +local __in_fd=${1:-0} __out_var=${2:-REPLY} +local -a __tmp +integer __ret=1 __repeat=10 __tmp_size=0 + +while sysread -s 65535 -i "$__in_fd" '__tmp[__tmp_size + 1]'; do + (( ( __ret=$? ) == 0 )) && (( ++ __tmp_size )) + (( __ret == 5 )) && { __ret=0; (( --__repeat == 0 )) && break; } +done + +: ${(P)__out_var::="${(j::)__tmp}"} + +return __ret + +# vim: ft=zsh:et:sw=4:sts=4 -- cgit v1.2.3