Real-time dispersion compensation in scanning interferometry