idris-lang/Idris-dev — pull request #1746 by soimort (2014-11-21 20:43:12+00:00)
Title: Indicate the end of each escape sequence in the prompt string

Fixes #1744.
In Idris' REPL, when input is about to reach the end of screen (or exceeds to the next line), Home was not working properly.

![0](https://cloud.githubusercontent.com/assets/342945/5149101/a3bbb424-71c5-11e4-96e1-656d5be5d5f4.gif)

This is because Haskeline expects all ANSI escape sequences in the prompt string end with an explicit `'\STX'`, since there's no way for Haskeline to detect this automatically. (as explained [here](http://trac.haskell.org/haskeline/wiki/ControlSequencesInPrompt))

Therefore, instead of something like
```idris
x <- H.catch (getInputLine "\ESC[1mIdris>\ESC[0m ")
(ctrlC (return Nothing))
```

We need some extra `\STX` (in the prompt string only) to get Haskeline working right:
```idris
x <- H.catch (getInputLine "\ESC[1m\STXIdris>\ESC[0m\STX ")
(ctrlC (return Nothing))
```