Add Raw variants for replacement functions to wxSTC

Implement ReplaceSelectionRaw, ReplaceTargetRaw, and ReplaceTargetRERaw
in the same manner as AddTextRaw, InsertTextRaw, and the other raw
variants.
This commit is contained in:
New Pagodi 2019-09-28 00:49:46 -05:00
parent 11f24369fd
commit 2976c64821
3 changed files with 76 additions and 0 deletions

View File

@ -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<sptr_t>(text));
}
int wxStyledTextCtrl::ReplaceTargetRaw(const char* text, int length)
{
if ( length == -1 )
length = strlen(text);
return SendMsg(SCI_REPLACETARGET, length, reinterpret_cast<sptr_t>(text));
}
int wxStyledTextCtrl::ReplaceTargetRERaw(const char* text, int length)
{
if ( length == -1 )
length = strlen(text);
return SendMsg(SCI_REPLACETARGETRE, length, reinterpret_cast<sptr_t>(text));
}
#if WXWIN_COMPATIBILITY_3_0
// Deprecated since Scintilla 3.7.2
void wxStyledTextCtrl::UsePopUp(bool allowPopUp)

View File

@ -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

View File

@ -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);
//@}