aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2026-02-13 11:05:00 +1100
committerNeil <nyamatongwe@gmail.com>2026-02-13 11:05:00 +1100
commit5a52597b3e27ed693c996faef7e02fc381e7affd (patch)
tree142b011e156f025787445d5fb98461badaccd89b /src
parent61d42a0c3fb9e68adb5fdb9c7fa0a32b51026c4b (diff)
downloadscintilla-mirror-5a52597b3e27ed693c996faef7e02fc381e7affd.tar.gz
Simplify conversion of line end bytes to representation for visible line ends.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 28721e22c..11f48007d 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -1052,14 +1052,13 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
ColourRGBA textFore = selectionFore.value_or(vsDraw.styles[styleMain].fore);
char hexits[4] = "";
std::string_view ctrlChar;
- Sci::Position widthBytes = 1;
RepresentationAppearance appearance = RepresentationAppearance::Blob;
- const Representation *repr = model.reprs->RepresentationFromCharacter(std::string_view(&ll->chars[eolPos], ll->numCharsInLine - eolPos));
- if (repr) {
- // Representation of whole text
- widthBytes = ll->numCharsInLine - eolPos;
- } else {
- repr = model.reprs->RepresentationFromCharacter(std::string_view(&ll->chars[eolPos], 1));
+ const std::string_view rest(&ll->chars[eolPos], ll->numCharsInLine - eolPos);
+ const Representation *repr = model.reprs->RepresentationFromCharacter(rest);
+ const Sci::Position widthBytes = repr ? rest.length() : 1;
+ if (!repr) {
+ // No representation of whole line end so try first byte.
+ repr = model.reprs->RepresentationFromCharacter(rest.substr(0, 1));
}
if (repr) {
ctrlChar = repr->stringRep;
@@ -1068,7 +1067,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
textFore = repr->colour;
}
} else {
- const unsigned char chEOL = ll->chars[eolPos];
+ const unsigned char chEOL = rest.front();
if (UTF8IsAscii(chEOL)) {
ctrlChar = ControlCharacterString(chEOL);
} else {