private LocationMemento previousFunction(Navigatable navigatable, boolean moveTo) {
			if (list.isEmpty()) {
				return null;
			}

			Function startFunction = getPreviousStartFunction(navigatable);
			for (int i = currentLocation - 1; i >= 0; i--) {

				LocationMemento memento = list.get(i);
				ProgramLocation otherLocation = memento.getProgramLocation();
				Address address = otherLocation.getAddress();
				FunctionManager functionManager = otherLocation.getProgram().getFunctionManager();
				Function historyFunction = functionManager.getFunctionContaining(address);

				if (historyFunction != null && !historyFunction.equals(startFunction)) {
					if (moveTo) {
						currentLocation = i;
					}
					return memento;
				}
			}

			return null;
		}
Find the previous history LocationMemento that contains a different function. If no such
LocationMemento is found, null is returned.

@param navigatable the navigatable being navigated
@param moveTo true means after finding, get current location to it. false to just find
           and do nothing
@return previous LocationMemento, or null if no previous function found
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NavigationHistoryPlugin.java