diff options
author | Neil <nyamatongwe@gmail.com> | 2014-07-07 23:51:04 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-07-07 23:51:04 +1000 |
commit | ee6a5a8ecf0498fd2bc48803335f858eccfece69 (patch) | |
tree | 46470b53c6173a9b3bfce1166ed1021768ea753c /src | |
parent | 8b5aaf5c4aca7f6369adbba839e4c7366e9bf8a3 (diff) | |
download | scintilla-mirror-ee6a5a8ecf0498fd2bc48803335f858eccfece69.tar.gz |
Fix bug where too many characters may be deleted when a rectangular selection is
deleted.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 1 | ||||
-rw-r--r-- | src/Selection.cxx | 11 | ||||
-rw-r--r-- | src/Selection.h | 1 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index db0aecf43..d3e5f3090 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4321,6 +4321,7 @@ void Editor::DelChar() { } void Editor::DelCharBack(bool allowLineStartDeletion) { + RefreshStyleData(); if (!sel.IsRectangular()) FilterSelections(); if (sel.IsRectangular()) diff --git a/src/Selection.cxx b/src/Selection.cxx index b46dca890..52ed5774e 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -81,6 +81,11 @@ int SelectionRange::Length() const { } } +void SelectionRange::MoveForInsertDelete(bool insertion, int startChange, int length) { + caret.MoveForInsertDelete(insertion, startChange, length); + anchor.MoveForInsertDelete(insertion, startChange, length); +} + bool SelectionRange::Contains(int pos) const { if (anchor > caret) return (pos >= caret.Position()) && (pos <= anchor.Position()); @@ -283,9 +288,11 @@ int Selection::Length() const { void Selection::MovePositions(bool insertion, int startChange, int length) { for (size_t i=0; i<ranges.size(); i++) { - ranges[i].caret.MoveForInsertDelete(insertion, startChange, length); - ranges[i].anchor.MoveForInsertDelete(insertion, startChange, length); + ranges[i].MoveForInsertDelete(insertion, startChange, length); } + if (selType == selRectangle) { + rangeRectangular.MoveForInsertDelete(insertion, startChange, length); + } } void Selection::TrimSelection(SelectionRange range) { diff --git a/src/Selection.h b/src/Selection.h index 9e95fb043..499f83771 100644 --- a/src/Selection.h +++ b/src/Selection.h @@ -115,6 +115,7 @@ struct SelectionRange { anchor.SetVirtualSpace(0); caret.SetVirtualSpace(0); } + void MoveForInsertDelete(bool insertion, int startChange, int length); bool Contains(int pos) const; bool Contains(SelectionPosition sp) const; bool ContainsCharacter(int posCharacter) const; |