QScintilla/MiniEditor.py

branch
Py2 comp.
changeset 2677
3d4277929fb3
parent 2525
8b507a9a2d40
parent 2662
d28382a4b88a
child 3057
10516539f238
diff -r e60ea6cb8e11 -r 3d4277929fb3 QScintilla/MiniEditor.py
--- a/QScintilla/MiniEditor.py	Fri May 24 18:39:58 2013 +0200
+++ b/QScintilla/MiniEditor.py	Tue May 28 20:52:12 2013 +0200
@@ -171,6 +171,7 @@
         self.__textEdit.textChanged.connect(self.__documentWasModified)
         self.__textEdit.modificationChanged.connect(self.__modificationChanged)
         self.__textEdit.cursorPositionChanged.connect(self.__cursorPositionChanged)
+        self.__textEdit.linesChanged.connect(self.__resizeLinenoMargin)
         
         self.__textEdit.setContextMenuPolicy(Qt.CustomContextMenu)
         self.__textEdit.customContextMenuRequested.connect(self.__contextMenuRequested)
@@ -2094,8 +2095,7 @@
         linenoMargin = Preferences.getEditor("LinenoMargin")
         self.__textEdit.setMarginLineNumbers(0, linenoMargin)
         if linenoMargin:
-            self.__textEdit.setMarginWidth(0,
-                ' ' + '8' * Preferences.getEditor("LinenoWidth"))
+            self.__resizeLinenoMargin()
         else:
             self.__textEdit.setMarginWidth(0, 16)
         
@@ -2120,6 +2120,15 @@
         else:
             self.__textEdit.setFolding(QsciScintilla.NoFoldStyle)
     
+    def __resizeLinenoMargin(self):
+        """
+        Private slot to resize the line numbers margin.
+        """
+        linenoMargin = Preferences.getEditor("LinenoMargin")
+        if linenoMargin:
+            self.__textEdit.setMarginWidth(
+                0, '8' * (len(str(self.__textEdit.lines())) + 1))
+    
     def __setTextDisplay(self):
         """
         Private method to configure the text display.
@@ -2206,6 +2215,9 @@
         if Preferences.getEditor("OverrideEditAreaColours"):
             self.__textEdit.setColor(Preferences.getEditorColour("EditAreaForeground"))
             self.__textEdit.setPaper(Preferences.getEditorColour("EditAreaBackground"))
+        
+        self.__textEdit.setVirtualSpaceOptions(
+            Preferences.getEditor("VirtualSpaceOptions"))
     
     def __setEolMode(self):
         """

eric ide

mercurial