Skip to content

Instantly share code, notes, and snippets.

@christianparpart
Created September 14, 2019 23:03
Show Gist options
  • Save christianparpart/332de3b83021a38d88fb5758130cc123 to your computer and use it in GitHub Desktop.
Save christianparpart/332de3b83021a38d88fb5758130cc123 to your computer and use it in GitHub Desktop.
VT vertical scrolling test
#! /bin/bash
LINES=${LINES:-${1}}
echo -ne "\033[2J" # clear screen
echo -ne "\033[H" # cursor to home
# fill lines with known pattern (numbers from 1 upwards)
for i in `seq 1 ${LINES}`; do
echo -n "$i ..."
if [[ $i -lt ${LINES} ]]; then
echo
fi
done
echo -ne "\033[5;15r" # set vertical-scroll margin between 5..15
echo -ne "\033[15;1H" # move cursor to bottom (left) margin
# slowly scroll upwards
for i in `seq 1 5`; do
sleep 1
echo -ne "I'm at that line (15;1) for the ${i}. time.\r\n"
done
echo -ne "\033[1;${LINES}r" # reset vertical margin
echo -ne "\033[${LINES};1H" # move cursor to bottom left
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment