コード例 #1
0
 public override ITextStorage CloneSection(int startLine, int startChar, int endLine, int endCharPlusOne)
 {
     if (startLine == endLine)
     {
         return base.CloneSection(startLine, startChar, endLine, endCharPlusOne);
     }
     else
     {
         LineEndingInfo lineEndingInfo;
         Utf8SplayGapBuffer bufferCopy = new Utf8SplayGapBuffer(
             buffer,
             startLine + 1,
             endLine - (startLine + 1),
             null,
             out lineEndingInfo);
         string start = Encoding.UTF8.GetString(buffer.GetLine(startLine));
         string end = Encoding.UTF8.GetString(buffer.GetLine(endLine));
         bufferCopy.InsertLine(0, Encoding.UTF8.GetBytes(start.Substring(startChar)));
         bufferCopy.SetLine(endLine - startLine, Encoding.UTF8.GetBytes(end.Substring(0, endCharPlusOne)));
         return new Utf8GapStorage((Utf8SplayGapStorageFactory)factory, bufferCopy);
     }
 }
コード例 #2
0
 public Utf8SplayGapBuffer(Utf8SplayGapBuffer source, int startLine, int countLines, Encoding encoding, out LineEndingInfo lineEndingInfo)
     : this(new VectorReadStream(
             source.vector,
             source.GetStartIndexOfLineRelative(startLine, source.prefixLength),
             source.GetStartIndexOfLineRelative(startLine + countLines, source.prefixLength)
                 - source.GetStartIndexOfLineRelative(startLine, source.prefixLength)),
         false/*detectBom*/,
         encoding,
         out lineEndingInfo)
 {
 }
コード例 #3
0
 public Utf8GapStorage(Utf8SplayGapStorageFactory factory, Utf8SplayGapBuffer buffer)
     : base(factory)
 {
     this.buffer = buffer;
 }