int (int minLookupItemPrefixLength, boolean considerPrefixes) { int start = getPivotOffset() - minLookupItemPrefixLength; if (considerPrefixes) { start = start - myAdditionalPrefix.length() + myRemovedPrefix; } start = MathUtil.clamp(start, 0, myEditor.getDocument().getTextLength()); return start; }