From 79d3de7e480099864a6f69c0f0d0f5701f83201a Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 19 Jul 2011 11:26:01 +1000 Subject: Added ScrollToStart and ScrollToEnd key commands for OS X. --- doc/ScintillaDoc.html | 13 ++++++++++++- include/Scintilla.h | 2 ++ include/Scintilla.iface | 6 ++++++ src/Editor.cxx | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index d39d95165..7a8f03e88 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -79,7 +79,7 @@

Scintilla Documentation

-

Last edited 2/July/2011 NH

+

Last edited 19/July/2011 NH

There is an overview of the internal design of Scintilla.
@@ -4419,6 +4419,12 @@ struct Sci_TextToFind { SCI_MOVESELECTEDLINESDOWN + + + SCI_SCROLLTOSTART + + SCI_SCROLLTOEND + @@ -4445,6 +4451,11 @@ struct Sci_TextToFind { as appropriate for SCI_[[VC]HOME|LINEEND]*.

+

The SCI_SCROLLTO[START|END] commands scroll the document to the start + or end without changing the selection. This is the expected behaviour of the home and + end keys on OS X. +

+

Key bindings

There is a default binding of keys to commands that is defined in the Scintilla source in diff --git a/include/Scintilla.h b/include/Scintilla.h index 99100d11c..403c0dce7 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -816,6 +816,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_RGBAIMAGESETHEIGHT 2625 #define SCI_MARKERDEFINERGBAIMAGE 2626 #define SCI_REGISTERRGBAIMAGE 2627 +#define SCI_SCROLLTOSTART 2628 +#define SCI_SCROLLTOEND 2629 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 28273f012..95e784e19 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2168,6 +2168,12 @@ fun void MarkerDefineRGBAImage=2626(int markerNumber, string pixels) # It has the width and height from RGBAImageSetWidth/Height fun void RegisterRGBAImage=2627(int type, string pixels) +# Scroll to start of document. +fun void ScrollToStart=2628(,) + +# Scroll to end of document. +fun void ScrollToEnd=2629(,) + # 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 78b2ac475..a94089e9f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4797,6 +4797,8 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar case SCI_VERTICALCENTRECARET: case SCI_MOVESELECTEDLINESUP: case SCI_MOVESELECTEDLINESDOWN: + case SCI_SCROLLTOSTART: + case SCI_SCROLLTOEND: break; // Filter out all others like display changes. Also, newlines are redundant @@ -5536,6 +5538,12 @@ int Editor::KeyCommand(unsigned int iMessage) { StartEndDisplayLine(sel.MainCaret(), false), 1), Selection::selStream); SetLastXChosen(); break; + case SCI_SCROLLTOSTART: + ScrollTo(0); + break; + case SCI_SCROLLTOEND: + ScrollTo(MaxScrollPos()); + break; } return 0; } @@ -8507,6 +8515,8 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_DOCUMENTSTARTEXTEND: case SCI_DOCUMENTEND: case SCI_DOCUMENTENDEXTEND: + case SCI_SCROLLTOSTART: + case SCI_SCROLLTOEND: case SCI_STUTTEREDPAGEUP: case SCI_STUTTEREDPAGEUPEXTEND: -- cgit v1.2.3