Rework keep extra spaces to remove only needed indentation
Rework of part of commit 431bdf7b that keeps spaces that aren't multiples of indent width. Instead of removing all leading whitespace and readding spaces later, remove only part that have to go keeping extra spaces untouched.