summaryrefslogtreecommitdiffstats
path: root/scintilla/src/Selection.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'scintilla/src/Selection.cxx')
-rw-r--r--scintilla/src/Selection.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/scintilla/src/Selection.cxx b/scintilla/src/Selection.cxx
index 7192a2a..a708a53 100644
--- a/scintilla/src/Selection.cxx
+++ b/scintilla/src/Selection.cxx
@@ -20,14 +20,18 @@ using namespace Scintilla;
#endif
void SelectionPosition::MoveForInsertDelete(bool insertion, int startChange, int length) {
- if (position == startChange) {
- virtualSpace = 0;
- }
if (insertion) {
- if (position > startChange) {
+ if (position == startChange) {
+ int virtualLengthRemove = std::min(length, virtualSpace);
+ virtualSpace -= virtualLengthRemove;
+ position += virtualLengthRemove;
+ } else if (position > startChange) {
position += length;
}
} else {
+ if (position == startChange) {
+ virtualSpace = 0;
+ }
if (position > startChange) {
int endDeletion = startChange + length;
if (position > endDeletion) {