-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Splitting out a comment from @mpilgrem, originally on #88:
The native consoles on Windows 10 are ANSI-capable, and there is no longer any version of Windows that has mainstream support by Microsoft that is not ANSI-capable, although ANSI-capability needs to be 'turned on' because of backwards compatibility with consoles on legacy Windows. I think GHCi and stack exec -- [command]
turns it on.
A little knowledge is a dangerous thing, but when I disabled fixEsc
in drawLineDiff
(in module System.Console.Haskeline.Backend.Win32
) as follows:
let fixEsc = id -- was: filter ((/= '\ESC') . baseChar)
in drawLineDiffWin (fixEsc xs1, fixEsc ys1) (fixEsc xs2, fixEsc ys2)
then haskeline
worked as expected. I tested it with:
module Main where
import System.Console.Haskeline
main :: IO ()
main = runInputT defaultSettings loop
where
prompt = "\ESC[34m\STXBlue\ESC[39m\STX\n\ESC[31m\STXRed\ESC[39m\STX: "
loop :: InputT IO ()
loop = do
minput <- getInputLine prompt
case minput of
Nothing -> pure ()
Just "quit" -> pure ()
Just input -> do outputStrLn $ "Input was: " ++ input
loop
simonmichael
Metadata
Metadata
Assignees
Labels
No labels