diff options
| author | Neil <nyamatongwe@gmail.com> | 2025-11-27 08:45:01 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2025-11-27 08:45:01 +1100 |
| commit | 47c094313ab711b785e41a08e55350e1d447fa04 (patch) | |
| tree | 4a75df95e89144ade36d310ab1b5acfcacf58aac | |
| parent | 1cb12d3e38c4a26c6aa0c1e8fd5daff9d63ed8c6 (diff) | |
| download | scintilla-mirror-47c094313ab711b785e41a08e55350e1d447fa04.tar.gz | |
Feature [feature-requests:#1564]. Ensure DCBS fold map initialized and folding
produces sensible values when DBCS lead byte followed by non trail byte.
| -rw-r--r-- | src/DBCS.h | 2 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/DBCS.h b/src/DBCS.h index 96d282446..ccd71536a 100644 --- a/src/DBCS.h +++ b/src/DBCS.h @@ -37,7 +37,7 @@ constexpr uint16_t DBCSIndex(char ch1, char ch2) noexcept { } struct DBCSPair { - char chars[2]; + char chars[2]{}; }; using FoldMap = std::array<DBCSPair, 0x8000>; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index fbec35f76..392e0b86c 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2813,10 +2813,10 @@ void CreateFoldMap(int codePage, FoldMap *foldingMap) { if (DBCSIsLeadByte(codePage, ch1)) { for (unsigned char byte2 = highByteLast; byte2 >= minTrailByte; byte2--) { const char ch2 = byte2; + const DBCSPair pair{ ch1, ch2 }; + const uint16_t index = DBCSIndex(ch1, ch2); + (*foldingMap)[index] = pair; if (DBCSIsTrailByte(codePage, ch2)) { - const DBCSPair pair{ ch1, ch2 }; - const uint16_t index = DBCSIndex(ch1, ch2); - (*foldingMap)[index] = pair; const std::string_view svBytes(pair.chars, 2); const int lenUni = WideCharLenFromMultiByte(codePage, svBytes); if (lenUni == 1) { |
