aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Selection.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-04-16 12:42:47 +1000
committernyamatongwe <unknown>2013-04-16 12:42:47 +1000
commit5fb251b685ce02476ca250d43dd56b92e538cc44 (patch)
tree3c884e97bd6596ac98b7d46eac9534639264eb19 /src/Selection.cxx
parent780d4783d8e360202b940f6e5fc7997682e4df37 (diff)
downloadscintilla-mirror-5fb251b685ce02476ca250d43dd56b92e538cc44.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.
Diffstat (limited to 'src/Selection.cxx')
-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) {