diff options
author | mitchell <unknown> | 2018-05-25 17:21:46 -0400 |
---|---|---|
committer | mitchell <unknown> | 2018-05-25 17:21:46 -0400 |
commit | 8bda8cce4b5daf0bc785401a887331182e4f2b74 (patch) | |
tree | c7adba12e4815cdf34e3803aca4b85178582834a /src/Editor.cxx | |
parent | 96cf9078786ae2e4a8aaf56468e6d069e73ed9c0 (diff) | |
download | scintilla-mirror-8bda8cce4b5daf0bc785401a887331182e4f2b74.tar.gz |
Backport: Draw invalid bytes in DBCS when detected as blobs in a similar way to UTF-8.
Backport of changeset 6962:514fde42ccbf, but without std::string_view.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 092c6c28f..7ceef1c50 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -242,6 +242,17 @@ void Editor::SetRepresentations() { sprintf(hexits, "x%2X", k); reprs.SetRepresentation(hiByte, hexits); } + } else if (pdoc->dbcsCodePage) { + // DBCS invalid single lead bytes + for (int k = 0x80; k < 0x100; k++) { + char ch = static_cast<char>(k); + if (pdoc->IsDBCSLeadByteNoExcept(ch) || pdoc->IsDBCSLeadByteInvalid(ch)) { + const char hiByte[2] = { ch, 0 }; + char hexits[5]; // Really only needs 4 but that causes warning from gcc 7.1 + sprintf(hexits, "x%2X", k); + reprs.SetRepresentation(hiByte, hexits); + } + } } } |