当前位置: 首页>>代码示例>>Java>>正文


Java DocumentUtil.isInsideSurrogatePair方法代码示例

本文整理汇总了Java中com.intellij.util.DocumentUtil.isInsideSurrogatePair方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentUtil.isInsideSurrogatePair方法的具体用法?Java DocumentUtil.isInsideSurrogatePair怎么用?Java DocumentUtil.isInsideSurrogatePair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.DocumentUtil的用法示例。


在下文中一共展示了DocumentUtil.isInsideSurrogatePair方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: changedUpdateImpl

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Override
protected void changedUpdateImpl(@Nonnull DocumentEvent e) {
  super.changedUpdateImpl(e);
  if (isValid()) {
    int startOffset = intervalStart();
    int endOffset = intervalEnd();
    if (DocumentUtil.isInsideSurrogatePair(getDocument(), startOffset)) setIntervalStart(startOffset - 1);
    if (DocumentUtil.isInsideSurrogatePair(getDocument(), endOffset)) setIntervalStart(endOffset - 1);
  }
  if (endVirtualOffset > 0 && isValid()) {
    Document document = e.getDocument();
    int startAfter = intervalStart();
    int endAfter = intervalEnd();
    if (!DocumentUtil.isAtLineEnd(endAfter, document) || document.getLineNumber(startAfter) != document.getLineNumber(endAfter)) {
      resetVirtualSelection();
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:CaretImpl.java

示例2: checkIfValid

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
private boolean checkIfValid(@Nonnull final FoldRegion region) {
  assertIsDispatchThreadForEditor();
  assertOurRegion(region);
  if (!isFoldingEnabled()) {
    return false;
  }
  if (!myIsBatchFoldingProcessing) {
    LOG.error("Fold regions must be added or removed inside batchFoldProcessing() only.");
    return false;
  }
  return region.isValid() &&
         !DocumentUtil.isInsideSurrogatePair(myEditor.getDocument(), region.getStartOffset()) &&
         !DocumentUtil.isInsideSurrogatePair(myEditor.getDocument(), region.getEndOffset());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:FoldingModelImpl.java

示例3: onReTarget

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Override
protected void onReTarget(int startOffset, int endOffset, int destOffset) {
  int offset = intervalStart();
  if (DocumentUtil.isInsideSurrogatePair(getDocument(), offset)) {
    setIntervalStart(offset - 1);
    setIntervalEnd(offset - 1);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:CaretImpl.java

示例4: alignToSurrogateBoundaries

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
private void alignToSurrogateBoundaries() {
  Document document = getDocument();
  int start = intervalStart();
  int end = intervalEnd();
  if (DocumentUtil.isInsideSurrogatePair(document, start)) {
    setIntervalStart(start - 1);
  }
  if (DocumentUtil.isInsideSurrogatePair(document, end)) {
    setIntervalEnd(end - 1);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:FoldRegionImpl.java

示例5: changedUpdateImpl

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Override
protected void changedUpdateImpl(@Nonnull DocumentEvent e) {
  super.changedUpdateImpl(e);
  if (isValid() && DocumentUtil.isInsideSurrogatePair(getDocument(), intervalStart())) {
    invalidate(e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:InlayImpl.java

示例6: onReTarget

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Override
protected void onReTarget(int startOffset, int endOffset, int destOffset) {
  if (DocumentUtil.isInsideSurrogatePair(getDocument(), getOffset())) {
    myEditor.getInlayModel().myMoveInProgress = true;
    try {
      invalidate("moved inside surrogate pair on retarget");
    }
    finally {
      myEditor.getInlayModel().myMoveInProgress = false;
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:InlayImpl.java

示例7: registerSoftWrap

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
/**
 * This method is assumed to be called in a situation when visible area width is exceeded. It tries to create and register
 * new soft wrap which data is defined in accordance with the given parameters.
 * <p/>
 * There is a possible case that no soft wrap is created and registered. That is true, for example, for a situation when
 * we have a long line of text that doesn't contain white spaces, operators or any other symbols that may be used
 * as a <code>'wrap points'</code>. We just left such lines as-is.
 *
 * @param minOffset         min line <code>'wrap point'</code> offset
 * @param preferredOffset   preferred <code>'wrap point'</code> offset, i.e. max offset which symbol doesn't exceed right margin
 * @param maxOffset         max line <code>'wrap point'</code> offset
 * @param spaceSize         current space width in pixels
 * @param lineData          object that encapsulates information about currently processed logical line
 * @return                  newly created and registered soft wrap if any; <code>null</code> otherwise
 */
@Nullable
private SoftWrapImpl registerSoftWrap(int minOffset, int preferredOffset, int maxOffset, int spaceSize, LogicalLineData lineData) {
  int softWrapOffset = calculateBackwardSpaceOffsetIfPossible(minOffset, preferredOffset);
  if (softWrapOffset < 0) {
    softWrapOffset = calculateBackwardOffsetForEasternLanguageIfPossible(minOffset, preferredOffset);
  }
  if (softWrapOffset < 0) {
    Document document = myEditor.getDocument();

    // Performance optimization implied by profiling results analysis.
    if (myLineWrapPositionStrategy == null) {
      myLineWrapPositionStrategy = LanguageLineWrapPositionStrategy.INSTANCE.forEditor(myEditor);
    }

    softWrapOffset = myLineWrapPositionStrategy.calculateWrapPosition(
            document, myEditor.getProject(), minOffset, maxOffset, preferredOffset, true, true
    );
    if (DocumentUtil.isInsideSurrogatePair(document, softWrapOffset)) softWrapOffset--;
  }

  if (softWrapOffset >= lineData.endLineOffset || softWrapOffset < 0 || softWrapOffset <= minOffset
      || (myCustomIndentUsedLastTime && softWrapOffset == lineData.nonWhiteSpaceSymbolOffset)
      || (softWrapOffset > preferredOffset && myContext.lastFoldStartPosition != null // Prefer to wrap on fold region backwards
          && myContext.lastFoldStartPosition.offset <= preferredOffset))              // to wrapping forwards.
  {
    return null;
  }

  return registerSoftWrap(softWrapOffset, spaceSize, lineData);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:46,代码来源:SoftWrapApplianceManager.java

示例8: addInlineElement

import com.intellij.util.DocumentUtil; //导入方法依赖的package包/类
@Nullable
@Override
public Inlay addInlineElement(int offset, boolean relatesToPrecedingText, @Nonnull EditorCustomElementRenderer renderer) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  DocumentEx document = myEditor.getDocument();
  if (DocumentUtil.isInsideSurrogatePair(document, offset)) return null;
  offset = Math.max(0, Math.min(document.getTextLength(), offset));
  InlayImpl inlay = new InlayImpl(myEditor, offset, relatesToPrecedingText, renderer);
  notifyAdded(inlay);
  return inlay;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:InlayModelImpl.java


注:本文中的com.intellij.util.DocumentUtil.isInsideSurrogatePair方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。