コード例 #1
0
 EditorSizeManager(EditorView view) {
   myView = view;
   myEditor = view.getEditor();
   myDocument = myEditor.getDocument();
   myDocument.addDocumentListener(this, this);
   myEditor.getFoldingModel().addListener(this, this);
   myEditor.getSoftWrapModel().getApplianceManager().addListener(mySoftWrapChangeListener);
 }
コード例 #2
0
 @Override
 public int calcColumnNumber(
     @NotNull final CharSequence text, final int start, final int offset, final int tabSize) {
   int hostStart = myDocumentWindow.injectedToHost(start);
   int hostOffset = myDocumentWindow.injectedToHost(offset);
   return myDelegate.calcColumnNumber(
       myDelegate.getDocument().getText(), hostStart, hostOffset, tabSize);
 }
コード例 #3
0
  @NotNull
  public LogicalPosition hostToInjected(@NotNull LogicalPosition hPos) {
    assert isValid();
    DocumentEx hostDocument = myDelegate.getDocument();
    int hLineEndOffset =
        hPos.line >= hostDocument.getLineCount()
            ? hostDocument.getTextLength()
            : hostDocument.getLineEndOffset(hPos.line);
    LogicalPosition hLineEndPos = myDelegate.offsetToLogicalPosition(hLineEndOffset);
    if (hLineEndPos.column < hPos.column) {
      // in virtual space
      LogicalPosition iPos = myDocumentWindow.hostToInjectedInVirtualSpace(hPos);
      if (iPos != null) {
        return iPos;
      }
    }

    int hOffset = myDelegate.logicalPositionToOffset(hPos);
    int iOffset = myDocumentWindow.hostToInjected(hOffset);
    return offsetToLogicalPosition(iOffset);
  }
コード例 #4
0
 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;
 }
コード例 #5
0
 EditorPainter(EditorView view) {
   myView = view;
   myEditor = view.getEditor();
   myDocument = myEditor.getDocument();
 }