Optimized the various diff panes by using QPlainTextEdit.

Mon, 12 Oct 2020 17:39:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 12 Oct 2020 17:39:45 +0200
changeset 7779
757334671130
parent 7778
eb01ab7aeb06
child 7780
41420f82c0ac

Optimized the various diff panes by using QPlainTextEdit.

eric6/APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric6/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
eric6/Documentation/Source/eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html file | annotate | diff | comparison | revisions
eric6/Documentation/Source/index-eric6.html file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffGenerator.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.ui file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py file | annotate | diff | comparison | revisions
eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.ui file | annotate | diff | comparison | revisions
eric6/UI/DiffDialog.py file | annotate | diff | comparison | revisions
eric6/UI/DiffDialog.ui file | annotate | diff | comparison | revisions
--- a/eric6/APIs/Python3/eric6.api	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/APIs/Python3/eric6.api	Mon Oct 12 17:39:45 2020 +0200
@@ -11711,8 +11711,6 @@
 eric6.eric6_post_install.main?4()
 eric6.eric6_post_install.windowsDesktopEntries?4()
 eric6.eric6_post_install.windowsProgramsEntry?4()
-eric6.eric6_qregexp.createMainWidget?4(argv)
-eric6.eric6_qregexp.main?4()
 eric6.eric6_qregularexpression.createMainWidget?4(argv)
 eric6.eric6_qregularexpression.main?4()
 eric6.eric6_re.createMainWidget?4(argv)
Binary file eric6/Documentation/Help/source.qch has changed
--- a/eric6/Documentation/Help/source.qhp	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Documentation/Help/source.qhp	Mon Oct 12 17:39:45 2020 +0200
@@ -1333,7 +1333,6 @@
           <section title="eric6.eric6_pluginrepository" ref="eric6.eric6_pluginrepository.html" />
           <section title="eric6.eric6_pluginuninstall" ref="eric6.eric6_pluginuninstall.html" />
           <section title="eric6.eric6_post_install" ref="eric6.eric6_post_install.html" />
-          <section title="eric6.eric6_qregexp" ref="eric6.eric6_qregexp.html" />
           <section title="eric6.eric6_qregularexpression" ref="eric6.eric6_qregularexpression.html" />
           <section title="eric6.eric6_re" ref="eric6.eric6_re.html" />
           <section title="eric6.eric6_shell" ref="eric6.eric6_shell.html" />
@@ -7513,7 +7512,6 @@
       <keyword name="HgDiffGenerator.__finish" id="HgDiffGenerator.__finish" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.__finish" />
       <keyword name="HgDiffGenerator.__getVersionArg" id="HgDiffGenerator.__getVersionArg" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.__getVersionArg" />
       <keyword name="HgDiffGenerator.__processFileLine" id="HgDiffGenerator.__processFileLine" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.__processFileLine" />
-      <keyword name="HgDiffGenerator.__processOutputLine" id="HgDiffGenerator.__processOutputLine" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.__processOutputLine" />
       <keyword name="HgDiffGenerator.getResult" id="HgDiffGenerator.getResult" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.getResult" />
       <keyword name="HgDiffGenerator.start" id="HgDiffGenerator.start" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.start" />
       <keyword name="HgDiffGenerator.stopProcess" id="HgDiffGenerator.stopProcess" ref="eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html#HgDiffGenerator.stopProcess" />
@@ -17176,7 +17174,6 @@
       <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_plugininstall.html#createMainWidget" />
       <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_pluginrepository.html#createMainWidget" />
       <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_pluginuninstall.html#createMainWidget" />
-      <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_qregexp.html#createMainWidget" />
       <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_qregularexpression.html#createMainWidget" />
       <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_re.html#createMainWidget" />
       <keyword name="createMainWidget" id="createMainWidget" ref="eric6.eric6_shell.html#createMainWidget" />
@@ -17245,7 +17242,6 @@
       <keyword name="eric6_pluginrepository (Module)" id="eric6_pluginrepository (Module)" ref="eric6.eric6_pluginrepository.html" />
       <keyword name="eric6_pluginuninstall (Module)" id="eric6_pluginuninstall (Module)" ref="eric6.eric6_pluginuninstall.html" />
       <keyword name="eric6_post_install (Module)" id="eric6_post_install (Module)" ref="eric6.eric6_post_install.html" />
-      <keyword name="eric6_qregexp (Module)" id="eric6_qregexp (Module)" ref="eric6.eric6_qregexp.html" />
       <keyword name="eric6_qregularexpression (Module)" id="eric6_qregularexpression (Module)" ref="eric6.eric6_qregularexpression.html" />
       <keyword name="eric6_re (Module)" id="eric6_re (Module)" ref="eric6.eric6_re.html" />
       <keyword name="eric6_shell (Module)" id="eric6_shell (Module)" ref="eric6.eric6_shell.html" />
@@ -17639,7 +17635,6 @@
       <keyword name="main" id="main" ref="eric6.eric6_pluginrepository.html#main" />
       <keyword name="main" id="main" ref="eric6.eric6_pluginuninstall.html#main" />
       <keyword name="main" id="main" ref="eric6.eric6_post_install.html#main" />
-      <keyword name="main" id="main" ref="eric6.eric6_qregexp.html#main" />
       <keyword name="main" id="main" ref="eric6.eric6_qregularexpression.html#main" />
       <keyword name="main" id="main" ref="eric6.eric6_re.html#main" />
       <keyword name="main" id="main" ref="eric6.eric6_shell.html#main" />
--- a/eric6/Documentation/Source/eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Documentation/Source/eric6.Plugins.VcsPlugins.vcsMercurial.HgDiffGenerator.html	Mon Oct 12 17:39:45 2020 +0200
@@ -97,10 +97,6 @@
 <td>Private slot to process a line giving the old/new file.</td>
 </tr>
 <tr>
-<td><a href="#HgDiffGenerator.__processOutputLine">__processOutputLine</a></td>
-<td>Private method to process the lines of output.</td>
-</tr>
-<tr>
 <td><a href="#HgDiffGenerator.getResult">getResult</a></td>
 <td>Public method to return the result data.</td>
 </tr>
@@ -187,30 +183,20 @@
 </dl>
 <a NAME="HgDiffGenerator.__processFileLine" ID="HgDiffGenerator.__processFileLine"></a>
 <h4>HgDiffGenerator.__processFileLine</h4>
-<b>__processFileLine</b>(<i>line</i>)
+<b>__processFileLine</b>(<i>lineno, line</i>)
 
 <p>
         Private slot to process a line giving the old/new file.
 </p>
 <dl>
 
-<dt><i>line</i></dt>
+<dt><i>lineno</i> (int)</dt>
 <dd>
-line to be processed (string)
+line number of line to be processed
 </dd>
-</dl>
-<a NAME="HgDiffGenerator.__processOutputLine" ID="HgDiffGenerator.__processOutputLine"></a>
-<h4>HgDiffGenerator.__processOutputLine</h4>
-<b>__processOutputLine</b>(<i>line</i>)
-
-<p>
-        Private method to process the lines of output.
-</p>
-<dl>
-
-<dt><i>line</i></dt>
+<dt><i>line</i> (str)</dt>
 <dd>
-output line to be processed (string)
+line to be processed
 </dd>
 </dl>
 <a NAME="HgDiffGenerator.getResult" ID="HgDiffGenerator.getResult"></a>
--- a/eric6/Documentation/Source/index-eric6.html	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Documentation/Source/index-eric6.html	Mon Oct 12 17:39:45 2020 +0200
@@ -242,10 +242,6 @@
 <td>Module implemenzing the post install logic for 'pip install'.</td>
 </tr>
 <tr>
-<td><a href="eric6.eric6_qregexp.html">eric6_qregexp</a></td>
-<td>Eric6 QRegExp.</td>
-</tr>
-<tr>
 <td><a href="eric6.eric6_qregularexpression.html">eric6_qregularexpression</a></td>
 <td>Eric6 QRegularExpression.</td>
 </tr>
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -8,7 +8,6 @@
 process.
 """
 
-
 from PyQt5.QtCore import pyqtSlot, QFileInfo, Qt
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import QWidget, QDialogButtonBox
@@ -76,10 +75,8 @@
         self.vcs = vcs
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.contents.setFontFamily(font.family())
-        self.contents.setFontPointSize(font.pointSize())
-        self.contents2.setFontFamily(font.family())
-        self.contents2.setFontPointSize(font.pointSize())
+        self.contents.document().setDefaultFont(font)
+        self.contents2.document().setDefaultFont(font)
         
         self.highlighter = GitDiffHighlighter(self.contents.document())
         self.highlighter2 = GitDiffHighlighter(self.contents2.document())
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -34,12 +34,12 @@
         <property name="orientation">
          <enum>Qt::Vertical</enum>
         </property>
-        <widget class="QTextEdit" name="contents">
+        <widget class="QPlainTextEdit" name="contents">
          <property name="whatsThis">
           <string>&lt;b&gt;Git Diff&lt;/b&gt;&lt;p&gt;This shows the output of the git diff command.&lt;/p&gt;</string>
          </property>
          <property name="lineWrapMode">
-          <enum>QTextEdit::NoWrap</enum>
+          <enum>QPlainTextEdit::NoWrap</enum>
          </property>
          <property name="readOnly">
           <bool>true</bool>
@@ -47,16 +47,13 @@
          <property name="tabStopWidth">
           <number>8</number>
          </property>
-         <property name="acceptRichText">
-          <bool>false</bool>
-         </property>
         </widget>
-        <widget class="QTextEdit" name="contents2">
+        <widget class="QPlainTextEdit" name="contents2">
          <property name="whatsThis">
           <string>&lt;b&gt;Git Diff&lt;/b&gt;&lt;p&gt;This shows the output of the git diff command (stage to repo) if the dialog was asked to show separate diffs.&lt;/p&gt;</string>
          </property>
          <property name="lineWrapMode">
-          <enum>QTextEdit::NoWrap</enum>
+          <enum>QPlainTextEdit::NoWrap</enum>
          </property>
          <property name="readOnly">
           <bool>true</bool>
@@ -64,9 +61,6 @@
          <property name="tabStopWidth">
           <number>8</number>
          </property>
-         <property name="acceptRichText">
-          <bool>false</bool>
-         </property>
         </widget>
        </widget>
       </item>
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitDiffGenerator.py	Mon Oct 12 17:39:45 2020 +0200
@@ -8,7 +8,6 @@
 process.
 """
 
-
 import os
 
 from PyQt5.QtCore import pyqtSignal, QProcess, QTimer, QObject
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -117,8 +117,7 @@
         self.__logTreeHasDarkBackground = e5App().usesDarkPalette()
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.diffEdit.setFontFamily(font.family())
-        self.diffEdit.setFontPointSize(font.pointSize())
+        self.diffEdit.document().setDefaultFont(font)
         
         self.diffHighlighter = GitDiffHighlighter(self.diffEdit.document())
         self.__diffGenerator = GitDiffGenerator(vcs, self)
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitLogBrowserDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -148,7 +148,7 @@
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <widget class="QWidget" name="">
+     <widget class="QWidget" name="layoutWidget">
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <widget class="QTreeWidget" name="logTree">
@@ -466,24 +466,21 @@
           </layout>
          </item>
          <item>
-          <widget class="QTextEdit" name="diffEdit">
+          <widget class="QPlainTextEdit" name="diffEdit">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
              <horstretch>7</horstretch>
              <verstretch>2</verstretch>
             </sizepolicy>
            </property>
-           <property name="tabChangesFocus">
-            <bool>true</bool>
-           </property>
            <property name="lineWrapMode">
-            <enum>QTextEdit::NoWrap</enum>
+            <enum>QPlainTextEdit::NoWrap</enum>
            </property>
            <property name="readOnly">
             <bool>true</bool>
            </property>
-           <property name="acceptRichText">
-            <bool>false</bool>
+           <property name="tabStopWidth">
+            <number>8</number>
            </property>
           </widget>
          </item>
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -8,7 +8,6 @@
 process.
 """
 
-
 import os
 import tempfile
 
@@ -90,10 +89,8 @@
             self.__pathColumn, Qt.AscendingOrder)
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.lDiffEdit.setFontFamily(font.family())
-        self.lDiffEdit.setFontPointSize(font.pointSize())
-        self.rDiffEdit.setFontFamily(font.family())
-        self.rDiffEdit.setFontPointSize(font.pointSize())
+        self.lDiffEdit.document().setDefaultFont(font)
+        self.rDiffEdit.document().setDefaultFont(font)
         self.lDiffEdit.customContextMenuRequested.connect(
             self.__showLDiffContextMenu)
         self.rDiffEdit.customContextMenuRequested.connect(
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -157,7 +157,7 @@
          </widget>
         </item>
         <item>
-         <widget class="QTextEdit" name="lDiffEdit">
+         <widget class="QPlainTextEdit" name="lDiffEdit">
           <property name="sizePolicy">
            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
             <horstretch>0</horstretch>
@@ -167,17 +167,14 @@
           <property name="contextMenuPolicy">
            <enum>Qt::CustomContextMenu</enum>
           </property>
-          <property name="tabChangesFocus">
-           <bool>true</bool>
-          </property>
           <property name="lineWrapMode">
-           <enum>QTextEdit::NoWrap</enum>
+           <enum>QPlainTextEdit::NoWrap</enum>
           </property>
           <property name="readOnly">
            <bool>true</bool>
           </property>
-          <property name="acceptRichText">
-           <bool>false</bool>
+          <property name="tabStopWidth">
+           <number>8</number>
           </property>
          </widget>
         </item>
@@ -211,7 +208,7 @@
          </widget>
         </item>
         <item>
-         <widget class="QTextEdit" name="rDiffEdit">
+         <widget class="QPlainTextEdit" name="rDiffEdit">
           <property name="sizePolicy">
            <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
             <horstretch>0</horstretch>
@@ -221,17 +218,14 @@
           <property name="contextMenuPolicy">
            <enum>Qt::CustomContextMenu</enum>
           </property>
-          <property name="tabChangesFocus">
-           <bool>true</bool>
-          </property>
           <property name="lineWrapMode">
-           <enum>QTextEdit::NoWrap</enum>
+           <enum>QPlainTextEdit::NoWrap</enum>
           </property>
           <property name="readOnly">
            <bool>true</bool>
           </property>
-          <property name="acceptRichText">
-           <bool>false</bool>
+          <property name="tabStopWidth">
+           <number>8</number>
           </property>
          </widget>
         </item>
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -7,7 +7,6 @@
 Module implementing a dialog to show the output of the hg diff command process.
 """
 
-
 from PyQt5.QtCore import pyqtSlot, QFileInfo, Qt
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import QWidget, QDialogButtonBox
@@ -51,8 +50,7 @@
         self.vcs = vcs
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.contents.setFontFamily(font.family())
-        self.contents.setFontPointSize(font.pointSize())
+        self.contents.document().setDefaultFont(font)
         
         self.highlighter = HgDiffHighlighter(self.contents.document())
         
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -37,12 +37,12 @@
        </widget>
       </item>
       <item>
-       <widget class="QTextEdit" name="contents">
+       <widget class="QPlainTextEdit" name="contents">
         <property name="whatsThis">
          <string>&lt;b&gt;Mercurial Diff&lt;/b&gt;&lt;p&gt;This shows the output of the hg diff command.&lt;/p&gt;</string>
         </property>
         <property name="lineWrapMode">
-         <enum>QTextEdit::NoWrap</enum>
+         <enum>QPlainTextEdit::NoWrap</enum>
         </property>
         <property name="readOnly">
          <bool>true</bool>
@@ -50,9 +50,6 @@
         <property name="tabStopWidth">
          <number>8</number>
         </property>
-        <property name="acceptRichText">
-         <bool>false</bool>
-        </property>
        </widget>
       </item>
      </layout>
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffGenerator.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffGenerator.py	Mon Oct 12 17:39:45 2020 +0200
@@ -66,61 +66,63 @@
         @return flag indicating a successful start of the diff command
             (boolean)
         """
-        with E5OverrideCursor():
-            if qdiff:
-                args = self.vcs.initCommand("qdiff")
-            else:
-                args = self.vcs.initCommand("diff")
-                
-                if self.vcs.hasSubrepositories():
-                    args.append("--subrepos")
-                
-                if bundle:
-                    args.append('--repository')
-                    args.append(bundle)
-                elif (
-                    self.vcs.bundleFile and
-                    os.path.exists(self.vcs.bundleFile)
-                ):
-                    args.append('--repository')
-                    args.append(self.vcs.bundleFile)
+        if qdiff:
+            args = self.vcs.initCommand("qdiff")
+        else:
+            args = self.vcs.initCommand("diff")
+            
+            if self.vcs.hasSubrepositories():
+                args.append("--subrepos")
+            
+            if bundle:
+                args.append('--repository')
+                args.append(bundle)
+            elif (
+                self.vcs.bundleFile and
+                os.path.exists(self.vcs.bundleFile)
+            ):
+                args.append('--repository')
+                args.append(self.vcs.bundleFile)
+            
+            if versions is not None:
+                rev1 = self.__getVersionArg(versions[0])
+                rev2 = None
+                if len(versions) == 2:
+                    rev2 = self.__getVersionArg(versions[1])
                 
-                if versions is not None:
-                    rev1 = self.__getVersionArg(versions[0])
-                    rev2 = None
-                    if len(versions) == 2:
-                        rev2 = self.__getVersionArg(versions[1])
-                    
-                    if rev1 is not None or rev2 is not None:
-                        args.append('-r')
-                        if rev1 is not None and rev2 is not None:
-                            args.append('{0}:{1}'.format(rev1, rev2))
-                        elif rev2 is None:
-                            args.append(rev1)
-                        elif rev1 is None:
-                            args.append(':{0}'.format(rev2))
-            
-            if isinstance(fn, list):
-                dname, fnames = self.vcs.splitPathList(fn)
-                self.vcs.addArguments(args, fn)
-            else:
-                dname, fname = self.vcs.splitPath(fn)
-                args.append(fn)
-            
-            self.__oldFile = ""
-            self.__oldFileLine = -1
-            self.__fileSeparators = []
-            self.__output = []
-            self.__errors = []
-            
+                if rev1 is not None or rev2 is not None:
+                    args.append('-r')
+                    if rev1 is not None and rev2 is not None:
+                        args.append('{0}:{1}'.format(rev1, rev2))
+                    elif rev2 is None:
+                        args.append(rev1)
+                    elif rev1 is None:
+                        args.append(':{0}'.format(rev2))
+        
+        if isinstance(fn, list):
+            dname, fnames = self.vcs.splitPathList(fn)
+            self.vcs.addArguments(args, fn)
+        else:
+            dname, fname = self.vcs.splitPath(fn)
+            args.append(fn)
+        
+        self.__oldFile = ""
+        self.__oldFileLine = -1
+        self.__fileSeparators = []
+        self.__output = []
+        self.__errors = []
+        
+        with E5OverrideCursor():
             out, err = self.__hgClient.runcommand(args)
             
             if err:
                 self.__errors = err.splitlines(True)
             
             if out:
-                for line in out.splitlines(True):
-                    self.__processOutputLine(line)
+                self.__output = out.splitlines(True)
+                for lineno, line in enumerate(self.__output):
+                    if line.startswith(("--- ", "+++ ")):
+                        self.__processFileLine(lineno, line)
                     if self.__hgClient.wasCanceled():
                         break
         
@@ -160,14 +162,17 @@
             f = f.split("/", 1)[1]
         return f
     
-    def __processFileLine(self, line):
+    def __processFileLine(self, lineno, line):
         """
         Private slot to process a line giving the old/new file.
         
-        @param line line to be processed (string)
+        @param lineno line number of line to be processed
+        @type int
+        @param line line to be processed
+        @type str
         """
         if line.startswith('---'):
-            self.__oldFileLine = len(self.__output)
+            self.__oldFileLine = lineno
             self.__oldFile = self.__extractFileName(line)
         else:
             newFile = self.__extractFileName(line)
@@ -177,17 +182,3 @@
             else:
                 self.__fileSeparators.append(
                     (self.__oldFile, newFile, self.__oldFileLine))
-    
-    def __processOutputLine(self, line):
-        """
-        Private method to process the lines of output.
-        
-        @param line output line to be processed (string)
-        """
-        if (
-            line.startswith("--- ") or
-            line.startswith("+++ ")
-        ):
-            self.__processFileLine(line)
-        
-        self.__output.append(line)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -132,8 +132,7 @@
         self.fieldCombo.addItem(self.tr("Phase"), "phase")
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.diffEdit.setFontFamily(font.family())
-        self.diffEdit.setFontPointSize(font.pointSize())
+        self.diffEdit.document().setDefaultFont(font)
         
         self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document())
         self.__diffGenerator = HgDiffGenerator(vcs, self)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -481,24 +481,21 @@
           </layout>
          </item>
          <item>
-          <widget class="QTextEdit" name="diffEdit">
+          <widget class="QPlainTextEdit" name="diffEdit">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
              <horstretch>7</horstretch>
              <verstretch>2</verstretch>
             </sizepolicy>
            </property>
-           <property name="tabChangesFocus">
-            <bool>true</bool>
-           </property>
            <property name="lineWrapMode">
-            <enum>QTextEdit::NoWrap</enum>
+            <enum>QPlainTextEdit::NoWrap</enum>
            </property>
            <property name="readOnly">
             <bool>true</bool>
            </property>
-           <property name="acceptRichText">
-            <bool>false</bool>
+           <property name="tabStopWidth">
+            <number>8</number>
            </property>
           </widget>
          </item>
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -68,8 +68,7 @@
             self.__pathColumn, Qt.AscendingOrder)
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.diffEdit.setFontFamily(font.family())
-        self.diffEdit.setFontPointSize(font.pointSize())
+        self.diffEdit.document().setDefaultFont(font)
         
         self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document())
         self.__diffGenerator = HgDiffGenerator(vcs, self)
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -124,24 +124,21 @@
         </widget>
        </item>
        <item>
-        <widget class="QTextEdit" name="diffEdit">
+        <widget class="QPlainTextEdit" name="diffEdit">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
-         <property name="tabChangesFocus">
-          <bool>true</bool>
-         </property>
          <property name="lineWrapMode">
-          <enum>QTextEdit::NoWrap</enum>
+          <enum>QPlainTextEdit::NoWrap</enum>
          </property>
          <property name="readOnly">
           <bool>true</bool>
          </property>
-         <property name="acceptRichText">
-          <bool>false</bool>
+         <property name="tabStopWidth">
+          <number>8</number>
          </property>
         </widget>
        </item>
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -60,8 +60,7 @@
         self.vcs = vcs
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.contents.setFontFamily(font.family())
-        self.contents.setFontPointSize(font.pointSize())
+        self.contents.document().setDefaultFont(font)
         
         self.highlighter = SvnDiffHighlighter(self.contents.document())
         
--- a/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsPySvn/SvnDiffDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -37,12 +37,12 @@
        </widget>
       </item>
       <item>
-       <widget class="QTextEdit" name="contents">
+       <widget class="QPlainTextEdit" name="contents">
         <property name="whatsThis">
          <string>&lt;b&gt;Subversion Diff&lt;/b&gt;&lt;p&gt;This shows the output of the svn diff command.&lt;/p&gt;</string>
         </property>
         <property name="lineWrapMode">
-         <enum>QTextEdit::NoWrap</enum>
+         <enum>QPlainTextEdit::NoWrap</enum>
         </property>
         <property name="readOnly">
          <bool>true</bool>
@@ -50,9 +50,6 @@
         <property name="tabStopWidth">
          <number>8</number>
         </property>
-        <property name="acceptRichText">
-         <bool>false</bool>
-        </property>
        </widget>
       </item>
      </layout>
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -55,8 +55,7 @@
         self.vcs = vcs
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.contents.setFontFamily(font.family())
-        self.contents.setFontPointSize(font.pointSize())
+        self.contents.document().setDefaultFont(font)
         
         self.highlighter = SvnDiffHighlighter(self.contents.document())
         
--- a/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsSubversion/SvnDiffDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -37,12 +37,12 @@
        </widget>
       </item>
       <item>
-       <widget class="QTextEdit" name="contents">
+       <widget class="QPlainTextEdit" name="contents">
         <property name="whatsThis">
          <string>&lt;b&gt;Subversion Diff&lt;/b&gt;&lt;p&gt;This shows the output of the svn diff command.&lt;/p&gt;</string>
         </property>
         <property name="lineWrapMode">
-         <enum>QTextEdit::NoWrap</enum>
+         <enum>QPlainTextEdit::NoWrap</enum>
         </property>
         <property name="readOnly">
          <bool>true</bool>
@@ -50,9 +50,6 @@
         <property name="tabStopWidth">
          <number>8</number>
         </property>
-        <property name="acceptRichText">
-         <bool>false</bool>
-        </property>
        </widget>
       </item>
      </layout>
--- a/eric6/UI/DiffDialog.py	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/UI/DiffDialog.py	Mon Oct 12 17:39:45 2020 +0200
@@ -7,7 +7,6 @@
 Module implementing a dialog to compare two files.
 """
 
-
 import os
 import time
 
@@ -64,8 +63,7 @@
         self.updateInterval = 20    # update every 20 lines
         
         font = Preferences.getEditorOtherFonts("MonospacedFont")
-        self.contents.setFontFamily(font.family())
-        self.contents.setFontPointSize(font.pointSize())
+        self.contents.document().setDefaultFont(font)
         
         self.highlighter = DiffHighlighter(self.contents.document())
         
--- a/eric6/UI/DiffDialog.ui	Mon Oct 12 17:23:15 2020 +0200
+++ b/eric6/UI/DiffDialog.ui	Mon Oct 12 17:39:45 2020 +0200
@@ -136,9 +136,9 @@
     </widget>
    </item>
    <item>
-    <widget class="QTextEdit" name="contents">
+    <widget class="QPlainTextEdit" name="contents">
      <property name="lineWrapMode">
-      <enum>QTextEdit::NoWrap</enum>
+      <enum>QPlainTextEdit::NoWrap</enum>
      </property>
      <property name="readOnly">
       <bool>true</bool>
@@ -146,9 +146,6 @@
      <property name="tabStopWidth">
       <number>8</number>
      </property>
-     <property name="acceptRichText">
-      <bool>false</bool>
-     </property>
     </widget>
    </item>
    <item>

eric ide

mercurial