[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lynx-dev] "Correct" tab-stops?
From: |
Bela Lubkin |
Subject: |
Re: [Lynx-dev] "Correct" tab-stops? |
Date: |
Tue, 23 Jul 2019 16:47:03 -0700 |
Thomas Dickey wrote:
> By the way, Bela's assumptions do not work for "all" VT100-wannabe's
> (e.g., KDE konsole), as discussed here:
>
> https://lists.gnu.org/archive/html/bug-ncurses/2019-05/msg00030.html
>
> But that's a bug report for someone else...
I don't actually see how that ncurses post relates directly to my
script.
But, I also see that my script has some SCO ANSI sequences which can't
be expected to do what I intended anywhere but an SCO OpenServer
console!
Updated version below.
>Bela<
========================================================================
#!/bin/sh
# ^ any POSIX shell, but not really old pre-POSIX Bourne sh
row_of()
{
width=$1
column=1
while [ $column -le $columns ]; do
printf %s "$2"
column=$((column + width))
done
printf "\b\b\b\b$CR\n"
}
columns=${1:-${COLUMNS:-$(stty -a </dev/tty | sed -n 's/.*columns[
=]*\([0-9]*\).*/\1/p')}}
CR=$(printf "\r")
TAB=$(printf "\t")
ESC=$(printf "\033")
CSI="${ESC}["
CSIS="$CSI="
# CSIS 3L = SCO ANSI 'Set Emulation Feature' 3 'Enable iBCS2 compliance'
# -- on SCO OpenServer, this is required to enable CAT
if [ SCO_SV = "$(uname -s 2>&1)" ]; then
SCOiBCS2="${CSIS}3L"
else
SCOiBCS2=
fi
# CSI 3g = CAT (Clear All Tabs)
CAT="${SCOiBCS2}${CSI}3g"
printf "BEFORE v$CR\n"; row_of 8 "T$TAB"
printf "$CAT$CR"; row_of 8 "${ESC}H+ "
row_of 8 "T$TAB"
printf "AFTER ^\n"