/// <summary>
 ///
 /// </summary>
 internal ModifyEventArgs(ModifyStatus modifyStatus, IHighLevelCommand command, TextPos endPos)
 {
     ModifyStatus = modifyStatus;
     ModifyDetail = command.ModifyDetail;
     Range        = command.ResultRange;
     OldEndPos    = endPos;
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        public void Redo()
        {
            var endPos = TextPos.GetEndPos(this);

            if (_undoRedoHistory.TryRedo(out var command))
            {
                RaiseModifyEvent(ModifyStatus.Modify, command, endPos);
            }
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 private bool TryExecuteCommand(IHighLevelCommand command)
 {
     if (command.Validate())
     {
         var endPos = TextPos.GetEndPos(this);
         _undoRedoHistory.Execute(command);
         RaiseModifyEvent(ModifyStatus.Modify, command, endPos);
         return(true);
     }
     return(false);
 }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 private void RaiseModifyEvent(ModifyStatus status, IHighLevelCommand command, TextPos endPos)
 {
     DocModified?.Invoke(new ModifyEventArgs(status, command, endPos));
 }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        private TextRange GetNextOrPrevRange(TextPos pos, bool isRemoveNext)
        {
            var offsetPos = isRemoveNext ? pos.GetNextPos(this) : pos.GetPrevPos(this);

            return(new TextRange(offsetPos, pos));
        }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 public void RemoveBack(TextPos pos)
 {
     TryExecuteCommand(new RemoveTextCommand(_internalData, GetNextOrPrevRange(pos, false), ModifyDetail.RemoveOne));
 }
Beispiel #7
0
 /// <summary>
 ///
 /// </summary>
 public void InsertText(TextPos pos, string text)
 {
     InsertText(new TextRange(pos, pos), text);
 }