From 5fb251b685ce02476ca250d43dd56b92e538cc44 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 16 Apr 2013 12:42:47 +1000 Subject: Move selections with virtual space more reasonably when real spaces inserted at their location by converting virtual space to real position changes up to the amount of virtual space. This allows multi-typing to work when two carets are located in virtual space on one line. --- src/Selection.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3