pos = Utilities.getRowStart(this, pos); int rel = bookmarkChain.compareMark(pos); MarkFactory.ChainDrawMark mark = bookmarkChain.getCurMark(); if (rel <= 0) { // right at this line, go next if (mark != null) {
/** Get the position of the next bookmark. * @pos position from which to search * @wrap wrap around the end of document * @return position of the next bookmark or -1 if there is no mark */ public int getNextBookmark(int pos, boolean wrap) throws BadLocationException { try { pos = Utilities.getRowStart(this, pos); int rel = bookmarkChain.compareMark(pos); MarkFactory.ChainDrawMark mark = bookmarkChain.getCurMark(); if (rel <= 0) { // right at this line, go next if (mark != null) { if (mark.next != null) { return mark.next.getOffset(); } else { // last bookmark return (wrap && bookmarkChain.chain != null) ? bookmarkChain.chain.getOffset() : -1; } } else { // no marks return -1; } } else { // mark after pos return mark.getOffset(); } } catch (InvalidMarkException e) { Utilities.annotateLoggable(e); return 0; } }