I have searched the solutions online, and found some useful information as follows:
Set ANSI Terminal Control enabled by default in Win10 according to Glenn Slayden's answer.
Set the prompt in the configuration files
ghci.confaccording to here and here
The following is my configuration:
:set prompt "\ESC[33mImported Modules: %s\n\ESC[34m\x03BB> \ESC[0m"
:set prompt-cont "\ESC[31m > \ESC[0m"
When loading ghci, it doesn't work (see the following screenshot)
It seems that only the first ASCII escape sequence \ESC[33m takes effect, and the remaining sequences are not rendered.
Next, I make the following changes according to the wiki:
:set prompt "\ESC[33m\STXImported Modules: %s\n\ESC[34m\STX\x03BB> \ESC[0m\STX"
:set prompt-cont "\ESC[31m\STX > \ESC[0m\STX"
It's better, but still seems only the first escape sequence works and other sequences are ignored.
This time I guess that the rendering of escape sequences is probably related to the escape char \n, so I add \n at the end of each sequence and remove the \STX as follows:
:set prompt "\ESC[33mImported Modules: %s\n\ESC[34m\x03BB> \ESC[0m\n"
:set prompt-cont "\ESC[31m > \ESC[0m\n"
Now it works as expected, but has to introduce some extra \n, which causes ugly layout.
Now I have no ideas why it needs some extra \n to render the escape sequences correctly in the GHCi prompt and how to solve this problem.
Thanks for any information!


