aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2010-06-26 00:29:26 +0000
committernyamatongwe <unknown>2010-06-26 00:29:26 +0000
commit931e0d9db65fd6b11bd8c220e3d89f0ce31e12d5 (patch)
treed33a8784e156c291258239cc4d5cefb07a05d146 /src/Editor.cxx
parent33af0cdef8e363d1c68e3658169b5870e7b44503 (diff)
downloadscintilla-mirror-931e0d9db65fd6b11bd8c220e3d89f0ce31e12d5.tar.gz
Fix for bug #3021480 Selection SC_SEL_LINES no longer works
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 69c83f388..8a0ad64c4 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -742,8 +742,20 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel
}
void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_) {
- SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_),
- ClampPositionIntoDocument(anchor_));
+ currentPos_ = ClampPositionIntoDocument(currentPos_);
+ anchor_ = ClampPositionIntoDocument(anchor_);
+ /* For Line selection - ensure the anchor and caret are always
+ at the beginning and end of the region lines. */
+ if (sel.selType == Selection::selLines) {
+ if (currentPos_ > anchor_) {
+ anchor_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(anchor_.Position())));
+ currentPos_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(currentPos_.Position())));
+ } else {
+ currentPos_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(currentPos_.Position())));
+ anchor_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(anchor_.Position())));
+ }
+ }
+ SelectionRange rangeNew(currentPos_, anchor_);
if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) {
InvalidateSelection(rangeNew);
}