I opened an issue on the Haskeline github (https://github.com/judah/haskeline/issues/72).

But it seems to be completely Haskeline-side, so I'm not sure if it's worth re-opening the one for ghci? As missing documentation maybe? (BTW, I found this on the wiki: https://wiki.haskell.org/GHCi_in_colour. Might be a good place to put it, if linked.)

If you want to, here are my test cases rewritten as ghci prompts:

    -- single line, positioning error
    :set prompt " \ESC[36m%\ESC[0m "
    -- single line, works
    :set prompt " \ESC[36m\STX%\ESC[0m\STX "
    -- multiline, bad output
    :set prompt "\ESC[32m\STX–––\ESC[0m\STX\n \ESC[36m\STX%\ESC[0m\STX "
    -- multiline, works but is inconsistent
    :set prompt "\ESC[32m–––\ESC[0m\n \ESC[36m\STX%\ESC[0m\STX "

In my tests, the positioning errors consistently happen if there are any "unclosed" escape-sequences on the last line of the prompt, regardless of its length. Escape sequences on previous lines consistently create "weird characters", but don't influence the positioning. Also regardless of their lengths. That makes sense, as both sets of lines seem to be handled quite differently.

Are multiline prompts even used by a lot of people? I like mine because it gives me a both a list of modules and a consistent cursor position. But maybe I'm the exception?

Cheers.

On 2017-12-07 23:15, cheater00 cheater00 wrote:

Interesting. Would you mind reopening the issue and providing a buggy example? Amd alerting haskeline maintainers? How does it work on a 1 line prompt that is so long it wraps?


On Thu, 7 Dec 2017 23:11 MarLinn, <monkle...@gmail.com <mailto:monkle...@gmail.com>> wrote:


    > Here's what I use:
    >
    > :set prompt "\ESC[46m\STX%s>\ESC[39;49m\STX "
    >
    > I believe \STX is a signal to haskeline for control sequences.
    > Documentation is here:
    > https://github.com/judah/haskeline/wiki/ControlSequencesInPrompt
    Note: If you're using a multi-line prompt, things may be different
    again. I don't know what the rules are, but I found that if I put \STX
    on any but the last line of prompts I get weird characters. The same
    goes for any \SOH you might want to add for some reason.

    Cheers,
    MarLinn


_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to