summaryrefslogtreecommitdiff
path: root/src/compiler/GF/CompileOne.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-10-28 19:04:48 +0000
committerhallgren <hallgren@chalmers.se>2014-10-28 19:04:48 +0000
commit0519493ca936c8e555cfdf9178195418e342ff05 (patch)
tree6f9a8e31b43266591c160a945fd134c8f60b9bb3 /src/compiler/GF/CompileOne.hs
parente41d9e34bbb93a594b09fa390140149897a9112f (diff)
Use terminfo to highlight warnings and errors in blue and red
This replaces the hardwired ANSI escape codes that were accidentally included in a previous patch. This adds a dependency on terminfo, but this should be unproblematic, since haskeline already depends on the same underlying C library. The color highlighting is omitted on Windows.
Diffstat (limited to 'src/compiler/GF/CompileOne.hs')
-rw-r--r--src/compiler/GF/CompileOne.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/GF/CompileOne.hs b/src/compiler/GF/CompileOne.hs
index 6aac4011b..0a6572134 100644
--- a/src/compiler/GF/CompileOne.hs
+++ b/src/compiler/GF/CompileOne.hs
@@ -27,6 +27,7 @@ import GF.System.Directory(doesFileExist,getCurrentDirectory,renameFile)
import System.FilePath(makeRelative)
import qualified Data.Map as Map
import GF.Text.Pretty(render,(<+>),($$)) --Doc,
+import GF.System.Console(TermColors(..),getTermColors)
import Control.Monad((<=<))
type OneOutput = (Maybe FullPath,CompiledModule)
@@ -161,7 +162,8 @@ idump opts pass = intermOut opts (Dump pass) . ppModule Internal
warnOut opts warnings
| null warnings = done
- | otherwise = do ePutStr "\ESC[34m";ePutStr ws;ePutStrLn "\ESC[m"
+ | otherwise = do t <- getTermColors
+ ePutStr (blueFg t);ePutStr ws;ePutStrLn (restore t)
where
ws = if flag optVerbosity opts == Normal
then '\n':warnings