  while read -rsn1 input; do
    case "$input"
    in
      $'\x1B')  # ESC ASCII code (https://dirask.com/posts/ASCII-Table-pJ3Y0j)
      read -rsn1 -t 0.1 input
      if [ "$input" = "[" ]; then
          read -rsn1 -t 0.1 input
          case "$input"
          in
