private ListingTextField getTextFieldForOptions(Instruction instr, String[] comments,
			String[] autoComment, List<String> offcutComments, ProxyObj<?> proxy, int xStart) {
		Listing listing = instr.getProgram().getListing();
		Address addr = instr.getMinAddress();
		FlowType flowType = instr.getFlowType();
		Color color = CommentColors.POST;

		// Options that affect Post Comments:
		//   Flag Function Exits (only if post comment does not exist)
		//   Flag Jumps and Returns (only if post comment does not exist)
		//   Number of Lines After Block

		if (comments == null || comments.length == 0) {
			if (flagFunctionExits) {
				Function function = listing.getFunctionContaining(addr);
				if (function != null) {
					if (flagFunctionExits && (flowType.isTerminal())) {
						String[] str = new String[] {
							FUN_EXIT_FLAG_LEADER + function.getName() + FUN_EXIT_FLAG_TAIL };

						return getTextField(str, autoComment, offcutComments, proxy, xStart, true);
					}
				}
			}
			// Add Jump/Terminator
			if (flagJMPsRETs && !instr.hasFallthrough()) {
				String[] str = new String[] { DEFAULT_FLAG_COMMENT };
				return getTextField(str, autoComment, offcutComments, proxy, xStart, true);
			}
		}

		if (nLinesAfterBlocks > 0 || flagJMPsRETs) {
			// If this instruction is in a delay slot, then it is the end of a block.
			boolean endOfBlock = !instr.hasFallthrough() || instr.isInDelaySlot();

			if (endOfBlock && flagJMPsRETs && (comments == null || comments.length == 0)) {
				comments = new String[] { DEFAULT_FLAG_COMMENT };
			}
			if (!endOfBlock) {
				boolean deferEndOfBlock = false;
				CodeUnit nextCu = getNextCodeUnit(instr);
				if (nextCu instanceof Instruction) {
					Instruction nextInstr = (Instruction) nextCu;
					FlowType nextFlowType = nextInstr.getFlowType();
					deferEndOfBlock =
						(!nextInstr.hasFallthrough() || nextFlowType == RefType.CONDITIONAL_JUMP ||
							nextFlowType == RefType.CONDITIONAL_TERMINATOR);
				}
				if (!deferEndOfBlock && (flowType == RefType.CONDITIONAL_JUMP ||
					flowType == RefType.CONDITIONAL_TERMINATOR)) {
					endOfBlock = true;
				}
			}
			if (endOfBlock) {
				if (comments == null) {
					comments = EMPTY_STRING_ARRAY;
				}
				if (autoComment == null) {
					autoComment = EMPTY_STRING_ARRAY;
				}
				int nLinesAutoComment =
					(comments.length == 0 || alwaysShowAutomatic) ? autoComment.length : 0;
				AttributedString prototypeString =
					new AttributedString("prototype", color, getMetrics());
				int commentLineCount = comments.length + nLinesAfterBlocks + nLinesAutoComment;
				List<FieldElement> elements = new ArrayList<>(commentLineCount);
				if (commentLineCount > 0) {
					for (int i = 0; i < nLinesAutoComment; i++) {
						AttributedString as = new AttributedString(autoComment[i],
							CommentColors.AUTO, getMetrics(automaticCommentStyle), false, null);
						elements.add(new TextFieldElement(as, i, 0));
					}
					for (int i = 0; i < comments.length; i++) {
						int index = nLinesAutoComment + i;
						elements.add(CommentUtils.parseTextForAnnotations(comments[i],
							instr.getProgram(), prototypeString, index));
					}
					for (int i = commentLineCount - nLinesAfterBlocks; i < commentLineCount; i++) {
						// add blank lines for end-of-block
						AttributedString as = new AttributedString("", color, getMetrics());
						elements.add(new TextFieldElement(as, i, 0));
					}
					return ListingTextField.createMultilineTextField(this, proxy, elements, xStart,
						width, hlProvider);
				}
			}
		}
		return getTextField(comments, autoComment, offcutComments, proxy, xStart, false);
	}
Adjust the Automatic Comment display options if the associated options changed.
@param options the Display Options object that changed.
@param optionName the name of the property that changed.
@param oldValue the old value of the property.
@param newValue the new value of the property.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/PostCommentFieldFactory.java