Browse Source

more POSIX

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

20
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
# Save the current terminal state
old_state=$(stty -g)
# Disable terminal echo and canonical mode
stty -echo -icanon
# Request the cursor position
printf "\033[6n" printf "\033[6n"
IFS='[;' read -r _ ROW COL while IFS=';' read -r -d R ROW COL; do
break
# Restore the terminal state done
stty "$old_state" position=$(printf "%s;%s" "${ROW#*[}" "${COL%%R*}")
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