aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2013-04-16 12:42:47 +1000
committernyamatongwe <devnull@localhost>2013-04-16 12:42:47 +1000
commitb2a885541dcc4466851bea72f1e42993d3db48e1 (patch)
treefe156752e8695992f28ec85a85582ed63c2605ef
parent15953654d7b0bc06f1cf6a767b7aaf7dfdbb07fe (diff)
downloadscintilla-mirror-b2a885541dcc4466851bea72f1e42993d3db48e1.tar.gz
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.
-rw-r--r--src/Selection.cxx12
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) {