summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-09-18 19:18:20 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2017-09-18 22:18:44 (GMT)
commit2a294adfb179f8209f074e6ff810b0526c6dd4fb (patch)
tree231fe2ceb530ed6d2b4577119de37a9417836363
parent4d842226546bf1abb84dbdce798d99490845d200 (diff)
downloadnetsurf-2a294adfb179f8209f074e6ff810b0526c6dd4fb.tar.gz
netsurf-2a294adfb179f8209f074e6ff810b0526c6dd4fb.tar.bz2
Textarea: Add API to access current textarea contents.
-rw-r--r--desktop/textarea.c11
-rw-r--r--desktop/textarea.h10
2 files changed, 21 insertions, 0 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 1cbb767..3fb18e1 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -2074,6 +2074,17 @@ int textarea_get_text(struct textarea *ta, char *buf, unsigned int len)
/* exported interface, documented in textarea.h */
+const char * textarea_data(struct textarea *ta, unsigned int *len)
+{
+ if (len != NULL) {
+ *len = ta->text.len;
+ }
+
+ return ta->text.data;
+}
+
+
+/* exported interface, documented in textarea.h */
bool textarea_set_caret(struct textarea *ta, int caret)
{
int b_off;
diff --git a/desktop/textarea.h b/desktop/textarea.h
index 8986097..b386e50 100644
--- a/desktop/textarea.h
+++ b/desktop/textarea.h
@@ -213,6 +213,16 @@ int textarea_get_text(struct textarea *ta, char *buf, unsigned int len);
/**
+ * Access text data in a text area
+ *
+ * \param[in] ta Text area
+ * \param[out] len Returns byte length of returned text, if passed non-NULL.
+ * \return textarea string data.
+ */
+const char * textarea_data(struct textarea *ta, unsigned int *len);
+
+
+/**
* Set the caret's position
*
* \param ta Text area