diff --git a/desktop/textarea.c b/desktop/textarea.c index 1cbb767f6..3fb18e1c4 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -2073,6 +2073,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) { diff --git a/desktop/textarea.h b/desktop/textarea.h index 898609730..b386e50e8 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -212,6 +212,16 @@ bool textarea_drop_text(struct textarea *ta, const char *text, 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 *