protected boolean gatherLineText(StringBuilder sb, int startRow, int startCol, int endRow,
			int endCol, int i, VtLine line, CharSequence lineSep) {
		if (i < startRow) {
			return false;
		}
		if (i == startRow && startRow == endRow) {
			line.gatherText(sb, startCol, endCol);
			return true;
		}
		if (i == startRow) {
			line.gatherText(sb, startCol, cols);
			sb.append(lineSep);
			return false;
		}
		if (i == endRow) {
			line.gatherText(sb, 0, endCol);
			return true;
		}
		if (i > endRow) {
			return true;
		}
		line.gatherText(sb, 0, cols);
		sb.append(lineSep);
		return false;
	}
This is essentially the loop body for {@link #getText(int, int, int, int, CharSequence)}. It
is factored into a separate method, because we need to loop over the scroll-back buffer as
well as the display buffer, and we want the same body.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/vt/VtBuffer.java