aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Selection.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-12-17 14:16:29 +1100
committerNeil <nyamatongwe@gmail.com>2013-12-17 14:16:29 +1100
commit9fa594e3ebde4d884afe9626be086143cf0adaf8 (patch)
tree365e091d2d9408d27ca8319d47621f8f6a422f7e /src/Selection.cxx
parent5d1381f5b22d9999cad3d208268b7d976b478b54 (diff)
downloadscintilla-mirror-9fa594e3ebde4d884afe9626be086143cf0adaf8.tar.gz
Added DropSelectionN API.
Diffstat (limited to 'src/Selection.cxx')
-rw-r--r--src/Selection.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Selection.cxx b/src/Selection.cxx
index 0c02c198b..ae4d8bfc7 100644
--- a/src/Selection.cxx
+++ b/src/Selection.cxx
@@ -305,6 +305,21 @@ void Selection::AddSelectionWithoutTrim(SelectionRange range) {
mainRange = ranges.size() - 1;
}
+void Selection::DropSelection(size_t r) {
+ if ((ranges.size() > 1) && (r < ranges.size())) {
+ size_t mainNew = mainRange;
+ if (mainNew >= r) {
+ if (mainNew == 0) {
+ mainNew = ranges.size() - 2;
+ } else {
+ mainNew--;
+ }
+ }
+ ranges.erase(ranges.begin() + r);
+ mainRange = mainNew;
+ }
+}
+
void Selection::TentativeSelection(SelectionRange range) {
if (!tentativeMain) {
rangesSaved = ranges;