Commits

Steve Borho committed b105ad0

status: expand tabs to spaces in status and commit dialogs

Comments (0)

Files changed (1)

 from mercurial import merge as merge_
 from hgext import extdiff
 from shlib import shell_notify
-from hglib import toutf, rootpath
+from hglib import toutf, rootpath, gettabwidth
 from gdialog import *
 from dialog import entry_dialog
 
         else:
             self._setting_pos = 64000
             self._setting_lastpos = 270
+        self.tabwidth = gettabwidth(self.ui)
+
 
 
     def get_body(self):
                 if line.startswith('---') or line.startswith('+++'):
                     buffer.insert_with_tags_by_name(iter, line, 'header')
                 elif line.startswith('-'):
+                    if self.tabwidth:
+                        line = line[0] + line[1:].expandtabs(self.tabwidth)
                     buffer.insert_with_tags_by_name(iter, line, 'removed')
                 elif line.startswith('+'):
+                    if self.tabwidth:
+                        line = line[0] + line[1:].expandtabs(self.tabwidth)
                     buffer.insert_with_tags_by_name(iter, line, 'added')
                 elif line.startswith('@@'):
                     buffer.insert_with_tags_by_name(iter, line, 'position')
                 else:
+                    if self.tabwidth:
+                        line = line[0] + line[1:].expandtabs(self.tabwidth)
                     buffer.insert(iter, line)
 
             self.diff_text.set_buffer(buffer)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.