magmax/python-inquirer

Press arrow keys when handling the text input will crash on Windows platform

kentwelcome opened this issue · 1 comments

By running the example code on the Windows platform, it will crash when I press arrow keys (ex: ←, →, etc...).

import re

import inquirer
questions = [
  inquirer.Text('name', message="What's your name"),
  inquirer.Text('surname', message="What's your surname"),
  inquirer.Text('phone', message="What's your phone number",
                validate=lambda _, x: re.match('\+?\d[\d ]+\d', x),
                )
]
answers = inquirer.prompt(questions)

CleanShot 2022-07-22 at 11 38 42@2x

The crash point is this line, the variable pressed will be None on Windows platform.

Python-inquirer version: 2.9.2
Python Version: 3.9.12 64-bit
OS: Microsoft Windows [Version 10.0.17763.3165]

This is a issue with v3.0.5 of the readchar libary used by inquery. Should be fixed with the new version of readchar that was released yesterday. Please update readchar and test again