# HG changeset patch
# User Steve Borho <[email protected]>
# Date 1230873767 21600
# Branch hg-crew-tip
# Node ID 400ed0112bcc568c5495026253adac92db0b947c
# Parent  423eec09141056aaa91a981cf731b5acc827b3e5
changeset: make tabwidth user configurable

Seems to mostly work, gtk.TextView is obviously not the best widget to use to 
show
source diffs.  We may want to investigate importing GtkSourceView.  Tabs in 
diffs
are often 'off-by-one' because of the leading character header on each line.  
This
doesn't appear to be easily fixable (the console has the same problem).  Just 
another
reason not to use tabs in your source code.

diff --git a/hggtk/changeset.py b/hggtk/changeset.py
--- a/hggtk/changeset.py
+++ b/hggtk/changeset.py
@@ -490,6 +490,19 @@
         details_text.set_wrap_mode(gtk.WRAP_NONE)
         details_text.set_editable(False)
         details_text.modify_font(pango.FontDescription(self.fontcomment))
+        width = self.ui.config('tortoisehg', 'tabwidth')
+        try:
+            width = int(width)
+            if width > 1 and width <= 16:
+                font = details_text.get_style().font_desc
+                fontsize = font.get_size()/1024
+                tabs = pango.TabArray(0, True)
+                for i in range(0, 64):
+                    at = width * i * fontsize
+                    tabs.set_tab(i, pango.TAB_LEFT, at)
+                details_text.set_tabs( tabs )
+        except:
+            pass
         scroller.add(details_text)
 
         self._buffer = gtk.TextBuffer()

------------------------------------------------------------------------------
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to