nl: move indentation calculation out of the inner loop