diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Selection.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Selection.cxx b/src/Selection.cxx index 305d7219f..b0f4245e1 100644 --- a/src/Selection.cxx +++ b/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) { |