aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2009-07-21 08:19:28 +0000
committernyamatongwe <devnull@localhost>2009-07-21 08:19:28 +0000
commit3b1b6e1a5bff76b6055456ce841c9a18c23f8748 (patch)
treeb33f67eee05d1296114dc5dc71d058723d678989
parent0ff5fa2cd5ce684ca3a9164cf897e5060c5a7c9a (diff)
downloadscintilla-mirror-3b1b6e1a5bff76b6055456ce841c9a18c23f8748.tar.gz
Added commands for rotating selections and swapping caret and anchor of
main selection.
-rw-r--r--include/Scintilla.h2
-rw-r--r--include/Scintilla.iface6
-rw-r--r--src/Editor.cxx10
-rw-r--r--src/Selection.cxx4
-rw-r--r--src/Selection.h1
5 files changed, 23 insertions, 0 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 5986715a5..e20935d02 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -759,6 +759,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETADDITIONALSELALPHA 2603
#define SCI_SETADDITIONALCARETFORE 2604
#define SCI_GETADDITIONALCARETFORE 2605
+#define SCI_ROTATESELECTION 2606
+#define SCI_SWAPMAINANCHORCARET 2607
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 5367169f2..d2682a18e 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -2031,6 +2031,12 @@ set void SetAdditionalCaretFore=2604(colour fore,)
# Get the foreground colour of additional carets.
get colour GetAdditionalCaretFore=2605(,)
+# Set the main selection to the next selection.
+fun void RotateSelection=2606(,)
+
+# Swap that caret and anchor of the main selection.
+fun void SwapMainAnchorCaret=2607(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 3085bd6ec..317b3f4a6 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -8289,6 +8289,16 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_GETADDITIONALCARETFORE:
return vs.additionalCaretColour.desired.AsLong();
+ case SCI_ROTATESELECTION:
+ sel.RotateMain();
+ InvalidateSelection(sel.RangeMain(), true);
+ break;
+
+ case SCI_SWAPMAINANCHORCARET:
+ InvalidateSelection(sel.RangeMain());
+ sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret);
+ break;
+
default:
return DefWndProc(iMessage, wParam, lParam);
}
diff --git a/src/Selection.cxx b/src/Selection.cxx
index 1ea5f1bbe..246cfe709 100644
--- a/src/Selection.cxx
+++ b/src/Selection.cxx
@@ -328,3 +328,7 @@ void Selection::RemoveDuplicates() {
}
}
+void Selection::RotateMain() {
+ mainRange = (mainRange + 1) % ranges.size();
+}
+
diff --git a/src/Selection.h b/src/Selection.h
index 2c4ee120b..ff13f2130 100644
--- a/src/Selection.h
+++ b/src/Selection.h
@@ -156,6 +156,7 @@ public:
int VirtualSpaceFor(int pos) const;
void Clear();
void RemoveDuplicates();
+ void RotateMain();
};
#ifdef SCI_NAMESPACE