Fixed regression in --infill-only-where-needed. Includes a minimal test suite for such feature. #1871