src/vs/editor/common/modelLineProjectionData.ts/ModelLineProjectionData/normalizeOutputPosition
class ModelLineProjectionData:	public normalizeOutputPosition(outputLineIndex: number, outputOffset: number, affinity: PositionAffinity): OutputPosition {
		if (this.injectionOffsets !== null) {
			const offsetInInputWithInjections = this.outputPositionToOffsetInInputWithInjections(outputLineIndex, outputOffset);
			const normalizedOffsetInUnwrappedLine = this.normalizeOffsetInInputWithInjectionsAroundInjections(offsetInInputWithInjections, affinity);
			if (normalizedOffsetInUnwrappedLine !== offsetInInputWithInjections) {
				// injected text caused a change
				return this.offsetInInputWithInjectionsToOutputPosition(normalizedOffsetInUnwrappedLine, affinity);
			}
		}

		if (affinity === PositionAffinity.Left) {
			if (outputLineIndex > 0 && outputOffset === this.getMinOutputOffset(outputLineIndex)) {
				return new OutputPosition(outputLineIndex - 1, this.getMaxOutputOffset(outputLineIndex - 1));
			}
		}
		else if (affinity === PositionAffinity.Right) {
			const maxOutputLineIndex = this.getOutputLineCount() - 1;
			if (outputLineIndex < maxOutputLineIndex && outputOffset === this.getMaxOutputOffset(outputLineIndex)) {
				return new OutputPosition(outputLineIndex + 1, this.getMinOutputOffset(outputLineIndex + 1));
			}
		}

		return new OutputPosition(outputLineIndex, outputOffset);
	}