@@ -52,6 +52,17 @@ colourise (IdrisColour c v u b i) str = setSGRCode sgr ++ str ++ setSGRCode [Res
52 fg Nothing = []
52 fg Nothing = []
53 fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
53 fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
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"
60+ (if u then [SetUnderlining SingleUnderline] else []) ++
61+ (if b then [SetConsoleIntensity BoldIntensity] else []) ++
62+ (if i then [SetItalicized True] else [])
64+ fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
55colouriseKwd :: ColourTheme -> String -> String
66colouriseKwd :: ColourTheme -> String -> String
56colouriseKwd t = colourise (keywordColour t)
67colouriseKwd t = colourise (keywordColour t)
@@ -71,7 +82,7 @@ colouriseData :: ColourTheme -> String -> String
71colouriseData t = colourise (dataColour t)
82colouriseData t = colourise (dataColour t)
73colourisePrompt :: ColourTheme -> String -> String
84colourisePrompt :: ColourTheme -> String -> String
74−colourisePrompt t = colourise (promptColour t)
85+colourisePrompt t = colouriseWithSTX (promptColour t)
76colouriseKeyword :: ColourTheme -> String -> String
87colouriseKeyword :: ColourTheme -> String -> String
77colouriseKeyword t = colourise (keywordColour t)
88colouriseKeyword t = colourise (keywordColour t)