171 def OnModification(self, event): |
171 def OnModification(self, event): |
172 if not self.DisableEvents: |
172 if not self.DisableEvents: |
173 mod_type = event.GetModificationType() |
173 mod_type = event.GetModificationType() |
174 if not (mod_type&wx.stc.STC_PERFORMED_UNDO or mod_type&wx.stc.STC_PERFORMED_REDO): |
174 if not (mod_type&wx.stc.STC_PERFORMED_UNDO or mod_type&wx.stc.STC_PERFORMED_REDO): |
175 if mod_type&wx.stc.STC_MOD_BEFOREINSERT: |
175 if mod_type&wx.stc.STC_MOD_BEFOREINSERT: |
176 if self.CurrentAction == None: |
176 if self.CurrentAction is None: |
177 self.StartBuffering() |
177 self.StartBuffering() |
178 elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
178 elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
179 self.Controler.EndBuffering() |
179 self.Controler.EndBuffering() |
180 self.StartBuffering() |
180 self.StartBuffering() |
181 self.CurrentAction = ("Add", event.GetPosition()) |
181 self.CurrentAction = ("Add", event.GetPosition()) |
182 wx.CallAfter(self.RefreshModel) |
182 wx.CallAfter(self.RefreshModel) |
183 elif mod_type&wx.stc.STC_MOD_BEFOREDELETE: |
183 elif mod_type&wx.stc.STC_MOD_BEFOREDELETE: |
184 if self.CurrentAction == None: |
184 if self.CurrentAction is None: |
185 self.StartBuffering() |
185 self.StartBuffering() |
186 elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
186 elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
187 self.Controler.EndBuffering() |
187 self.Controler.EndBuffering() |
188 self.StartBuffering() |
188 self.StartBuffering() |
189 self.CurrentAction = ("Delete", event.GetPosition()) |
189 self.CurrentAction = ("Delete", event.GetPosition()) |
225 self.ParentWindow.RefreshFileMenu() |
225 self.ParentWindow.RefreshFileMenu() |
226 self.ParentWindow.RefreshEditMenu() |
226 self.ParentWindow.RefreshEditMenu() |
227 self.ParentWindow.RefreshPageTitles() |
227 self.ParentWindow.RefreshPageTitles() |
228 |
228 |
229 def ResetBuffer(self): |
229 def ResetBuffer(self): |
230 if self.CurrentAction != None: |
230 if self.CurrentAction is not None: |
231 self.Controler.EndBuffering() |
231 self.Controler.EndBuffering() |
232 self.CurrentAction = None |
232 self.CurrentAction = None |
233 |
233 |
234 def GetCodeText(self): |
234 def GetCodeText(self): |
235 parts = self.Controler.GetTextParts() |
235 parts = self.Controler.GetTextParts() |
257 new_text = self.GetCodeText() |
257 new_text = self.GetCodeText() |
258 if old_text != new_text: |
258 if old_text != new_text: |
259 self.SetText(new_text) |
259 self.SetText(new_text) |
260 new_cursor_pos = GetCursorPos(old_text, new_text) |
260 new_cursor_pos = GetCursorPos(old_text, new_text) |
261 self.LineScroll(column, line) |
261 self.LineScroll(column, line) |
262 if new_cursor_pos != None: |
262 if new_cursor_pos is not None: |
263 self.GotoPos(new_cursor_pos) |
263 self.GotoPos(new_cursor_pos) |
264 else: |
264 else: |
265 self.GotoPos(old_cursor_pos) |
265 self.GotoPos(old_cursor_pos) |
266 self.EmptyUndoBuffer() |
266 self.EmptyUndoBuffer() |
267 self.DisableEvents = False |
267 self.DisableEvents = False |