diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 198c4ccac4..7a211c5545 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -682,6 +682,27 @@ void wxStyledTextCtrl::AppendTextRaw(const char* text, int length) SendMsg(SCI_APPENDTEXT, length, (sptr_t)text); } +void wxStyledTextCtrl::ReplaceSelectionRaw(const char* text) +{ + SendMsg(SCI_REPLACESEL, 0, reinterpret_cast(text)); +} + +int wxStyledTextCtrl::ReplaceTargetRaw(const char* text, int length) +{ + if ( length == -1 ) + length = strlen(text); + + return SendMsg(SCI_REPLACETARGET, length, reinterpret_cast(text)); +} + +int wxStyledTextCtrl::ReplaceTargetRERaw(const char* text, int length) +{ + if ( length == -1 ) + length = strlen(text); + + return SendMsg(SCI_REPLACETARGETRE, length, reinterpret_cast(text)); +} + #if WXWIN_COMPATIBILITY_3_0 // Deprecated since Scintilla 3.7.2 void wxStyledTextCtrl::UsePopUp(bool allowPopUp) diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 679c0e16e0..6ca3d24aa8 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -347,6 +347,15 @@ public: // Append a string to the end of the document without changing the selection. void AppendTextRaw(const char* text, int length=-1); + // Replace the selected text with the argument text. + void ReplaceSelectionRaw(const char* text); + + // Replace the target text with the argument text. + int ReplaceTargetRaw(const char* text, int length=-1); + + // Replace the target text with the argument text after \d processing. + int ReplaceTargetRERaw(const char* text, int length=-1); + #ifdef SWIG %%pythoncode "_stc_utf8_methods.py" #endif diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index 5e7e1b9a5d..af05c72bde 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -352,6 +352,52 @@ public: */ void AppendTextRaw(const char* text, int length=-1); + /** + Replace the current selection with text. If there is no current + selection, text is inserted at the current caret position. + + @param text + The null terminated string used for the replacement. + + @since 3.1.3 + */ + void ReplaceSelectionRaw(const char* text); + + /** + Replace the current target with text. + + @return + The return value is the length of the replacement string. + + @remarks + If length=-1, text must be null terminated. + + @since 3.1.3 + */ + int ReplaceTargetRaw(const char* text, int length=-1); + + /** + Replace the current target with text using regular expressions. + + The replacement string will be formed from text with any occurrences '\1' + through '\9' replaced by tagged matches from the most recent regular + expression search. In addition, any occurrences of '\0' will be replaced + with all the matched text from the most recent search. After replacement, + the target range refers to the replacement text. + + @return + The return value is the length of the replacement string. + + @remarks + If length=-1, text must be null terminated. + + @see + SearchInTarget() + + @since 3.1.3 + */ + int ReplaceTargetRERaw(const char* text, int length=-1); + //@}