diff hgext3rd/topic/stack.py @ 4657:c24dabf8e848

stack: handle hash sizes when --debug flag is provided Since showstack() now uses fm.hexfunc() for node hashes, which depends on ui.debugflag, we should handle situations when hashes are full-sized as well.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 18 May 2019 16:56:47 +0800
parents dbf676c86244
children 89c1b739fabe
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Fri May 17 17:50:25 2019 +0800
+++ b/hgext3rd/topic/stack.py	Sat May 18 16:56:47 2019 +0800
@@ -358,9 +358,16 @@
         fm.data(isentry=isentry)
 
         if idx is None:
-            fm.plain('  ')
+            spacewidth = 0
             if ui.verbose:
-                fm.plain('              ')
+                # parentheses plus short node hash
+                spacewidth = 2 + 12
+            if ui.debugflag:
+                # parentheses plus full node hash
+                spacewidth = 2 + 40
+            # s# alias width
+            spacewidth += 2
+            fm.plain(' ' * spacewidth)
         else:
             fm.write('stack_index', '%s%%d' % prefix, idx,
                      label=labelsgen('topic.stack.index', states))