From 00f3a3ba52bb03872758a300719622161b469faa Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 9 Oct 2018 10:47:35 +1100 Subject: Backport: Improve performance of Editor::RangeText by avoding per-character checks. Helps applications that call SCI_GETTARGETTEXT. Backport of changeset 7109:29f0ca6d2d1b, but with const_cast to fix compile error. --- src/Editor.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index ba5601c5a..581e71918 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4155,9 +4155,7 @@ std::string Editor::RangeText(Sci::Position start, Sci::Position end) const { if (start < end) { const Sci::Position len = end - start; std::string ret(len, '\0'); - for (int i = 0; i < len; i++) { - ret[i] = pdoc->CharAt(start + i); - } + pdoc->GetCharRange(const_cast(ret.data()), start, len); return ret; } return std::string(); -- cgit v1.2.3