private void startConversionForRegion(boolean toUpperCase) {
    int currentOffset = myReplacement.length();
    CaseConversionRegion lastRegion = myConversionRegions.isEmpty() ? null : myConversionRegions.get(myConversionRegions.size() - 1);
    if (lastRegion == null) {
      myConversionRegions.add(new CaseConversionRegion(currentOffset, -1, toUpperCase));
    }
    else if (lastRegion.start == currentOffset) {
      lastRegion.end = -1;
      lastRegion.toUpperCase = toUpperCase;
    }
    else {
      if (lastRegion.end == -1) {
        if (lastRegion.toUpperCase == toUpperCase) {
          return;
        }
        lastRegion.end = currentOffset;
      }
      myConversionRegions.add(new CaseConversionRegion(currentOffset, -1, toUpperCase));
    }
  }
private void startConversionForRegion(boolean toUpperCase)