示例#1
0
 @Override
 public char[] getChars() {
   if (myOriginalSequence != null) {
     if (myArray == null) {
       myArray = CharArrayUtil.fromSequence(myOriginalSequence);
     }
   }
   flushDeferredChanged(myDeferredChangesStorage.get());
   if (myDebugDeferredProcessing && isDeferredChangeMode()) {
     char[] expected = myDebugArray.getChars();
     for (int i = 0, max = length(); i < max; i++) {
       if (myArray[i] != expected[i]) {
         dumpDebugInfo(
             String.format(
                 "getChars(). Index: %d, expected: %c, actual: %c", i, expected[i], myArray[i]));
         break;
       }
     }
   }
   return myArray;
 }
 private static List<BidiRun> createFragments(
     @NotNull EditorView view,
     int lineStartOffset,
     int lineEndOffset,
     @NotNull FontRenderContext fontRenderContext) {
   if (lineEndOffset <= lineStartOffset) return Collections.emptyList();
   EditorImpl editor = view.getEditor();
   FontPreferences fontPreferences = editor.getColorsScheme().getFontPreferences();
   char[] chars =
       CharArrayUtil.fromSequence(
           editor.getDocument().getImmutableCharSequence(), lineStartOffset, lineEndOffset);
   List<BidiRun> runs = createRuns(editor, chars, lineStartOffset);
   for (BidiRun run : runs) {
     IterationState it =
         new IterationState(
             editor,
             lineStartOffset + run.startOffset,
             lineStartOffset + run.endOffset,
             false,
             false,
             false,
             false);
     while (!it.atEnd()) {
       addFragments(
           run,
           chars,
           it.getStartOffset() - lineStartOffset,
           it.getEndOffset() - lineStartOffset,
           it.getMergedAttributes().getFontType(),
           fontPreferences,
           fontRenderContext,
           view.getTabFragment());
       it.advance();
     }
     assert !run.fragments.isEmpty();
   }
   return runs;
 }
 private static List<BidiRun> createFragments(
     @NotNull EditorView view,
     @NotNull CharSequence text,
     @JdkConstants.FontStyle int fontStyle,
     @NotNull FontRenderContext fontRenderContext) {
   if (text.length() == 0) return Collections.emptyList();
   EditorImpl editor = view.getEditor();
   FontPreferences fontPreferences = editor.getColorsScheme().getFontPreferences();
   char[] chars = CharArrayUtil.fromSequence(text);
   List<BidiRun> runs = createRuns(editor, chars, -1);
   for (BidiRun run : runs) {
     addFragments(
         run,
         chars,
         run.startOffset,
         run.endOffset,
         fontStyle,
         fontPreferences,
         fontRenderContext,
         null);
     assert !run.fragments.isEmpty();
   }
   return runs;
 }
示例#4
0
 @Override
 @NotNull
 public char[] textToCharArray() {
   return CharArrayUtil.fromSequence(getViewProvider().getContents());
 }
 @Override
 @NotNull
 public char[] getChars() {
   return CharArrayUtil.fromSequence(getText());
 }
 public char[] getBuffer() {
   return CharArrayUtil.fromSequence(myBuffer);
 }