Ejemplo n.º 1
0
  private boolean isSingleLineChange(
      @NotNull CharSequence prevText, int start, int end, @NotNull CharSequence replacement) {
    if (start == 0 && end == myLength && replacement.length() == 0) return false;

    int startLine = findLineIndex(start);
    return startLine == findLineIndex(end)
        && !CharArrayUtil.containLineBreaks(replacement)
        && !isLastEmptyLine(startLine);
  }
Ejemplo n.º 2
0
 private boolean needToShiftWhiteSpaces(final DocumentEvent e) {
   if (!CharArrayUtil.containsOnlyWhiteSpaces(e.getNewFragment())
       || CharArrayUtil.containLineBreaks(e.getNewFragment())) return e.getOldLength() > 0;
   if (e.getOffset() == 0) return false;
   final char charBefore = myEditor.getDocument().getCharsSequence().charAt(e.getOffset() - 1);
   // final char charAfter = myEditor.getDocument().getCharsSequence().charAt(e.getOffset() +
   // e.getNewLength());
   return Character.isWhitespace(charBefore) /* || !Character.isWhitespace(charAfter)*/;
 }
    protected final void locateToken() {
      if (myTokenType != null) return;
      _locateToken();

      if (myTokenType == ScalaDocTokenType.DOC_WHITESPACE) {
        myAfterLineBreak =
            CharArrayUtil.containLineBreaks(myBuffer, getTokenStart(), getTokenEnd());
      }
    }