Attached patch adds a mayCoalesce argument to BeginUndoAction calls, though it's only exposed through the qt document class that Wing uses. This is used to coalesce the adding of and import xxx at the top of the file with the insertion of xxx further down so that both will be removed by a single undo. Wing has used this for about a year and I've updated it for the recent undo changes.
The line numbers in the diff may be off by a bit from the latest in the scintilla repository.
This appears worthwhile.
There are some more in-progress additions to the recent undo changes to make change history work so I'll look at committing this after they are complete.
Committed with [b06c07]. Slightly different to patch: added 'noexcept' to match recent commits and changed spacing.
Related
Commit: [b06c07]