customizing haskeline?

I tried to colorize a haskeline prompt by putting control characters in it, but line editing was hopelessly confused, presumably because haskeline doesn't understand control characters and thought the prompt was longer than it really was. From looking at Haskeline.promptedInput, it seems like there's no way to set the prompt to a higher level terminal operation since it's hardcoded to String, and there's no way to tell it how many displayed characters the prompt contains. So is there some way to have a fancy prompt that I'm missing? Has anyone done that successfully? This also implies it's impossible for haskeline to cooperate with cursor addressing in general. Or maybe it would be ok as long as I don't do anything fancy on the prompt line. But also seems like you can't set custom keybindings, e.g. bind a control key to a "history menu" like shells can do, which is my real goal here. I guess I'm interested if anyone has been able to use haskeline for anything more complicated than a prompt with the hardcoded default behaviour. My impression is that it's basically non-extensible, but maybe there's some hook I'm missing. By extension it seems impossible to colorize a ghci prompt, and indeed embedding control characters directly in :set prompty leads to the same problems.

On 13-04-14 10:22 PM, Evan Laforge wrote:
I tried to colorize a haskeline prompt by putting control characters in it, but line editing was hopelessly confused, presumably because haskeline doesn't understand control characters and thought the prompt was longer than it really was.
http://trac.haskell.org/haskeline/wiki/ControlSequencesInPrompt More broadly, http://trac.haskell.org/haskeline/wiki/WikiDocumentation
participants (2)
-
Albert Y. C. Lai
-
Evan Laforge