diff options
author | Neil <nyamatongwe@gmail.com> | 2021-06-10 16:03:47 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-06-10 16:03:47 +1000 |
commit | 1fdd0b8dc8f2895c5942b23410f11ea21dd4e3f4 (patch) | |
tree | 662dc6fd61303a2f40bc883ab2b574b503a6c9ee /src/EditView.cxx | |
parent | 6d353d5ced87c554bc1b9abe194f18d585a0aeef (diff) | |
download | scintilla-mirror-1fdd0b8dc8f2895c5942b23410f11ea21dd4e3f4.tar.gz |
Use string_view for PositionCache methods.
Replace custom hash code with standard library hash.
Drop standard methods that are not needed.
Restrict representations to 200 bytes. Improve documentation.
Diffstat (limited to 'src/EditView.cxx')
-rw-r--r-- | src/EditView.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index 5d69c1345..92c1450cc 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -473,7 +473,8 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt representationWidth = NextTabstopPos(line, x, vstyle.tabWidth) - ll->positions[ts.start]; } else { if (representationWidth <= 0.0) { - XYPOSITION positionsRepr[256]; // Should expand when needed + assert(ts.representation->stringRep.length() <= Representation::maxLength); + XYPOSITION positionsRepr[Representation::maxLength+1]; surface->MeasureWidthsUTF8(vstyle.styles[StyleControlChar].font.get(), ts.representation->stringRep, positionsRepr); representationWidth = positionsRepr[ts.representation->stringRep.length() - 1]; if (FlagSet(ts.representation->appearance, RepresentationAppearance::Blob)) { @@ -488,8 +489,8 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt // Over half the segments are single characters and of these about half are space characters. ll->positions[ts.start + 1] = vstyle.styles[ll->styles[ts.start]].spaceWidth; } else { - posCache.MeasureWidths(surface, vstyle, ll->styles[ts.start], &ll->chars[ts.start], - ts.length, &ll->positions[ts.start + 1]); + posCache.MeasureWidths(surface, vstyle, ll->styles[ts.start], + std::string_view(&ll->chars[ts.start], ts.length), &ll->positions[ts.start + 1]); } } lastSegItalics = (!ts.representation) && ((ll->chars[ts.end() - 1] != ' ') && vstyle.styles[ll->styles[ts.start]].italic); |