diff options
-rw-r--r-- | include/Scintilla.h | 3 | ||||
-rw-r--r-- | include/Scintilla.iface | 11 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 25 |
3 files changed, 39 insertions, 0 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index ca207bffb..49863a320 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -612,6 +612,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETKEYWORDS 4005 #define SCI_SETLEXERLANGUAGE 4006 #define SCI_LOADLEXERLIBRARY 4007 +#define SCI_GETPROPERTY 4008 +#define SCI_GETPROPERTYEXPANDED 4009 +#define SCI_GETPROPERTYINT 4010 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 944a2f832..9193eeff1 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1658,6 +1658,17 @@ set void SetLexerLanguage=4006(, string language) # Load a lexer library (dll / so). fun void LoadLexerLibrary=4007(, string path) +# Retrieve a "property" value previously set with SetProperty. +fun int GetProperty=4008(string key, stringresult buf) + +# Retrieve a "property" value previously set with SetProperty, +# with "$()" variable replacement on returned buffer. +fun int GetPropertyExpanded=4009(string key, stringresult buf) + +# Retrieve a "property" value previously set with SetProperty, +# interpreted as an int AFTER any "$()" variable replacement. +get int GetPropertyInt=4010(string key,) + # Notifications # Type of modification and the action which caused the modification. # These are defined as a bit mask to make it easy to specify which notifications are wanted. diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index adf21ce6b..c70e2055d 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -655,6 +655,31 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara reinterpret_cast<const char *>(lParam)); break; + case SCI_GETPROPERTY: { + SString val = props.Get(reinterpret_cast<const char *>(wParam)); + const int n = val.length(); + if (lParam != 0) { + char *ptr = reinterpret_cast<char *>(lParam); + memcpy(ptr, val.c_str(), n); + ptr[n] = '\0'; // terminate + } + return n; // Not including NUL + } + + case SCI_GETPROPERTYEXPANDED: { + SString val = props.GetExpanded(reinterpret_cast<const char *>(wParam)); + const int n = val.length(); + if (lParam != 0) { + char *ptr = reinterpret_cast<char *>(lParam); + memcpy(ptr, val.c_str(), n); + ptr[n] = '\0'; // terminate + } + return n; // Not including NUL + } + + case SCI_GETPROPERTYINT: + return props.GetInt(reinterpret_cast<const char *>(wParam), lParam); + case SCI_SETKEYWORDS: if (wParam < numWordLists) { keyWordLists[wParam]->Clear(); |