<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>I opened an issue on the Haskeline github
(<a class="moz-txt-link-freetext" href="https://github.com/judah/haskeline/issues/72">https://github.com/judah/haskeline/issues/72</a>).</p>
<p>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? <br>
(BTW, I found this on the wiki:
<a class="moz-txt-link-freetext" href="https://wiki.haskell.org/GHCi_in_colour">https://wiki.haskell.org/GHCi_in_colour</a>. Might be a good place to
put it, if linked.)<br>
</p>
<p>If you want to, here are my test cases rewritten as ghci prompts:</p>
<pre> -- 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 "
</pre>
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.<br>
<br>
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?<br>
<br>
Cheers.<br>
<br>
<div class="moz-cite-prefix">On 2017-12-07 23:15, cheater00
cheater00 wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CA+9GZUhrTFdpMU9A5JyLcpZDk3cyg4EYKEq6=z2TXdDMZ8cMWg@mail.gmail.com">
<p dir="ltr">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?</p>
<br>
<div class="gmail_quote">
<div dir="ltr">On Thu, 7 Dec 2017 23:11 MarLinn, <<a
href="mailto:monkleyon@gmail.com" moz-do-not-send="true">monkleyon@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> Here's what I use:<br>
><br>
> :set prompt "\ESC[46m\STX%s>\ESC[39;49m\STX "<br>
><br>
> I believe \STX is a signal to haskeline for control
sequences.<br>
> Documentation is here:<br>
> <a
href="https://github.com/judah/haskeline/wiki/ControlSequencesInPrompt"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://github.com/judah/haskeline/wiki/ControlSequencesInPrompt</a><br>
Note: If you're using a multi-line prompt, things may be
different<br>
again. I don't know what the rules are, but I found that if I
put \STX<br>
on any but the last line of prompts I get weird characters.
The same<br>
goes for any \SOH you might want to add for some reason.<br>
<br>
Cheers,<br>
MarLinn<br>
<br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>