diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-05-02 14:14:08 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-05-02 14:14:08 +1000 |
| commit | 9e002fa3716e99b6170a9c6339194c7a6dcb4f87 (patch) | |
| tree | 96b41f9c67063f11826f624b43280c81a5ce3b1e /src | |
| parent | f84f2a3daef704cb309009f51b5da9f325979f68 (diff) | |
| download | scintilla-mirror-9e002fa3716e99b6170a9c6339194c7a6dcb4f87.tar.gz | |
Backport: Optimize SCI_GETTEXT by calling Document::GetCharRange instead of looping for
each byte.
Backport of changeset 7489:c9118d39963d.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 8f583636d..cd214de56 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5792,11 +5792,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { if (wParam == 0) return 0; char *ptr = CharPtrFromSPtr(lParam); - size_t iChar = 0; - for (; iChar < wParam - 1; iChar++) - ptr[iChar] = pdoc->CharAt(iChar); - ptr[iChar] = '\0'; - return iChar; + const Sci_Position len = wParam - 1; + pdoc->GetCharRange(ptr, 0, len); + ptr[len] = '\0'; + return len; } case SCI_SETTEXT: { |
