QScintilla/Shell.py

branch
Py2 comp.
changeset 2677
3d4277929fb3
parent 2525
8b507a9a2d40
parent 2640
dedcd4f987e0
child 3056
9986ec0e559a
diff -r e60ea6cb8e11 -r 3d4277929fb3 QScintilla/Shell.py
--- a/QScintilla/Shell.py	Fri May 24 18:39:58 2013 +0200
+++ b/QScintilla/Shell.py	Tue May 28 20:52:12 2013 +0200
@@ -140,6 +140,7 @@
         ))
         
         self.userListActivated.connect(self.__completionListSelected)
+        self.linesChanged.connect(self.__resizeLinenoMargin)
         
         self.__showStdOutErr = Preferences.getShell("ShowStdOutErr")
         if self.__showStdOutErr:
@@ -156,7 +157,7 @@
         dbs.clientSyntaxError.connect(self.__clientError)
         self.dbs = dbs
         
-        # Initialise instance variables.
+        # Initialize instance variables.
         self.__initialise()
         self.prline = 0
         self.prcol = 0
@@ -275,6 +276,14 @@
         
         self.grabGesture(Qt.PinchGesture)
         
+    def __resizeLinenoMargin(self):
+        """
+        Private slot to resize the line numbers margin.
+        """
+        linenoMargin = Preferences.getShell("LinenoMargin")
+        if linenoMargin:
+            self.setMarginWidth(0, '8' * (len(str(self.lines())) + 1))
+        
     def closeShell(self):
         """
         Public method to shutdown the shell.
@@ -333,7 +342,7 @@
         linenoMargin = Preferences.getShell("LinenoMargin")
         self.setMarginLineNumbers(0, linenoMargin)
         if linenoMargin:
-            self.setMarginWidth(0, ' ' + '8' * Preferences.getShell("LinenoWidth"))
+            self.__resizeLinenoMargin()
         else:
             self.setMarginWidth(0, 0)
         

eric ide

mercurial