當前位置: 首頁>>代碼示例>>Java>>正文


Java SoftWrapModelImpl.getSoftWrapIndex方法代碼示例

本文整理匯總了Java中com.intellij.openapi.editor.impl.SoftWrapModelImpl.getSoftWrapIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java SoftWrapModelImpl.getSoftWrapIndex方法的具體用法?Java SoftWrapModelImpl.getSoftWrapIndex怎麽用?Java SoftWrapModelImpl.getSoftWrapIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.editor.impl.SoftWrapModelImpl的用法示例。


在下文中一共展示了SoftWrapModelImpl.getSoftWrapIndex方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visualLineStartOffset

import com.intellij.openapi.editor.impl.SoftWrapModelImpl; //導入方法依賴的package包/類
private int visualLineStartOffset(int offset, boolean leanForward) {
  EditorImpl editor = myView.getEditor();
  int result = EditorUtil.getNotFoldedLineStartOffset(editor, offset);

  SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel();
  List<? extends SoftWrap> softWraps = softWrapModel.getRegisteredSoftWraps();
  int currentOrPrevWrapIndex = softWrapModel.getSoftWrapIndex(offset);
  SoftWrap currentOrPrevWrap;
  if (currentOrPrevWrapIndex < 0) {
    currentOrPrevWrapIndex = - currentOrPrevWrapIndex - 2;
    currentOrPrevWrap = currentOrPrevWrapIndex < 0 || currentOrPrevWrapIndex >= softWraps.size() ? null :
                        softWraps.get(currentOrPrevWrapIndex);
  }
  else {
    currentOrPrevWrap = leanForward ? softWraps.get(currentOrPrevWrapIndex) : null;
  }
  if (currentOrPrevWrap != null && currentOrPrevWrap.getStart() > result) {
    result = currentOrPrevWrap.getStart();
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:EditorCoordinateMapper.java

示例2: visualLineStartOffset

import com.intellij.openapi.editor.impl.SoftWrapModelImpl; //導入方法依賴的package包/類
private int visualLineStartOffset(int offset, boolean leanForward) {
  EditorImpl editor = myView.getEditor();
  offset = DocumentUtil.alignToCodePointBoundary(myDocument, offset);
  int result = EditorUtil.getNotFoldedLineStartOffset(editor, offset);

  SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel();
  List<? extends SoftWrap> softWraps = softWrapModel.getRegisteredSoftWraps();
  int currentOrPrevWrapIndex = softWrapModel.getSoftWrapIndex(offset);
  SoftWrap currentOrPrevWrap;
  if (currentOrPrevWrapIndex < 0) {
    currentOrPrevWrapIndex = - currentOrPrevWrapIndex - 2;
    currentOrPrevWrap = currentOrPrevWrapIndex < 0 || currentOrPrevWrapIndex >= softWraps.size() ? null :
                        softWraps.get(currentOrPrevWrapIndex);
  }
  else {
    currentOrPrevWrap = leanForward ? softWraps.get(currentOrPrevWrapIndex) : null;
  }
  if (currentOrPrevWrap != null && currentOrPrevWrap.getStart() > result) {
    result = currentOrPrevWrap.getStart();
  }
  return result;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:23,代碼來源:EditorCoordinateMapper.java

示例3: getVisualLineInfo

import com.intellij.openapi.editor.impl.SoftWrapModelImpl; //導入方法依賴的package包/類
private static VisualLineInfo getVisualLineInfo(@Nonnull EditorImpl editor, int offset, boolean beforeSoftWrap) {
  Document document = editor.getDocument();
  int textLength = document.getTextLength();
  if (offset <= 0 || textLength == 0) return new VisualLineInfo(0, false);
  offset = Math.min(offset, textLength);

  int startOffset = EditorUtil.getNotFoldedLineStartOffset(editor, offset);

  SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel();
  int wrapIndex = softWrapModel.getSoftWrapIndex(offset);
  int prevSoftWrapIndex = wrapIndex < 0 ? (- wrapIndex - 2) : wrapIndex - (beforeSoftWrap ? 1 : 0);
  SoftWrap prevSoftWrap = prevSoftWrapIndex < 0 ? null : softWrapModel.getRegisteredSoftWraps().get(prevSoftWrapIndex);

  int visualLineStartOffset = prevSoftWrap == null ? startOffset : Math.max(startOffset, prevSoftWrap.getStart());
  return new VisualLineInfo(visualLineStartOffset, prevSoftWrap != null && prevSoftWrap.getStart() == visualLineStartOffset);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:17,代碼來源:IncrementalCacheUpdateEvent.java

示例4: VisualLineFragmentsIterator

import com.intellij.openapi.editor.impl.SoftWrapModelImpl; //導入方法依賴的package包/類
private VisualLineFragmentsIterator(EditorView view, int offset, boolean beforeSoftWrap, @Nullable Runnable quickEvaluationListener) {
  EditorImpl editor = view.getEditor();
  int visualLineStartOffset = EditorUtil.getNotFoldedLineStartOffset(editor, offset);

  SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel();
  List<? extends SoftWrap> softWraps = softWrapModel.getRegisteredSoftWraps();
  int currentOrPrevWrapIndex = softWrapModel.getSoftWrapIndex(offset);
  if (currentOrPrevWrapIndex < 0) {
    currentOrPrevWrapIndex = - currentOrPrevWrapIndex - 2;
  }
  else if (beforeSoftWrap) {
    currentOrPrevWrapIndex--;
  }
  SoftWrap currentOrPrevWrap = currentOrPrevWrapIndex < 0 || currentOrPrevWrapIndex >= softWraps.size() ? null :
                               softWraps.get(currentOrPrevWrapIndex);
  if (currentOrPrevWrap != null && currentOrPrevWrap.getStart() > visualLineStartOffset) {
    visualLineStartOffset = currentOrPrevWrap.getStart();
  }

  int nextFoldingIndex = editor.getFoldingModel().getLastCollapsedRegionBefore(visualLineStartOffset) + 1;

  init(view,
       visualLineStartOffset,
       editor.getDocument().getLineNumber(visualLineStartOffset),
       currentOrPrevWrapIndex,
       nextFoldingIndex,
       quickEvaluationListener);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:29,代碼來源:VisualLineFragmentsIterator.java

示例5: VisualLineFragmentsIterator

import com.intellij.openapi.editor.impl.SoftWrapModelImpl; //導入方法依賴的package包/類
private VisualLineFragmentsIterator(EditorView view, int offset, boolean beforeSoftWrap, @Nullable Runnable quickEvaluationListener) {
  myQuickEvaluationListener = quickEvaluationListener;
  myView = view;
  EditorImpl editor = view.getEditor();
  myDocument = editor.getDocument();
  FoldingModelEx foldingModel = editor.getFoldingModel();
  FoldRegion[] regions = foldingModel.fetchTopLevel();
  myRegions = regions == null ? FoldRegion.EMPTY_ARRAY : regions;
  int visualLineStartOffset = EditorUtil.getNotFoldedLineStartOffset(editor, offset);

  SoftWrapModelImpl softWrapModel = editor.getSoftWrapModel();
  List<? extends SoftWrap> softWraps = softWrapModel.getRegisteredSoftWraps();
  int currentOrPrevWrapIndex = softWrapModel.getSoftWrapIndex(offset);
  if (currentOrPrevWrapIndex < 0) {
    currentOrPrevWrapIndex = - currentOrPrevWrapIndex - 2;
  }
  else if (beforeSoftWrap) {
    currentOrPrevWrapIndex--;
  }
  SoftWrap currentOrPrevWrap = currentOrPrevWrapIndex < 0 || currentOrPrevWrapIndex >= softWraps.size() ? null :
                               softWraps.get(currentOrPrevWrapIndex);
  SoftWrap followingWrap = (currentOrPrevWrapIndex + 1) >= softWraps.size() ? null : softWraps.get(currentOrPrevWrapIndex + 1);

  if (currentOrPrevWrap != null && currentOrPrevWrap.getStart() > visualLineStartOffset) {
    visualLineStartOffset = currentOrPrevWrap.getStart();
  }
  
  myVisualLineStartOffset = mySegmentStartOffset = visualLineStartOffset;

  myCurrentFoldRegionIndex = foldingModel.getLastCollapsedRegionBefore(mySegmentStartOffset) + 1;
  myCurrentEndLogicalLine = myDocument.getLineNumber(mySegmentStartOffset);
  if (mySegmentStartOffset == 0) {
    myCurrentX = myView.getPrefixTextWidthInPixels();
  }
  else if (currentOrPrevWrap != null && mySegmentStartOffset == currentOrPrevWrap.getStart()) {
    myCurrentX = currentOrPrevWrap.getIndentInPixels();
    myCurrentVisualColumn = currentOrPrevWrap.getIndentInColumns();
  }
  myNextWrapOffset = followingWrap == null ? Integer.MAX_VALUE : followingWrap.getStart();
  setFragmentIterator();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:42,代碼來源:VisualLineFragmentsIterator.java


注:本文中的com.intellij.openapi.editor.impl.SoftWrapModelImpl.getSoftWrapIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。