Merge #10019: Fix regression relative to 2.6: add newlines if indent=0

Patch by Amaury Forgeot d'Arc, updated by Sando Tosi.