Index: /stable/HeuristicLab.CodeEditor/3.4/CodeEditor.cs
===================================================================
--- /stable/HeuristicLab.CodeEditor/3.4/CodeEditor.cs	(revision 16831)
+++ /stable/HeuristicLab.CodeEditor/3.4/CodeEditor.cs	(revision 16832)
@@ -109,6 +109,8 @@
       get { return Doc.GetText(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length); }
       set {
-        if (Doc.Text == value) return;
-        Doc.Replace(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length, value);
+        var curLength = Doc.TextLength - suffix.Length - prefix.Length;
+        var curUserCode = Doc.GetText(prefix.Length, curLength);
+        if (curUserCode == value) return;
+        Doc.Replace(prefix.Length, curLength, value);
       }
     }
@@ -274,4 +276,8 @@
     #endregion
 
+    public override void ClearEditHistory() {
+      Doc.UndoStack.ClearAll();
+    }
+
     public override void ScrollToPosition(int line, int column) {
       var segment = GetSegmentAtLocation(line, column);
Index: /stable/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs
===================================================================
--- /stable/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs	(revision 16831)
+++ /stable/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs	(revision 16832)
@@ -57,4 +57,6 @@
     public virtual void ScrollToPosition(int line, int column) { }
 
+    public virtual void ClearEditHistory() { }
+
     public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { }
 
Index: /stable/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.cs
===================================================================
--- /stable/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.cs	(revision 16831)
+++ /stable/HeuristicLab.Operators.Programmable.Views/3.3/ProgrammableOperatorView.cs	(revision 16832)
@@ -83,4 +83,5 @@
       if (ProgrammableOperator == null) {
         codeEditor.UserCode = string.Empty;
+        codeEditor.ClearEditHistory();
         assembliesTreeView.Nodes.Clear();
         parameterCollectionView.Content = null;
@@ -91,4 +92,5 @@
         if (codeEditor.UserCode == string.Empty)
           codeEditor.UserCode = string.Format("    {0}", Environment.NewLine);
+        codeEditor.ClearEditHistory();
         InitializeAssemblyList();
         InitializeNamespacesList();
@@ -98,15 +100,18 @@
         showCodeButton.Enabled = !string.IsNullOrEmpty(ProgrammableOperator.CompilationUnitCode);
         parameterCollectionView.Content = ProgrammableOperator.Parameters;
-        if (ProgrammableOperator.CompileErrors == null) {
-          compilationLabel.ForeColor = SystemColors.ControlDarkDark;
-          compilationLabel.Text = "Not compiled";
-        } else if (ProgrammableOperator.CompileErrors.HasErrors) {
-          compilationLabel.ForeColor = Color.DarkRed;
-          compilationLabel.Text = "Compilation failed";
-        } else {
-          compilationLabel.ForeColor = Color.DarkGreen;
-          compilationLabel.Text = "Compilation successful";
-        }
-
+      }
+      UpdateCompilationLabel();
+    }
+
+    private void UpdateCompilationLabel() {
+      if (ProgrammableOperator == null || ProgrammableOperator.CompileErrors == null) {
+        compilationLabel.ForeColor = SystemColors.ControlDarkDark;
+        compilationLabel.Text = "Not compiled";
+      } else if (ProgrammableOperator.CompileErrors.HasErrors) {
+        compilationLabel.ForeColor = Color.DarkRed;
+        compilationLabel.Text = "Compilation failed";
+      } else {
+        compilationLabel.ForeColor = Color.DarkGreen;
+        compilationLabel.Text = "Compilation successful";
       }
     }
@@ -158,5 +163,4 @@
       }
       InitializeNamespacesList();
-      codeEditor.Prefix = GetGeneratedPrefix();
     }
     private void namespacesTreeView_AfterCheck(object sender, TreeViewEventArgs e) {
@@ -168,5 +172,4 @@
         ProgrammableOperator.UnselectNamespace(e.Node.FullPath);
       }
-      codeEditor.Prefix = GetGeneratedPrefix();
     }
     #endregion
@@ -190,8 +193,4 @@
     private string GetGeneratedPrefix() {
       StringBuilder prefix = new StringBuilder();
-      foreach (var ns in ProgrammableOperator.GetSelectedAndValidNamespaces()) {
-        prefix.Append("using ").Append(ns).AppendLine(";");
-      }
-      prefix.AppendLine();
       prefix.Append("public class ").Append(ProgrammableOperator.CompiledTypeName).AppendLine(" {");
       prefix.Append("  ").Append(ProgrammableOperator.Signature).AppendLine(" {");
@@ -203,10 +202,10 @@
       try {
         ProgrammableOperator.Compile();
-      }
-      catch (Exception ex) {
+      } catch (Exception ex) {
         ErrorHandling.ShowErrorDialog(this, ex);
       }
-      OnContentChanged();
       this.Enabled = true;
+      UpdateCompilationLabel();
+      codeEditor.ShowCompileErrors(ProgrammableOperator.CompileErrors);
     }
 
Index: /stable/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs
===================================================================
--- /stable/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs	(revision 16831)
+++ /stable/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperator.cs	(revision 16832)
@@ -129,10 +129,8 @@
     public void SelectNamespace(string ns) {
       namespaces.Add(ns);
-      OnSignatureChanged();
     }
 
     public void UnselectNamespace(string ns) {
       namespaces.Remove(ns);
-      OnSignatureChanged();
     }
 
Index: /stable/HeuristicLab.Scripting.Views/3.3/ScriptView.cs
===================================================================
--- /stable/HeuristicLab.Scripting.Views/3.3/ScriptView.cs	(revision 16831)
+++ /stable/HeuristicLab.Scripting.Views/3.3/ScriptView.cs	(revision 16832)
@@ -82,6 +82,8 @@
       if (Content == null) {
         codeEditor.UserCode = string.Empty;
+        codeEditor.ClearEditHistory();
       } else {
         codeEditor.UserCode = Content.Code;
+        codeEditor.ClearEditHistory();
         codeEditor.AddAssembliesAsync(Content.GetAssemblies());
         if (Content.CompileErrors == null) {
