private int getWordAtOffsetEnd(int offset, boolean isCamel) {
      Document document = editor.getDocument();
      if (offset >= document.getTextLength() - 1 || document.getLineCount() == 0) {
        return offset;
      }
      int newOffset = offset;
      int lineNumber = editor.offsetToLogicalPosition(offset).line;
      int maxOffset = document.getLineEndOffset(lineNumber);
      if (newOffset > maxOffset) {
        if (lineNumber + 1 >= document.getLineCount()) {
          return offset;
        }
        maxOffset = document.getLineEndOffset(lineNumber + 1);
      }
      for (; newOffset < maxOffset; newOffset++) {
        if (EditorActionUtil.isWordOrLexemeEnd(editor, newOffset, isCamel)) {
          break;
        }
      }

      return newOffset;
    }
private int getWordAtOffsetEnd(int offset, boolean isCamel)