Improved the efficiency of DeletePrompt
Replaced EraseChars 1 with DeleteChar
Change core to use `State`
Restricted `handleKey` to be read-only