diff options
author | nyamatongwe <devnull@localhost> | 2000-06-24 00:35:46 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-06-24 00:35:46 +0000 |
commit | 94b9dc447ea7ca09745e4a8e2d8786fda5655962 (patch) | |
tree | 1bb9e279d9cc08a6c6f649cf18c2e60326a06078 | |
parent | a53dd61d8a62229c0d3cc6f1afb314ae7e0fb8c3 (diff) | |
download | scintilla-mirror-94b9dc447ea7ca09745e4a8e2d8786fda5655962.tar.gz |
Added methods for getting and setting the start and end of the selection.rel-1-27
-rw-r--r-- | doc/ScintillaDoc.html | 7 | ||||
-rw-r--r-- | include/Scintilla.h | 6 | ||||
-rw-r--r-- | include/Scintilla.iface | 15 | ||||
-rw-r--r-- | src/Editor.cxx | 26 |
4 files changed, 49 insertions, 5 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 39bdb2003..3262ae660 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -154,12 +154,17 @@ EM_POSFROMCHAR(int position, POINT *location) EM_SELECTIONTYPE EM_HIDESELECTION(bool hide) SCI_GETLENGTH +SCI_SETCURRENTPOS(int position) SCI_GETCURRENTPOS +SCI_SETANCHOR(int position) SCI_GETANCHOR +SCI_SETSELECTIONSTART(int position) +SCI_GETSELECTIONSTART +SCI_SETSELECTIONEND(int position) +SCI_GETSELECTIONEND SCI_SELECTALL SCI_GOTOLINE(int line) SCI_GOTOPOS(int position) -SCI_SETANCHOR(int position) SCI_GETCURLINE(int textlen, char *text) SCI_LINELENGTH(int line) SCI_SETCARETPOLICY(int policy) diff --git a/include/Scintilla.h b/include/Scintilla.h index 04d67e78a..61c393324 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -229,7 +229,13 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance); #define SCI_GETCODEPAGE SCI_START + 137 #define SCI_GETCARETFORE SCI_START + 138 #define SCI_GETUSEPALETTE SCI_START + 139 + #define SCI_GETREADONLY SCI_START + 140 +#define SCI_SETCURRENTPOS SCI_START + 141 +#define SCI_SETSELECTIONSTART SCI_START + 142 +#define SCI_GETSELECTIONSTART SCI_START + 143 +#define SCI_SETSELECTIONEND SCI_START + 144 +#define SCI_GETSELECTIONEND SCI_START + 145 #define SCI_CALLTIPSHOW SCI_START + 200 #define SCI_CALLTIPCANCEL SCI_START + 201 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index d2195d3ef..36828e68e 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -481,6 +481,21 @@ get bool GetUsePalette=2139(,) # In read-only mode? get bool GetReadOnly=2140(,) +# Sets the position of the caret. +set void SetCurrentPos=2141(position pos,) + +# Sets the position that starts the selection - this becomes the anchor. +set void SetSelectionStart=2142(position pos,) + +# Returns the position at the start of the selection. +get position GetSelectionStart=2143(,) + +# Sets the position that ends the selection - this becomes the currentPosition. +set void SetSelectionEnd=2144(position pos,) + +# Returns the position at the end of the selection. +get position GetSelectionEnd=2145(,) + # Show a call tip containing a definition near position pos. fun void CallTipShow=2200(position pos, string definition) diff --git a/src/Editor.cxx b/src/Editor.cxx index abfa947f0..d55b88095 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3320,12 +3320,34 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { case SCI_GETCHARAT: return pdoc->CharAt(wParam); + case SCI_SETCURRENTPOS: + SetSelection(wParam, anchor); + break; + case SCI_GETCURRENTPOS: return currentPos; + case SCI_SETANCHOR: + SetSelection(currentPos, wParam); + break; + case SCI_GETANCHOR: return anchor; + case SCI_SETSELECTIONSTART: + SetSelection(Platform::Maximum(currentPos, wParam), wParam); + break; + + case SCI_GETSELECTIONSTART: + return Platform::Minimum(anchor, currentPos); + + case SCI_SETSELECTIONEND: + SetSelection(wParam, Platform::Minimum(anchor, wParam)); + break; + + case SCI_GETSELECTIONEND: + return Platform::Maximum(anchor, currentPos); + case SCI_GETSTYLEAT: if (static_cast<short>(wParam) >= pdoc->Length()) return 0; @@ -3387,10 +3409,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) { Redraw(); break; - case SCI_SETANCHOR: - SetSelection(currentPos, wParam); - break; - case SCI_GETCURLINE: { if (lParam == 0) return 0; |