aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2023-11-06 08:58:31 +1100
committerNeil <nyamatongwe@gmail.com>2023-11-06 08:58:31 +1100
commitc9668d46c7209e8f1f86a109e9c41aac07232492 (patch)
tree13dd7667afa0ceae52097cafcd8f089cc13c269d
parent026058ceca31c336a6d76f248ae2510fe1b1247c (diff)
downloadscintilla-mirror-c9668d46c7209e8f1f86a109e9c41aac07232492.tar.gz
Ctrl-click on a selection deselects it in multiple selection mode.
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--src/Editor.cxx18
2 files changed, 19 insertions, 2 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 2e26d8900..b37d6bbf0 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -591,6 +591,9 @@
Released 18 November 2023.
</li>
<li>
+ Ctrl-click on a selection deselects it in multiple selection mode.
+ </li>
+ <li>
Add SCI_SELECTIONFROMPOINT for modifying multiple selections.
</li>
<li>
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 3018cc0bd..3421dc72d 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4789,8 +4789,22 @@ void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, KeyMod modi
hotSpotClickPos = newCharPos.Position();
}
if (!shift) {
- if (PointInSelection(pt) && !SelectionEmpty()) {
- inDragDrop = DragDrop::initial;
+ const ptrdiff_t selectionPart = SelectionFromPoint(pt);
+ if (selectionPart >= 0) {
+ if (multipleSelection && ctrl) {
+ // Deselect
+ if (sel.Count() > 1) {
+ DropSelection(selectionPart);
+ // Completed: don't want any more processing of this click
+ return;
+ } else {
+ // Switch to just the click position
+ SetSelection(newPos, newPos);
+ }
+ }
+ if (!sel.Range(selectionPart).Empty()) {
+ inDragDrop = DragDrop::initial;
+ }
}
}
ChangeMouseCapture(true);