From 521ef7054806424c97dac5ee71b3a05ed5b9d7f4 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Mon, 21 May 2018 15:15:34 +1000 Subject: Draw invalid bytes in DBCS when detected as blobs in a similar way to UTF-8. --- src/Editor.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index 9aba5ccd2..04d61bea6 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(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); + } + } } } -- cgit v1.2.3