src/eric7/QScintilla/Editor.py

branch
eric7
changeset 10465
56a3364150b1
parent 10449
cc468bd2abdf
child 10473
f45fd45cb11d
diff -r 30de2b1bee37 -r 56a3364150b1 src/eric7/QScintilla/Editor.py
--- a/src/eric7/QScintilla/Editor.py	Mon Jan 01 14:45:10 2024 +0100
+++ b/src/eric7/QScintilla/Editor.py	Mon Jan 01 15:25:48 2024 +0100
@@ -3510,21 +3510,28 @@
     @pyqtSlot()
     def __convertTabs(self):
         """
-        Private slot to convert tabulators to spaces.
+        Private slot to automatically convert tabulators to spaces upon loading.
         """
         if (
             (not self.__getEditorConfig("TabForIndentation"))
             and Preferences.getEditor("ConvertTabsOnLoad")
             and not (self.lexer_ and self.lexer_.alwaysKeepTabs())
         ):
-            txt = self.text()
-            txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth"))
-            if txtExpanded != txt:
-                self.beginUndoAction()
-                self.setText(txt)
-                self.endUndoAction()
-
-                self.setModified(True)
+            self.expandTabs()
+
+    @pyqtSlot()
+    def expandTabs(self):
+        """
+        Public slot to expand tabulators to spaces.
+        """
+        txt = self.text()
+        txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth"))
+        if txtExpanded != txt:
+            self.beginUndoAction()
+            self.setText(txtExpanded)
+            self.endUndoAction()
+
+            self.setModified(True)
 
     def __removeTrailingWhitespace(self):
         """

eric ide

mercurial