Example #1
0
 public RdTextChange(RdTextChangeKind kind, int startOffset, string old, string @new, int fullTextLength)
 {
     Kind           = kind;
     StartOffset    = startOffset;
     Old            = old;
     New            = @new;
     FullTextLength = fullTextLength;
 }
Example #2
0
        private static RdTextChangeKind ReverseKind(RdTextChangeKind kind)
        {
            switch (kind)
            {
            case RdTextChangeKind.Insert: return(RdTextChangeKind.Remove);

            case RdTextChangeKind.Remove: return(RdTextChangeKind.Insert);

            case RdTextChangeKind.Replace: return(RdTextChangeKind.Replace);

            case RdTextChangeKind.Reset: throw new InvalidOperationException("Reset change isn't invertible.");

            case RdTextChangeKind.PromoteVersion: throw new InvalidOperationException("PromoteVersion change isn't invertible.");

            case RdTextChangeKind.InsertLeftSide: return(RdTextChangeKind.Remove);

            case RdTextChangeKind.InsertRightSide: return(RdTextChangeKind.Remove);

            default: throw new ArgumentOutOfRangeException($"Unexpected Kind value: {kind}.");
            }
        }