Say I create n selections, in order from a low position to a large one, and call SetMainSelection(0). As I type, the first caret is in the view, which is what I want. But if I undo, or redo, the view shows the last selection. I would expect that Scintilla can associate the main-selection with an undo group working on a set of selections, even through multiple undo/redo sequences.
Selection data is view-specific and is not stored in the undo history at all.
The workaround is straightforward, so I'm fine marking this bug WONTFIX or BYDESIGN
Whoa. My mistake. The workaround for the multi-selection UNDOs was straightforward, but so was the patch. This one's hard, and I've seen it before -- view-state is not part of the undo stack, and it's hard for our application to maintain it as well.
Its quite reasonable to include selection data in the undo stack but it would have to be properly thought through and should be optional.
There are issues like whether its attached only to modifications or whether other movements are remembered. Also how this applies when there are multiple views: do selection events get remembered only for the view they occur in? This issue is way down my list of things that might be worked on in the distant future.