Examples of IntRange


Examples of org.waveprotocol.wave.model.util.IntRange

  }

  @Override
  public IntRange getFocusBounds() {
    // NOTE(user): Consider returning the bottom here as well in the range.
    return new IntRange(getFocusPosition().top);
  }
View Full Code Here

Examples of winterwell.utils.containers.IntRange

    int start = s.getStartLine();
    int end = s.getEndLine();
    IDocument doc = ed.getDocument();
    int soff = doc.getLineOffset(start);
    int eoff = lineEndOffset(end, doc);   
    IntRange editedRegion = new IntRange(soff, eoff);   
    MarkdownPage page = ed.getMarkdownPage();
    StringBuilder sb = new StringBuilder(s.getLength());
    for(int i=start; i<=end; i++) {
      IRegion para = getParagraph(page, i, ed.getDocument());
      if (para==null) {
        sb.append(page.getText().get(i));
        continue;
      }
      String paragraph = ed.getDocument().get(para.getOffset(), para.getLength());
//      int lines = StrUtils.splitLines(paragraph).length;
      String formatted = MarkdownFormatter.format(paragraph, cols);
      // append formatted and move forward
      sb.append(formatted);
      CharSequence le = lineEnd(i, doc);
      sb.append(le);
      int pEnd = doc.getLineOfOffset(para.getOffset()+para.getLength());
      i = pEnd;
      // Adjust edited region?
      IntRange pr = new IntRange(para.getOffset(),
          para.getOffset()+para.getLength()+le.length());     
      editedRegion = new IntRange(Math.min(pr.low, editedRegion.low),
                    Math.max(pr.high, editedRegion.high));     
    }   
    // Replace the unformatted region with the new formatted one
    String old = doc.get(editedRegion.low, editedRegion.size());
    String newText = sb.toString();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.