224 |
224 |
225 def OnModification(self, event): |
225 def OnModification(self, event): |
226 if not self.DisableEvents: |
226 if not self.DisableEvents: |
227 mod_type = event.GetModificationType() |
227 mod_type = event.GetModificationType() |
228 if mod_type&wx.stc.STC_MOD_BEFOREINSERT: |
228 if mod_type&wx.stc.STC_MOD_BEFOREINSERT: |
229 if self.CurrentAction == None: |
229 if self.CurrentAction is None: |
230 self.StartBuffering() |
230 self.StartBuffering() |
231 elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
231 elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
232 self.Controler.EndBuffering() |
232 self.Controler.EndBuffering() |
233 self.StartBuffering() |
233 self.StartBuffering() |
234 self.CurrentAction = ("Add", event.GetPosition()) |
234 self.CurrentAction = ("Add", event.GetPosition()) |
235 wx.CallAfter(self.RefreshModel) |
235 wx.CallAfter(self.RefreshModel) |
236 elif mod_type&wx.stc.STC_MOD_BEFOREDELETE: |
236 elif mod_type&wx.stc.STC_MOD_BEFOREDELETE: |
237 if self.CurrentAction == None: |
237 if self.CurrentAction is None: |
238 self.StartBuffering() |
238 self.StartBuffering() |
239 elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
239 elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
240 self.Controler.EndBuffering() |
240 self.Controler.EndBuffering() |
241 self.StartBuffering() |
241 self.StartBuffering() |
242 self.CurrentAction = ("Delete", event.GetPosition()) |
242 self.CurrentAction = ("Delete", event.GetPosition()) |
434 self.ParentWindow.RefreshTitle() |
434 self.ParentWindow.RefreshTitle() |
435 self.ParentWindow.RefreshFileMenu() |
435 self.ParentWindow.RefreshFileMenu() |
436 self.ParentWindow.RefreshEditMenu() |
436 self.ParentWindow.RefreshEditMenu() |
437 |
437 |
438 def ResetBuffer(self): |
438 def ResetBuffer(self): |
439 if self.CurrentAction != None: |
439 if self.CurrentAction is not None: |
440 self.Controler.EndBuffering() |
440 self.Controler.EndBuffering() |
441 self.CurrentAction = None |
441 self.CurrentAction = None |
442 |
442 |
443 def GetBufferState(self): |
443 def GetBufferState(self): |
444 if not self.Debug and self.TextSyntax != "ALL": |
444 if not self.Debug and self.TextSyntax != "ALL": |
473 new_text = self.Controler.GetEditedElementText(self.TagName, self.Debug) |
473 new_text = self.Controler.GetEditedElementText(self.TagName, self.Debug) |
474 if old_text != new_text: |
474 if old_text != new_text: |
475 self.SetText(new_text) |
475 self.SetText(new_text) |
476 new_cursor_pos = GetCursorPos(old_text, new_text) |
476 new_cursor_pos = GetCursorPos(old_text, new_text) |
477 self.Editor.LineScroll(column, line) |
477 self.Editor.LineScroll(column, line) |
478 if new_cursor_pos != None: |
478 if new_cursor_pos is not None: |
479 self.Editor.GotoPos(new_cursor_pos) |
479 self.Editor.GotoPos(new_cursor_pos) |
480 else: |
480 else: |
481 self.Editor.GotoPos(old_cursor_pos) |
481 self.Editor.GotoPos(old_cursor_pos) |
482 self.RefreshJumpList() |
482 self.RefreshJumpList() |
483 self.Editor.EmptyUndoBuffer() |
483 self.Editor.EmptyUndoBuffer() |