diff options
| author | Neil <nyamatongwe@gmail.com> | 2014-10-16 14:12:03 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2014-10-16 14:12:03 +1100 | 
| commit | f295b548b05180da122ca25f8fd12302212ca6d2 (patch) | |
| tree | 7a9f0e14e01f00ccd725f23164862515f49dc93f /src/Editor.cxx | |
| parent | 58fe73196352562c405f8fddda13533989a85b30 (diff) | |
| download | scintilla-mirror-f295b548b05180da122ca25f8fd12302212ca6d2.tar.gz | |
Explain how multiple selections are processed.
Diffstat (limited to 'src/Editor.cxx')
| -rw-r--r-- | src/Editor.cxx | 3 | 
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;  | 
