The current approach alternates between indenting (adding spaces at the start of lines) and wrapping (inserting line breaks to shorten long lines) until convergence. This can result in multiple passes, which involves a lot of redundant work. It should be possible to reduce the number of required passes, ideally to a single pass through the file (possibly with some backtracking).
The current approach alternates between indenting (adding spaces at the start of lines) and wrapping (inserting line breaks to shorten long lines) until convergence. This can result in multiple passes, which involves a lot of redundant work. It should be possible to reduce the number of required passes, ideally to a single pass through the file (possibly with some backtracking).