From b08335168f56212c7d9ae9f236f8fac0746ba090 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 26 Nov 2019 09:09:26 +1100 Subject: Bug [#2140]. Fix where anchor and caret differ only in amount of virtual space so one was considered start and was moved for an insertion at that position. This could flip the order of the positions or change the length of the selection. --- src/Selection.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Selection.cxx b/src/Selection.cxx index e47ace127..4a397b4aa 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -96,8 +96,8 @@ void SelectionRange::MoveForInsertDelete(bool insertion, Sci::Position startChan // which position is the start and pass this into // SelectionPosition::MoveForInsertDelete. // There isn't any reason to move an empty selection so don't move it. - const bool caretStart = caret < anchor; - const bool anchorStart = anchor < caret; + const bool caretStart = caret.Position() < anchor.Position(); + const bool anchorStart = anchor.Position() < caret.Position(); caret.MoveForInsertDelete(insertion, startChange, length, caretStart); anchor.MoveForInsertDelete(insertion, startChange, length, anchorStart); -- cgit v1.2.3