-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Description
I have this little routine and all I am getting is one character, 0x1b, when an arrow key is pressed:
keypress = readchar.readkey()
if keypress == readchar.key.UP:
print("YEA! UP ARROW")
if keypress == readchar.key.BACKSPACE:
self.input_buff = self.input_buff[:-1]
print("\033[0A%s " % self.input_buff)
continue
if keypress != readchar.key.CR and len(keypress) < 2:
self.input_buff = "%s%s" % (self.input_buff, keypress)
if self.input_buff[0:1] == '/': # / commands receive special magenta coloring
print("%s\033[0A\033[35m%s\033[0m" % (self.cursor, self.input_buff))
else:
print("%s\033[0A%s" % (self.cursor, self.input_buff))
continue
consoleinput = "%s" % self.input_buff
self.input_buff = ""
Everything works famously (THANKS :) ), except this part:
if keypress == readchar.key.UP:
print("YEA! UP ARROW")
I'm sure it is because it is not reading arrow sequences...
Metadata
Metadata
Assignees
Labels
No labels