Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-27 02:56:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-27 02:56:16 +0300
commit5be3bf73be1c80baa4a2327151a42992a8c5a7a3 (patch)
tree4f3d5873ad8aac5a3e585985816bff45d3011e9b /source/blender/blenlib
parent71f7e50451090a2a17bae3c1b47057c87d78a84a (diff)
bugfix [#20694] Copy Paste to buffer missing in Console editor
- console selection working - copy selection to clipboard - paste selection from clipboard works with multiline paste word-wrap is still not working with selection drawing.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_dynstr.h9
-rw-r--r--source/blender/blenlib/intern/BLI_dynstr.c17
2 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index 8544b451b65..c5158264e72 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -60,6 +60,15 @@ DynStr* BLI_dynstr_new (void);
*/
void BLI_dynstr_append (DynStr *ds, const char *cstr);
+/**
+ * Append a length clamped c-string to a DynStr.
+ *
+ * @param ds The DynStr to append to.
+ * @param cstr The c-string to append.
+ * @param len The maximum length of the c-string to copy.
+ */
+void BLI_dynstr_nappend (DynStr *ds, const char *cstr, int len);
+
/**
* Append a c-string to a DynStr, but with formatting like printf.
*
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index 02c7ff2e9e5..09d28ddbc3a 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -83,6 +83,23 @@ void BLI_dynstr_append(DynStr *ds, const char *cstr) {
ds->curlen+= cstrlen;
}
+void BLI_dynstr_nappend(DynStr *ds, const char *cstr, int len) {
+ DynStrElem *dse= malloc(sizeof(*dse));
+ int cstrlen= strnlen(cstr, len);
+
+ dse->str= malloc(cstrlen+1);
+ memcpy(dse->str, cstr, cstrlen);
+ dse->str[cstrlen] = '\0';
+ dse->next= NULL;
+
+ if (!ds->last)
+ ds->last= ds->elems= dse;
+ else
+ ds->last= ds->last->next= dse;
+
+ ds->curlen+= cstrlen;
+}
+
void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
{
char *message, fixedmessage[256];