Use 

0x07 - BEL 
0x1b - ESC
Initialization of previous_char is BEL. Using ESC to end input.