summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2015-07-10 00:48:11 +0200
committerdef <dennis@felsin9.de>2015-07-10 00:48:11 +0200
commitdb5f8d6755031444143d514e424e4efa7e36da28 (patch)
tree8d58ebbbf69ccd7395acd7440cd02c1321a88bd6 /compiler
parent7d1a58224ef250dd38a84bda94026120e60767eb (diff)
downloadNim-db5f8d6755031444143d514e424e4efa7e36da28.tar.gz
Reset terminal colors before running compiled program
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main.nim1
-rw-r--r--compiler/msgs.nim5
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index ee4a34fbb..47fae7fa7 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -378,3 +378,4 @@ proc mainCommand* =
   when SimulateCaasMemReset:
     resetMemory()
 
+  resetAttributes()
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index f1d1029e4..e6bc45da6 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -865,6 +865,11 @@ proc rawMessage*(msg: TMsgKind, args: openArray[string]) =
 proc rawMessage*(msg: TMsgKind, arg: string) =
   rawMessage(msg, [arg])
 
+proc resetAttributes* =
+  if optUseColors in gGlobalOptions:
+    terminal.resetAttributes()
+    stdout.flushFile()
+
 proc writeSurroundingSrc(info: TLineInfo) =
   const indent = "  "
   msgWriteln(indent & $info.sourceLine)