previously termcap/terminfo was checked even if the arrays were not set. now,
they are checked before doing anything. logic was also simplified.
# - often they are just wrappers for ncurses tput or other tools
# - they may not even exist on lightweight systems
# - provided scripts/binaries may be buggy or broken
# - often they are just wrappers for ncurses tput or other tools
# - they may not even exist on lightweight systems
# - provided scripts/binaries may be buggy or broken
- y=0
- for x (rs1 rs2 rs3) {
- [[ -v terminfo[$x] ]] || continue
- echoti $x
- y=1
+ y=1
+ if [[ -v terminfo ]] {
+ for x (rs1 rs2 rs3) {
+ [[ -v terminfo[$x] ]] || continue
+ echoti $x
+ y=0
+ }
+ if { (( y )) && -v termcap ]] } {
for x (rs r1 r2 r3) {
[[ -v termcap[$x] ]] || continue
echotc $x
for x (rs r1 r2 r3) {
[[ -v termcap[$x] ]] || continue
echotc $x
# fallback, send ECMA-48 clear
echo -en '\e[2J'
}
# fallback, send ECMA-48 clear
echo -en '\e[2J'
}