diff --git a/spells/cantrips/fathom-cursor b/spells/cantrips/fathom-cursor index 42ad24b..506827f 100755 --- a/spells/cantrips/fathom-cursor +++ b/spells/cantrips/fathom-cursor @@ -16,22 +16,12 @@ fathom_cursor() { esac done - # 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" - IFS='[;' read -r _ ROW COL - - # Restore the terminal state - stty "$old_state" - - position="$COL;$ROW" + # Get the position of the cursor + printf "\033[6n" + while IFS=';' read -r -d R ROW COL; do + break + done + position=$(printf "%s;%s" "${ROW#*[}" "${COL%%R*}") if [ $x = true ] && [ $y = true ]; then if [ $verbose = true ]; then