78 @return filename of the displayed file |
78 @return filename of the displayed file |
79 @rtype str |
79 @rtype str |
80 """ |
80 """ |
81 return self.mw.getFileName() |
81 return self.mw.getFileName() |
82 |
82 |
|
83 def editorCommand(self, cmd): |
|
84 """ |
|
85 Public method to perform a simple editor command. |
|
86 |
|
87 @param cmd the scintilla command to be performed (integer) |
|
88 """ |
|
89 if cmd == QsciScintilla.SCI_DELETEBACK: |
|
90 line, index = self.getCursorPosition() |
|
91 text = self.text(line)[index - 1:index + 1] |
|
92 matchingPairs = ['()', '[]', '{}', '<>', "''", '""'] |
|
93 if text in matchingPairs: |
|
94 self.delete() |
|
95 |
|
96 super(MiniScintilla, self).editorCommand(cmd) |
|
97 |
83 def keyPressEvent(self, ev): |
98 def keyPressEvent(self, ev): |
84 """ |
99 """ |
85 Protected method to handle the user input a key at a time. |
100 Protected method to handle the user input a key at a time. |
86 |
101 |
87 @param ev key event |
102 @param ev key event |
2984 self.__textEdit.setPaper( |
2999 self.__textEdit.setPaper( |
2985 Preferences.getEditorColour("EditAreaBackground")) |
3000 Preferences.getEditorColour("EditAreaBackground")) |
2986 |
3001 |
2987 self.__textEdit.setVirtualSpaceOptions( |
3002 self.__textEdit.setVirtualSpaceOptions( |
2988 Preferences.getEditor("VirtualSpaceOptions")) |
3003 Preferences.getEditor("VirtualSpaceOptions")) |
|
3004 |
|
3005 # to avoid errors due to line endings by pasting |
|
3006 self.__textEdit.SendScintilla( |
|
3007 QsciScintilla.SCI_SETPASTECONVERTENDINGS, True) |
2989 |
3008 |
2990 def __setEolMode(self): |
3009 def __setEolMode(self): |
2991 """ |
3010 """ |
2992 Private method to configure the eol mode of the editor. |
3011 Private method to configure the eol mode of the editor. |
2993 """ |
3012 """ |