]> git.phdru.name Git - dotfiles.git/blobdiff - lib/python/init.py
lib/python/init.py: colorize stdout from displayhook
[dotfiles.git] / lib / python / init.py
index 1313c500d7b00518e14a6bf40e7ee5149a24f526..4b8192fba9dfa828ec594955f9046d3b9750f4bd 100644 (file)
@@ -43,15 +43,14 @@ def init():
                 pass  # No such file
 
             def savehist():
-                histfilesize = os.environ.get('HISTFILESIZE') \
-                    or os.environ.get('HISTSIZE')
-                if histfilesize:
+                histsize = os.environ.get('HISTSIZE')
+                if histsize:
                     try:
-                        histfilesize = int(histfilesize)
+                        histsize = int(histsize)
                     except ValueError:
                         pass
                     else:
-                        readline.set_history_length(histfilesize)
+                        readline.set_history_length(histsize)
                 readline.write_history_file(histfile)
 
             import atexit
@@ -139,7 +138,9 @@ def init():
             self.stdin.write(value)
 
         def pprint(self, value):
-            pprint(value, stream=self.stdin)
+            pprint(value,
+                   stream=ColoredFile(self.stdin,
+                                      '\033[1;3%sm' % stdout_color))
 
         def close(self):
             self.stdin.close()