abrookins / WrapToColumn

An IntelliJ plugin that wraps text
Apache License 2.0
62 stars 12 forks source link

Inconsistent text width using minimum raggedness algorithm #35

Open rljacobson opened 4 years ago

rljacobson commented 4 years ago

I get different paragraph widths, sometimes dramatically different, within the same source file. This appears to occur only when using the minimum raggedness algorithm.

Screenshots of the inconsistent behavior between the two algorithms are attached. In case it is relevant, I have set visual markers at 80 characters and at 100 characters, and I have it set to hard wrap at 100 characters.

I hate to suggest this, especially given my own personal inclinations, but... As interesting as the SMAWK algorithm is, in practice it is likely to provide an advantage only in the most esoteric applications none of which are likely to be realizable within IntelliJ. The simplest dynamic programming algorithm, despite its O(n^2) asymptotic running time, is simpler, shorter, and likely runs faster for any given input it will ever see as an IntelliJ plugin.

Not that I'm criticizing. I totally would have implemented SMAWK, too! My point is only that, from the perspective of maintenance, bug squashing, and checking correctness, it might be worth swapping it out for the simple undergraduate version.

Thank you for such a useful plugin!

Screen Shot 2020-06-20 at 1 29 02 AM Screen Shot 2020-06-20 at 1 30 20 AM
abrookins commented 4 years ago

@rljacobson Truer words were never spoken. One day I’ll have more time for this plugin... 😂