Only (re)format visible area, and some padding lines
This would be difficult to implement, but would be great for performance on very long documents. Might be more necessary when #9 is implemented, as streams could result in larger documents over time.
This qualifies as a "stretch goal", non-urgent and not needed for any specific release.
A default document limit of 2 MiB has been imposed which mostly removes this. Changing only the currently viewed lines gets difficult when you take into account scrolling and scroll position, and how the position in the document changes when lines take up more lines due to being wrapped when reformatted.
One solution would be to only reformat the visible lines and all the previous ones. Idk.