From a1a06bee7e5bfd784f088dc65c5e778d751d2566 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Nov 2015 03:43:32 +0100 Subject: [PATCH] Set up standard key mappings in wxSTC under OS X Let users use the familiar key combinations which don't work out of the box in Scintilla for some reason. Closes #16243. --- src/stc/ScintillaWX.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 1372a90b8a..5186c608a4 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -282,6 +282,25 @@ void ScintillaWX::Initialise() { stc->SetDropTarget(dropTarget); #endif // wxUSE_DRAG_AND_DROP vs.extraFontFlag = true; // UseAntiAliasing + + // Set up default OS X key mappings. Remember that SCI_CTRL stands for + // "Cmd" key here, as elsewhere in wx API, while SCI_ALT is the "Option" + // key (and "Ctrl" key, if we ever need it, should be represented by + // SCI_META). +#if __WXMAC__ + kmap.AssignCmdKey(SCK_LEFT, SCI_CTRL, SCI_VCHOME); + kmap.AssignCmdKey(SCK_RIGHT, SCI_CTRL, SCI_LINEEND); + kmap.AssignCmdKey(SCK_LEFT, SCI_ALT, SCI_WORDLEFT); + kmap.AssignCmdKey(SCK_RIGHT, SCI_ALT, SCI_WORDRIGHT); + kmap.AssignCmdKey(SCK_LEFT, SCI_ALT | SCI_SHIFT, SCI_WORDLEFTEXTEND); + kmap.AssignCmdKey(SCK_RIGHT, SCI_ALT | SCI_SHIFT, SCI_WORDRIGHTEXTEND); + kmap.AssignCmdKey(SCK_LEFT, SCI_CTRL | SCI_SHIFT, SCI_VCHOMEEXTEND); + kmap.AssignCmdKey(SCK_RIGHT, SCI_CTRL | SCI_SHIFT, SCI_LINEENDEXTEND); + kmap.AssignCmdKey(SCK_UP, SCI_CTRL | SCI_SHIFT, SCI_DOCUMENTSTARTEXTEND); + kmap.AssignCmdKey(SCK_DOWN, SCI_CTRL | SCI_SHIFT, SCI_DOCUMENTENDEXTEND); + kmap.AssignCmdKey(SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART); + kmap.AssignCmdKey(SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND); +#endif // __WXMAC__ }