edit on r57996, no need to use for loop.

This commit is contained in:
2013-07-04 20:07:00 +00:00
parent 077f2b77b9
commit 50148a0f53

View File

@@ -1905,14 +1905,10 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in
else if (ELEM(mode, UI_TEXTEDIT_COPY, UI_TEXTEDIT_CUT)) {
/* copy the contents to the copypaste buffer */
int sellen = but->selend - but->selsta;
char *buf = MEM_callocN(sizeof(char)*(sellen + 1), "ui_textedit_copypaste");
for (x = 0; x < sellen; x++)
buf[x] = str[but->selsta + x];
buf[sellen] = '\0';
char *buf = MEM_mallocN(sizeof(char) * (sellen + 1), "ui_textedit_copypaste");
BLI_strncpy(buf, str + but->selsta, sellen + 1);
WM_clipboard_text_set(buf, 0);
MEM_freeN(buf);
/* for cut only, delete the selection afterwards */