This patch is very similar to D17949 but in this state not a full replacement for that.
Here is some core function touched which need some watchfulness to make it not even worse.
Here is the existing behavior what will wrapped without a selection not changed.
With this patch could be D17949 simplified or perhaps their extra features added here.
This patch has in static wrap mode the potential to re-wrap the paragraph nicely on-the-fly, similar to dynamic wrap, whereas without this patch only the current line is wrapped, but not the following, with the result that the paragraph became cluttered or the preceding line with the result that the paragraph became not optimal wrapped in some situations.
Looking at other code parts indicate that this behavior is/was desired but seems to got lost at sometime. See also D19051, which looks with this patch obsolete.
- The "auto-rewrap" can only work when the text is fresh entered, not after some load from disk. Doing a join of the paragraph should trigger the needed change
- The old wrapText function is now split in three functions
- The new wrapLine function is very close to old code but some variables are renamed
Issues which needs to be fixed
- Based on TextLine::isAutoWrapped. This info gets lost when you undo some change
- There may cases where the user wants to remove the isAutoWrapped flag
The cursor is sometimes misplaced, see pic where the x was DELeted and should be now in line 1 in the middle of the bbbbHint: It was not DEL key but BACKSPACE