diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index ffbf4e0ef..ca63c808d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5924,10 +5924,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return selectedText.LengthWithTerminator(); } else { char *ptr = CharPtrFromSPtr(lParam); - size_t iChar = 0; - if (selectedText.Length()) { - for (; iChar < selectedText.LengthWithTerminator(); iChar++) - ptr[iChar] = selectedText.Data()[iChar]; + size_t iChar = selectedText.Length(); + if (iChar) { + memcpy(ptr, selectedText.Data(), iChar); + ptr[iChar++] = '\0'; } else { ptr[0] = '\0'; } |