aboutsummaryrefslogtreecommitdiffhomepage
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
commitee3a66f0ebaea12c3fd4000a1acffdcc2b93176f (patch)
tree428a4dc64ccba8be1227fb46877fa6e772402083
parent2424ec8a5c54ea9443b1c04f7b8a7bf530bccc5e (diff)
downloadscintilla-mirror-ee3a66f0ebaea12c3fd4000a1acffdcc2b93176f.tar.gz
Add SCI_GETTARGETTEXT as a simpler alternate to SCI_GETTEXTRANGE.
-rw-r--r--doc/ScintillaDoc.html7
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface3
-rw-r--r--src/Editor.cxx7
4 files changed, 16 insertions, 2 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index 1697af2ee..0a913506b 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -82,7 +82,7 @@
<h1>Scintilla Documentation</h1>
- <p>Last edited 13 February 2015 NH</p>
+ <p>Last edited 22 February 2015 NH</p>
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
Scintilla</a>.<br />
@@ -643,6 +643,8 @@ struct Sci_TextRange {
<a class="message" href="#SCI_GETSEARCHFLAGS">SCI_GETSEARCHFLAGS</a><br />
<a class="message" href="#SCI_SEARCHINTARGET">SCI_SEARCHINTARGET(int length, const char
*text)</a><br />
+ <a class="message" href="#SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(&lt;unused&gt;,
+ char *text)</a><br />
<a class="message" href="#SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char
*text)</a><br />
<a class="message" href="#SCI_REPLACETARGETRE">SCI_REPLACETARGETRE(int length, const char
@@ -677,6 +679,9 @@ struct Sci_TextRange {
text and the return value is the position of the start of the matching text. If the search
fails, the result is -1.</p>
+ <p><b id="SCI_GETTARGETTEXT">SCI_GETTARGETTEXT(&lt;unused&gt;, char *text)</b><br />
+ Retrieve the value in the target.</p>
+
<p><b id="SCI_REPLACETARGET">SCI_REPLACETARGET(int length, const char *text)</b><br />
If <code>length</code> is -1, <code>text</code> is a zero terminated string, otherwise
<code>length</code> sets the number of character to replace the target with.
diff --git a/include/Scintilla.h b/include/Scintilla.h
index 018a6d8bd..e2e3297a5 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -433,6 +433,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETTARGETEND 2192
#define SCI_GETTARGETEND 2193
#define SCI_SETTARGETRANGE 2686
+#define SCI_GETTARGETTEXT 2687
#define SCI_REPLACETARGET 2194
#define SCI_REPLACETARGETRE 2195
#define SCI_SEARCHINTARGET 2197
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index 7373384c8..f5fac5480 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -1062,6 +1062,9 @@ get position GetTargetEnd=2193(,)
# Sets both the start and end of the target in one call.
fun void SetTargetRange=2686(position start, position end)
+# Retrieve the text in the target.
+get int GetTargetText=2687(, stringresult characters)
+
# Replace the target text with the argument text.
# Text is counted so it can contain NULs.
# Returns the length of the replacement text.
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));