Bugs on TextViewer fixed
authorlbessard
Mon, 10 Dec 2007 15:20:26 +0100
changeset 136 858ff1a52d20
parent 135 d24ce0800ac6
child 137 fc7e0b8ed9d3
Bugs on TextViewer fixed
TextViewer.py
--- a/TextViewer.py	Mon Dec 10 15:20:11 2007 +0100
+++ b/TextViewer.py	Mon Dec 10 15:20:26 2007 +0100
@@ -161,7 +161,6 @@
         self.Functions = []
         self.Jumps = []
         self.EnumeratedValues = []
-        self.TextChanged = False
         self.DisableEvents = True
         self.TextSyntax = "ST"
         self.CurrentAction = None
@@ -223,7 +222,9 @@
                 event.SetDragText(values[0])
             elif values[1] != "location":
                 if values[3] == self.TagName:
+                    self.ResetBuffer()
                     event.SetDragText(values[0])
+                    wx.CallAfter(self.RefreshModel)
                 else:
                     event.SetDragText("")
                     message = wx.MessageDialog(self.ParentWindow, "Variable don't belong to this POU!", "Error", wx.OK|wx.ICON_ERROR)
@@ -415,6 +416,7 @@
     def Cut(self):
         self.ResetBuffer()
         self.CmdKeyExecute(wx.stc.STC_CMD_CUT)
+        self.RefreshModel()
         self.RefreshBuffer()
     
     def Copy(self):
@@ -423,12 +425,12 @@
     def Paste(self):
         self.ResetBuffer()
         self.CmdKeyExecute(wx.stc.STC_CMD_PASTE)
+        self.RefreshModel()
         self.RefreshBuffer()
     
     def RefreshModel(self):
-        if self.TextChanged:
-            self.RefreshJumpList()
-            self.Controler.SetEditedElementText(self.TagName, self.GetText())
+        self.RefreshJumpList()
+        self.Controler.SetEditedElementText(self.TagName, self.GetText())
     
     def OnKeyDown(self, event):
         if self.CallTipActive():
@@ -468,7 +470,6 @@
                 self.AutoCompSetIgnoreCase(True)
                 self.AutoCompShow(len(words[-1]), " ".join(kw))
         else:
-            self.TextChanged = False
             wx.CallAfter(self.RefreshModel)
             event.Skip()