scmutil: clarify that we explicitly do termwidth - 1 on Windows
authorYuya Nishihara <yuya@tcha.org>
Thu, 20 Oct 2016 22:57:12 +0900
changeset 30313 392633d7860e
parent 30312 1ad1c5017043
child 30314 365812902904
scmutil: clarify that we explicitly do termwidth - 1 on Windows I was a bit confused since we didn't add 1 to the width, which is different from the example shown in StackOverflow. http://stackoverflow.com/a/12642749
mercurial/win32.py
--- a/mercurial/win32.py	Thu Oct 20 21:57:32 2016 +0900
+++ b/mercurial/win32.py	Thu Oct 20 22:57:12 2016 +0900
@@ -352,7 +352,7 @@
     # counted in the line length. On 80 columns consoles, if 80
     # characters are written, the following CR won't apply on the
     # current line but on the new one. Keep room for it.
-    width = 79
+    width = 80 - 1
     # Query stderr to avoid problems with redirections
     screenbuf = _kernel32.GetStdHandle(
                   _STD_ERROR_HANDLE) # don't close the handle returned
@@ -362,7 +362,7 @@
     if not _kernel32.GetConsoleScreenBufferInfo(
                         screenbuf, ctypes.byref(csbi)):
         return width
-    width = csbi.srWindow.Right - csbi.srWindow.Left
+    width = csbi.srWindow.Right - csbi.srWindow.Left  # don't '+ 1'
     return width
 
 def _1stchild(pid):