code: private int findCodeBlockEnd(TextCursor cursor, int blockStart) {
          int offset = blockStart + 3;
          int index;
          while ((index = cursor.text.indexOf(CODE_BLOCK, offset)) >= 0) {
              if (isGoodAnchor(cursor.text, index + 3)) {
                  return index + 3;
              }
              offset = index + 1;
          }
          return -1;
      }
docs: Searching for valid code block end
  
  @param cursor     text cursor
  @param blockStart start of expected code block
  @return code block end, -1 if not found