private int binarySearch(String text) {

		int sortedOrder = 1;

		// if sorted descending, then reverse the search direction and change the lookup text to 
		// so that a match will come after the range we seek, which is before the desired text
		// when sorted in reverse
		if (!isSortedAscending()) {
			sortedOrder = -1;
			int lastPos = text.length() - 1;
			char lastChar = text.charAt(lastPos);
			++lastChar;
			text = text.substring(0, lastPos) + lastChar;
		}

		int min = 0;
		int rows = getRowCount();
		int max = rows - 1;
		int col = lookupColumn;
		while (min < max) {

			// divide by 2; preserve the sign to prevent possible overflow issue
			int mid = (min + max) >>> 1;
			String value = getValueString(mid, col);
			int compare = text.compareToIgnoreCase(value);
			compare *= sortedOrder;

			if (compare < 0) {
				max = mid - 1;
			}
			else if (compare > 0) {
				min = mid + 1;
			}
			else { // exact match
				return mid;
			}
		}

		return min;
	}
Clients call this method when the user types keys

@param e the key event
Ghidra/Framework/Docking/src/main/java/docking/widgets/AutoLookup.java