aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-10-16 14:12:03 +1100
committerNeil <nyamatongwe@gmail.com>2014-10-16 14:12:03 +1100
commit98b4417eb304b428ea1344e2c8853b7ef021864c (patch)
tree07dd5eb0fb9638078eb7f8cd643670c7a9051351 /src
parentbbab5f56e60c1a33c0316c8113926567a49bef77 (diff)
downloadscintilla-mirror-98b4417eb304b428ea1344e2c8853b7ef021864c.tar.gz
Explain how multiple selections are processed.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index ebe65f1fa..bd15ac74e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1790,12 +1790,15 @@ void Editor::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) {
{
UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike);
+ // Vector elements point into selection in order to change selection.
std::vector<SelectionRange *> selPtrs;
for (size_t r = 0; r < sel.Count(); r++) {
selPtrs.push_back(&sel.Range(r));
}
+ // Order selections by position in document.
std::sort(selPtrs.begin(), selPtrs.end(), cmpSelPtrs);
+ // Loop in reverse to avoid disturbing positions of selections yet to be processed.
for (std::vector<SelectionRange *>::reverse_iterator rit = selPtrs.rbegin();
rit != selPtrs.rend(); ++rit) {
SelectionRange *currentSel = *rit;