aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2015-02-23 08:20:32 +1100
committerNeil <nyamatongwe@gmail.com>2015-02-23 08:20:32 +1100
commite3fb3e4d970c691eb696bdaeabb64e0e84d2d930 (patch)
treeb50874624ecd09c897ed6a7ea9488e687abf0800 /src
parent2effd05a1f7ea9815cb968eb695462689617407d (diff)
downloadscintilla-mirror-e3fb3e4d970c691eb696bdaeabb64e0e84d2d930.tar.gz
Add SCI_GETTARGETTEXT as a simpler alternate to SCI_GETTEXTRANGE.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 5935037d6..6c80b7511 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5343,7 +5343,7 @@ sptr_t Editor::StringResult(sptr_t lParam, const char *val) {
sptr_t Editor::BytesResult(sptr_t lParam, const unsigned char *val, size_t len) {
// No NUL termination: len is number of valid/displayed bytes
- if (lParam) {
+ if ((lParam) && (len > 0)) {
char *ptr = CharPtrFromSPtr(lParam);
if (val)
memcpy(ptr, val, len);
@@ -5576,6 +5576,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
}
break;
+ case SCI_GETTARGETTEXT: {
+ std::string text = RangeText(targetStart, targetEnd);
+ return BytesResult(lParam, reinterpret_cast<const unsigned char *>(text.c_str()), text.length());
+ }
+
case SCI_REPLACETARGET:
PLATFORM_ASSERT(lParam);
return ReplaceTarget(false, CharPtrFromSPtr(lParam), static_cast<int>(wParam));