140 self.editor.insert('=end') |
140 self.editor.insert('=end') |
141 elif self.__insertHereDoc and self.__hereRX.exactMatch(txt): |
141 elif self.__insertHereDoc and self.__hereRX.exactMatch(txt): |
142 self.editor.insert(self.__hereRX.cap(1)) |
142 self.editor.insert(self.__hereRX.cap(1)) |
143 elif self.__indentBrace and re.search(":\r?\n", txt) is None: |
143 elif self.__indentBrace and re.search(":\r?\n", txt) is None: |
144 openCount = len(re.findall("[({[]", txt)) |
144 openCount = len(re.findall("[({[]", txt)) |
145 closeCount = len(re.findall("[)}\]]", txt)) |
145 closeCount = len(re.findall(r"[)}\]]", txt)) |
146 if openCount > closeCount: |
146 if openCount > closeCount: |
147 openCount = 0 |
147 openCount = 0 |
148 closeCount = 0 |
148 closeCount = 0 |
149 openList = list(re.finditer("[({[]", txt)) |
149 openList = list(re.finditer("[({[]", txt)) |
150 index = len(openList) - 1 |
150 index = len(openList) - 1 |
151 while index > -1 and openCount == closeCount: |
151 while index > -1 and openCount == closeCount: |
152 lastOpenIndex = openList[index].start() |
152 lastOpenIndex = openList[index].start() |
153 txt2 = txt[lastOpenIndex:] |
153 txt2 = txt[lastOpenIndex:] |
154 openCount = len(re.findall("[({[]", txt2)) |
154 openCount = len(re.findall("[({[]", txt2)) |
155 closeCount = len(re.findall("[)}\]]", txt2)) |
155 closeCount = len(re.findall(r"[)}\]]", txt2)) |
156 index -= 1 |
156 index -= 1 |
157 if openCount > closeCount and lastOpenIndex > col: |
157 if openCount > closeCount and lastOpenIndex > col: |
158 self.editor.insert(' ' * (lastOpenIndex - col + 1)) |
158 self.editor.insert(' ' * (lastOpenIndex - col + 1)) |
159 self.editor.setCursorPosition(line, lastOpenIndex + 1) |
159 self.editor.setCursorPosition(line, lastOpenIndex + 1) |
160 |
160 |