diff options
author | nyamatongwe <unknown> | 2009-07-15 23:50:36 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2009-07-15 23:50:36 +0000 |
commit | 4e11c05935799050dbacbe689b47143ddee728eb (patch) | |
tree | b8ef2601c062e93bc8fc1b619aba7283a5c3dda7 /src/Selection.cxx | |
parent | b9cb2eb38f6dc23b2b6a46d59de2436b2b9824da (diff) | |
download | scintilla-mirror-4e11c05935799050dbacbe689b47143ddee728eb.tar.gz |
Remove duplicate carets after Delete or Backspace.
Adding 1 to size returned for GetSelText so that container will allocate
enough memory to hold \0 for empty selection.
Diffstat (limited to 'src/Selection.cxx')
-rw-r--r-- | src/Selection.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Selection.cxx b/src/Selection.cxx index 43607b244..1ea5f1bbe 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -310,3 +310,21 @@ void Selection::Clear() { ranges[mainRange].Reset(); rangeRectangular.Reset(); } + +void Selection::RemoveDuplicates() { + for (size_t i=0; i<ranges.size()-1; i++) { + if (ranges[i].Empty()) { + size_t j=i+1; + while (j<ranges.size()) { + if (ranges[i] == ranges[j]) { + ranges.erase(ranges.begin() + j); + if (mainRange >= j) + mainRange--; + } else { + j++; + } + } + } + } +} + |