* @param pos an offset within the document
* @param searchForward the direction of the search
* @return the next position to query
*/
public int getNextPosition(int pos, boolean searchForward) {
final ITypedRegion partition= getPartition(pos);
if (partition == null) return simpleIncrement(pos, searchForward);
if (fPartition.equals(partition.getType()))
return simpleIncrement(pos, searchForward);
if (searchForward) {
int end= partition.getOffset() + partition.getLength();
if (pos < end)
return end;
} else {
int offset= partition.getOffset();
if (pos > offset)
return offset - 1;
}
return simpleIncrement(pos, searchForward);
}