3508 self.lastModified = pathlib.Path(fn).stat().st_mtime |
3508 self.lastModified = pathlib.Path(fn).stat().st_mtime |
3509 |
3509 |
3510 @pyqtSlot() |
3510 @pyqtSlot() |
3511 def __convertTabs(self): |
3511 def __convertTabs(self): |
3512 """ |
3512 """ |
3513 Private slot to convert tabulators to spaces. |
3513 Private slot to automatically convert tabulators to spaces upon loading. |
3514 """ |
3514 """ |
3515 if ( |
3515 if ( |
3516 (not self.__getEditorConfig("TabForIndentation")) |
3516 (not self.__getEditorConfig("TabForIndentation")) |
3517 and Preferences.getEditor("ConvertTabsOnLoad") |
3517 and Preferences.getEditor("ConvertTabsOnLoad") |
3518 and not (self.lexer_ and self.lexer_.alwaysKeepTabs()) |
3518 and not (self.lexer_ and self.lexer_.alwaysKeepTabs()) |
3519 ): |
3519 ): |
3520 txt = self.text() |
3520 self.expandTabs() |
3521 txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth")) |
3521 |
3522 if txtExpanded != txt: |
3522 @pyqtSlot() |
3523 self.beginUndoAction() |
3523 def expandTabs(self): |
3524 self.setText(txt) |
3524 """ |
3525 self.endUndoAction() |
3525 Public slot to expand tabulators to spaces. |
3526 |
3526 """ |
3527 self.setModified(True) |
3527 txt = self.text() |
|
3528 txtExpanded = txt.expandtabs(self.__getEditorConfig("TabWidth")) |
|
3529 if txtExpanded != txt: |
|
3530 self.beginUndoAction() |
|
3531 self.setText(txtExpanded) |
|
3532 self.endUndoAction() |
|
3533 |
|
3534 self.setModified(True) |
3528 |
3535 |
3529 def __removeTrailingWhitespace(self): |
3536 def __removeTrailingWhitespace(self): |
3530 """ |
3537 """ |
3531 Private method to remove trailing whitespace. |
3538 Private method to remove trailing whitespace. |
3532 """ |
3539 """ |