I really like how wrapLines just does the right thing when lines are commented out. However, there seems to be a bug in it when wrapping indented lines. Here are three comments, all intended to wrap at character 80:
// |
// This should never happen, because if we don't recognize the type we should |
// have already returned. |
// |
|
// |
// This should never happen, because if we don't |
// recognize the type we should have already |
// returned. |
// |
|
// |
// This should never |
// happen, because if |
// we don't recognize |
// the type we should |
// have already |
// returned. |
// |
The second paragraph was indented a bit and wrapping oddly (i.e., it’s staying too far from the ruler at 80), so I indented it even more and re-wrapped. As you can see, the effect is dramatic. As far as I can tell, the distance from the ruler depends on the indentation level.