@@ -52,6 +52,17 @@ colourise (IdrisColour c v u b i) str = setSGRCode sgr ++ str ++ setSGRCode [Res
5252 fg Nothing = []
5353 fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
5454
55+-- | Set the colour of a string using POSIX escape codes, with trailing '\STX' denoting the end
56+-- (required by Haskeline in the prompt string)
57+colouriseWithSTX :: IdrisColour -> String -> String
58+colouriseWithSTX (IdrisColour c v u b i) str = setSGRCode sgr ++ "\STX" ++ str ++ setSGRCode [Reset] ++ "\STX"
59+ where sgr = fg c ++
60+ (if u then [SetUnderlining SingleUnderline] else []) ++
61+ (if b then [SetConsoleIntensity BoldIntensity] else []) ++
62+ (if i then [SetItalicized True] else [])
63+ fg Nothing = []
64+ fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
65+
5566colouriseKwd :: ColourTheme -> String -> String
5667colouriseKwd t = colourise (keywordColour t)
5768
@@ -71,7 +82,7 @@ colouriseData :: ColourTheme -> String -> String
7182colouriseData t = colourise (dataColour t)
7283
7384colourisePrompt :: ColourTheme -> String -> String
74−colourisePrompt t = colourise (promptColour t)
85+colourisePrompt t = colouriseWithSTX (promptColour t)
7586
7687colouriseKeyword :: ColourTheme -> String -> String
7788colouriseKeyword t = colourise (keywordColour t)