fix: speed up alternate-screen history reads (#2426)