Skip to content

v0.4.0

Compare
Choose a tag to compare
@WGUNDERWOOD WGUNDERWOOD released this 31 Aug 15:43
· 154 commits to main since this release

Breaking change

The logic for line wrapping has been changed. Previously, for lines longer than 80 characters, we would break the line at suitable points into chunks of no more than 80 characters. Then another round of indenting was applied, and this would often push the length back over 80 characters. A subsequent round of wrapping was therefore required, and often led to the creation of very short lines (#6).

The new approach is to take lines longer than 80 characters and remove the first segment up to 70 characters, pushing the resulting two lines back onto the queue. When indenting is then reapplied, the lines typically do not go over 80 characters unless the indentation is very deep. However, some lines may now be truncated to 70 characters rather than 80.

Other updates

  • Added a --keep flag to disable line wrapping (#10)
  • Improved the central algorithm to avoid multiple passes and improve run-time performance (#7)
  • Only write the file to disk if the formatting returns a different string, to avoid unnecessary editing of modification times