Workaround for missing lines at vertical scroll bar caused by annotations.

Thu, 03 Sep 2015 23:01:02 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Thu, 03 Sep 2015 23:01:02 +0200
changeset 4433
7ab862396a8a
parent 4425
2f51c66b3120
child 4434
8ba11cf46483

Workaround for missing lines at vertical scroll bar caused by annotations.

Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/QsciScintillaCompat.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Thu Sep 03 19:15:51 2015 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Thu Sep 03 23:01:02 2015 +0200
@@ -715,6 +715,9 @@
             else:
                 editor.toggleWarning(
                     lineno, 0, True, message, warningType=editor.WarningStyle)
+            
+            editor = vm.activeWindow()
+            editor.updateVerticalScrollBar()
     
     @pyqtSlot()
     def on_resultList_itemSelectionChanged(self):
@@ -761,6 +764,9 @@
             if file not in errorFiles:
                 editor = vm.getOpenEditor(file)
                 editor.clearStyleWarnings()
+        
+        editor = vm.activeWindow()
+        editor.updateVerticalScrollBar()
     
     @pyqtSlot()
     def on_statisticsButton_clicked(self):
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Thu Sep 03 19:15:51 2015 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py	Thu Sep 03 23:01:02 2015 +0200
@@ -405,13 +405,14 @@
         if self.noResults:
             return
         
+        vm = e5App().getObject("ViewManager")
+        
         if itm.parent():
             fn = Utilities.normabspath(itm.data(0, self.filenameRole))
             lineno = itm.data(0, self.lineRole)
             index = itm.data(0, self.indexRole)
             error = itm.data(0, self.errorRole)
             
-            vm = e5App().getObject("ViewManager")
             vm.openSourceFile(fn, lineno)
             editor = vm.getOpenEditor(fn)
             
@@ -421,7 +422,6 @@
                 editor.toggleSyntaxError(lineno, index, True, error, show=True)
         else:
             fn = Utilities.normabspath(itm.data(0, self.filenameRole))
-            vm = e5App().getObject("ViewManager")
             vm.openSourceFile(fn)
             editor = vm.getOpenEditor(fn)
             for index in range(itm.childCount()):
@@ -435,6 +435,9 @@
                     editor.toggleSyntaxError(
                         lineno, index, True, error, show=True)
         
+        editor = vm.activeWindow()
+        editor.updateVerticalScrollBar()
+        
     @pyqtSlot()
     def on_showButton_clicked(self):
         """
@@ -480,6 +483,9 @@
                 editor.clearSyntaxError()
                 editor.clearFlakesWarnings()
         
+        editor = vm.activeWindow()
+        editor.updateVerticalScrollBar()
+        
     def __clearErrors(self, files):
         """
         Private method to clear all error and warning markers of
--- a/QScintilla/Editor.py	Thu Sep 03 19:15:51 2015 +0200
+++ b/QScintilla/Editor.py	Thu Sep 03 23:01:02 2015 +0200
@@ -5395,6 +5395,8 @@
         warnings = problems.get('warnings', [])
         for _fn, lineno, col, code, msg in warnings:
             self.toggleWarning(lineno, col, True, msg)
+        
+        self.updateVerticalScrollBar()
  
     def __initOnlineSyntaxCheck(self):
         """
--- a/QScintilla/QsciScintillaCompat.py	Thu Sep 03 19:15:51 2015 +0200
+++ b/QScintilla/QsciScintillaCompat.py	Thu Sep 03 23:01:02 2015 +0200
@@ -1467,6 +1467,15 @@
         """
         self.activateWindow()
     
+    def updateVerticalScrollBar(self):
+        """
+        Public method to update the vertical scroll bar to reflect the
+        additional lines added by annotations.
+        """
+        # Workaround because Scintilla.Redraw isn't implemented
+        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 0)
+        self.SendScintilla(QsciScintilla.SCI_SETVSCROLLBAR, 1)
+    
     ###########################################################################
     ## utility methods
     ###########################################################################

eric ide

mercurial