2019-12-09 16:31:47 +00:00
|
|
|
|
NEW
|
|
|
|
|
PREFIX
|
|
|
|
|
AUTO 4,1
|
2020-06-20 16:24:05 +00:00
|
|
|
|
#!/bin/sh
|
2019-12-09 16:31:47 +00:00
|
|
|
|
# This script tests various cursor related commands
|
|
|
|
|
# Clear Screen Function
|
|
|
|
|
FUNCTION CS {
|
|
|
|
|
ECHO \f
|
|
|
|
|
}
|
|
|
|
|
# Title Box Function
|
|
|
|
|
# CALL TBOX Str_Title
|
|
|
|
|
FUNCTION TBOX {
|
|
|
|
|
ECHO -N "\e[1;20H"
|
|
|
|
|
ECHO "\e[7m \e[0m"
|
|
|
|
|
SET LINE = 2
|
|
|
|
|
WHILE [ $LINE -NE 5 ]
|
|
|
|
|
ECHO -N "\e[${LINE};20H"
|
|
|
|
|
ECHO "\e[7m \e[0m \e[7m \e[0m"
|
|
|
|
|
SET LINE = $LINE + 1
|
|
|
|
|
LOOP
|
|
|
|
|
ECHO -N "\e[5;20H"
|
|
|
|
|
ECHO "\e[7m \e[0m"
|
|
|
|
|
ECHO -N "\e[3;22H $1"
|
|
|
|
|
}
|
|
|
|
|
# Print Inverse
|
|
|
|
|
FUNCTION INVERSE {
|
|
|
|
|
ECHO -N "\e[7m$1\e[0m"
|
|
|
|
|
}
|
|
|
|
|
# Print at Screen Location Function
|
|
|
|
|
# CALL PRINTXY Num_Row Num_Column Str_String
|
|
|
|
|
FUNCTION PRINTXY {
|
|
|
|
|
ECHO -N "\e[$1;$2H$3"
|
|
|
|
|
}
|
|
|
|
|
# Print Inverse At X Y
|
|
|
|
|
# CALL INVERSEXY Row Col String
|
|
|
|
|
FUNCTION INVERSEXY {
|
|
|
|
|
ECHO -N "\e[$1;$2H\e[7m$3\e[0m"
|
|
|
|
|
}
|
|
|
|
|
# STATUSLINE Function
|
|
|
|
|
# CALL STATUSLINE Str_Message
|
|
|
|
|
FUNCTION STATUSLINE {
|
|
|
|
|
ECHO -N "\e[24;0H\e[7m "
|
|
|
|
|
ECHO -N " \e[0m"
|
|
|
|
|
ECHO -N "\e[24;2H\e[7m$1\e[0m"
|
|
|
|
|
ECHO -N "\e[24;68H\e[7m"
|
|
|
|
|
TIME | CUT -M 10 -N 20
|
|
|
|
|
# SET DTIME = `TIME | CUT -M 10 -N 20`: ECHO -N ${DTIME}
|
|
|
|
|
ECHO -N "\e[0m"
|
|
|
|
|
}
|
|
|
|
|
# YesNoKeyPress Function
|
|
|
|
|
# CALL YNKP Returns 1(Y) or 0 (N)
|
|
|
|
|
FUNCTION YNKP {
|
|
|
|
|
ECHO Not yet implemented
|
|
|
|
|
}
|
|
|
|
|
# Get String At X Y Function
|
|
|
|
|
# CALL GETXY Num_Row Num_Column Num_Length
|
|
|
|
|
FUNCTION GETXY {
|
|
|
|
|
ECHO Not yet implemented
|
|
|
|
|
}
|
|
|
|
|
# Save Cursor Position
|
|
|
|
|
FUNCTION SAVECURSOR
|
|
|
|
|
{
|
|
|
|
|
ECHO -N "\e7"
|
|
|
|
|
}
|
|
|
|
|
# Restore Cursor Position
|
|
|
|
|
FUNCTION RESTORECURSOR
|
|
|
|
|
{
|
|
|
|
|
ECHO -N "\e8"
|
|
|
|
|
}
|
|
|
|
|
CALL CS
|
|
|
|
|
CALL TBOX " Cursor Tests"
|
|
|
|
|
CALL PRINTXY 10 10 "Before Save:"
|
|
|
|
|
CALL SAVECURSOR
|
|
|
|
|
CALL PRINTXY 15 20 "Randowm line at 15 20"
|
|
|
|
|
CALL RESTORECURSOR
|
|
|
|
|
ECHO "After Save"
|
|
|
|
|
CALL PRINTXY 20 1 "Exiting"
|
|
|
|
|
ECHO
|
|
|
|
|
MAN
|
|
|
|
|
TEXT /MAKE/USR/SHARE/TESTS/CURSORTEST
|