diff mercurial/ui.py @ 12689:c52c629ce19e

termwidth: move to ui.ui from util
author Augie Fackler <durin42@gmail.com>
date Sun, 10 Oct 2010 10:06:36 -0500
parents cf24b6b5517c
children ad2506f097d3
line wrap: on
line diff
--- a/mercurial/ui.py	Thu Oct 07 23:34:21 2010 -0500
+++ b/mercurial/ui.py	Sun Oct 10 10:06:36 2010 -0500
@@ -402,6 +402,16 @@
 
         return i
 
+    def termwidth(self):
+        '''how wide is the terminal in columns?
+        '''
+        if 'COLUMNS' in os.environ:
+            try:
+                return int(os.environ['COLUMNS'])
+            except ValueError:
+                pass
+        return util.termwidth()
+
     def formatted(self):
         '''should formatted output be used?