Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/10/19 14:16:21 (6 years ago)
Author:
jkarder
Message:

#2967: fixed ctrl+z removing all code and improved code handling in programmable operators

Location:
trunk/HeuristicLab.CodeEditor/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.CodeEditor/3.4/CodeEditor.cs

    r15583 r16528  
    109109      get { return Doc.GetText(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length); }
    110110      set {
    111         if (Doc.Text == value) return;
    112         Doc.Replace(prefix.Length, Doc.TextLength - suffix.Length - prefix.Length, value);
     111        var curLength = Doc.TextLength - suffix.Length - prefix.Length;
     112        var curUserCode = Doc.GetText(prefix.Length, curLength);
     113        if (curUserCode == value) return;
     114        Doc.Replace(prefix.Length, curLength, value);
    113115      }
    114116    }
     
    274276    #endregion
    275277
     278    public override void ClearEditHistory() {
     279      Doc.UndoStack.ClearAll();
     280    }
     281
    276282    public override void ScrollToPosition(int line, int column) {
    277283      var segment = GetSegmentAtLocation(line, column);
  • trunk/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs

    r15583 r16528  
    5757    public virtual void ScrollToPosition(int line, int column) { }
    5858
     59    public virtual void ClearEditHistory() { }
     60
    5961    public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { }
    6062
Note: See TracChangeset for help on using the changeset viewer.