Browse Source

more POSIX

main
deicidus 2 years ago
parent
commit
842500974d
  1. 22
      spells/cantrips/fathom-cursor

22
spells/cantrips/fathom-cursor

@ -16,22 +16,12 @@ fathom_cursor() {
esac esac
done done
# Get the position of the cursor # Get the position of the cursor
printf "\033[6n"
# Save the current terminal state while IFS=';' read -r -d R ROW COL; do
old_state=$(stty -g) break
done
# Disable terminal echo and canonical mode position=$(printf "%s;%s" "${ROW#*[}" "${COL%%R*}")
stty -echo -icanon
# Request the cursor position
printf "\033[6n"
IFS='[;' read -r _ ROW COL
# Restore the terminal state
stty "$old_state"
position="$COL;$ROW"
if [ $x = true ] && [ $y = true ]; then if [ $x = true ] && [ $y = true ]; then
if [ $verbose = true ]; then if [ $verbose = true ]; then

Loading…
Cancel
Save