diff options
| author | Neil <nyamatongwe@gmail.com> | 2026-02-07 13:32:34 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2026-02-07 13:32:34 +1100 |
| commit | 077d02e8373c2b651b147bdc592ac2a09ca96601 (patch) | |
| tree | 0a5077d1b31dbd4574e9829cbbf0a558ef7dedf2 /src | |
| parent | 41bd589bbafd745563622aa910d7bfcd501fb409 (diff) | |
| download | scintilla-mirror-077d02e8373c2b651b147bdc592ac2a09ca96601.tar.gz | |
Use std::array for text measurement cases where it only adds a little code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/EditView.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index 59fa80055..11a81edb7 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -17,6 +17,7 @@ #include <string> #include <string_view> #include <vector> +#include <array> #include <map> #include <set> #include <forward_list> @@ -355,10 +356,10 @@ void LayoutSegments(IPositionCache *pCache, representationWidth = vstyle.controlCharWidth; if (representationWidth <= 0.0) { assert(ts.representation->stringRep.length() <= Representation::maxLength); - XYPOSITION positionsRepr[Representation::maxLength + 1]; + std::array<XYPOSITION, Representation::maxLength + 1> positionsRepr; // ts.representation->stringRep is UTF-8. pCache->MeasureWidths(surface, vstyle, StyleControlChar, true, ts.representation->stringRep, - positionsRepr, multiThreaded); + positionsRepr.data(), multiThreaded); representationWidth = positionsRepr[ts.representation->stringRep.length() - 1]; if (FlagSet(ts.representation->appearance, RepresentationAppearance::Blob)) { representationWidth += vstyle.ctrlCharPadding; @@ -377,9 +378,9 @@ void LayoutSegments(IPositionCache *pCache, } } else if (vstyle.styles[styleSegment].invisibleRepresentation[0]) { const std::string_view text = vstyle.styles[styleSegment].invisibleRepresentation; - XYPOSITION positionsRepr[Representation::maxLength + 1]; + std::array<XYPOSITION, Representation::maxLength + 1> positionsRepr; // invisibleRepresentation is UTF-8. - pCache->MeasureWidths(surface, vstyle, styleSegment, true, text, positionsRepr, multiThreaded); + pCache->MeasureWidths(surface, vstyle, styleSegment, true, text, positionsRepr.data(), multiThreaded); const XYPOSITION representationWidth = positionsRepr[text.length() - 1]; std::fill(positions, positions + ts.length, representationWidth); } |
