Changeset 988cc5fc328c…
Parent a94de20ebd94…
by
Changes to 2 files · Browse files at 988cc5fc328c Showing diff from parent a94de20ebd94 Diff from another changeset...
@@ -376,6 +376,8 @@
def prepare_diff(self, difflines, offset, fname):
'''Borrowed from hgview; parses changeset diffs'''
+ import hglib
+ tw = hglib.gettabwidth(self.ui)
DIFFHDR = "=== %s ===\n"
idx = 0
outlines = []
@@ -405,16 +407,22 @@ continue
elif l.startswith("---"):
continue
+ elif l.startswith("@@"):
+ tag = "blue"
elif l.startswith("+"):
tag = "green"
stats[0] += 1
+ if tw:
+ l = l[0] + l[1:].expandtabs(tw)
elif l.startswith("-"):
stats[1] += 1
tag = "red"
- elif l.startswith("@@"):
- tag = "blue"
+ if tw:
+ l = l[0] + l[1:].expandtabs(tw)
else:
tag = "black"
+ if tw:
+ l = l[0] + l[1:].expandtabs(tw)
l = l+"\n"
length = len(l.decode('utf-8'))
addtag( tag, offset, length )
|
@@ -72,6 +72,16 @@ return ''
return p
+def gettabwidth(ui):
+ tabwidth = ui.config('tortoisehg', 'tabwidth')
+ try:
+ tabwidth = int(tabwidth)
+ if tabwidth < 1 or tabwidth > 16:
+ tabwidth = None
+ except (ValueError, TypeError), e:
+ tabwidth = None
+ return tabwidth
+
class GtkUi(ui.ui):
'''
|
Loading...