diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 724177db56..39de6719eb 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -5020,6 +5020,9 @@ public: // Retrieve the selected text. wxCharBuffer GetSelectedTextRaw(); + // Retrieve the target text. + wxCharBuffer GetTargetTextRaw(); + // Retrieve a range of text. wxCharBuffer GetTextRangeRaw(int startPos, int endPos); diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 89c5857b9f..3db14daaa7 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -6357,6 +6357,11 @@ public: */ wxCharBuffer GetSelectedTextRaw(); + /** + Retrieve the target text. + */ + wxCharBuffer GetTargetTextRaw(); + /** Retrieve a range of text. */ diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 9d21dd366d..1e4c609889 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -5009,6 +5009,17 @@ wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw() return buf; } +wxCharBuffer wxStyledTextCtrl::GetTargetTextRaw() +{ + // Calculate the length needed first. + const int len = SendMsg(SCI_GETTARGETEND, 0, 0) - SendMsg(SCI_GETTARGETSTART, 0, 0); + + // And then really get the data. + wxCharBuffer buf(len); + SendMsg(SCI_GETTARGETTEXT, 0, (sptr_t)buf.data()); + return buf; +} + wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos) { if (endPos < startPos) { diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 972fe92f1a..f2a1dc5fb7 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -715,6 +715,17 @@ wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw() return buf; } +wxCharBuffer wxStyledTextCtrl::GetTargetTextRaw() +{ + // Calculate the length needed first. + const int len = SendMsg(SCI_GETTARGETEND, 0, 0) - SendMsg(SCI_GETTARGETSTART, 0, 0); + + // And then really get the data. + wxCharBuffer buf(len); + SendMsg(SCI_GETTARGETTEXT, 0, (sptr_t)buf.data()); + return buf; +} + wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos) { if (endPos < startPos) { diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 7a7c93e900..6261700f9f 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -273,6 +273,9 @@ public: // Retrieve the selected text. wxCharBuffer GetSelectedTextRaw(); + // Retrieve the target text. + wxCharBuffer GetTargetTextRaw(); + // Retrieve a range of text. wxCharBuffer GetTextRangeRaw(int startPos, int endPos); diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index c2009c94d4..f786c5dad0 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -342,6 +342,11 @@ public: */ wxCharBuffer GetSelectedTextRaw(); + /** + Retrieve the target text. + */ + wxCharBuffer GetTargetTextRaw(); + /** Retrieve a range of text. */