diff options
| author | Neil <nyamatongwe@gmail.com> | 2015-03-13 09:17:40 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2015-03-13 09:17:40 +1100 |
| commit | 2fb4ff4b1bc1a473d80260455c80d7ec19c62616 (patch) | |
| tree | 3542eebf81a5e87d60855e6a782b5277349bd637 | |
| parent | e6b7e27786411953f2d6c9c34a9a9f4c9ce5711d (diff) | |
| download | scintilla-mirror-2fb4ff4b1bc1a473d80260455c80d7ec19c62616.tar.gz | |
Scintilla is now always a wide character window so remove vestiges of narrow
character window support.
| -rw-r--r-- | doc/ScintillaDoc.html | 12 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | include/Scintilla.iface | 14 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 127 |
4 files changed, 65 insertions, 92 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 3fefd22e9..b75d3c399 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3214,8 +3214,6 @@ struct Sci_TextToFind { <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</a><br /> <a class="message" href="#SCI_SETIMEINTERACTION">SCI_SETIMEINTERACTION(int imeInteraction)</a><br /> <a class="message" href="#SCI_GETIMEINTERACTION">SCI_GETIMEINTERACTION</a><br /> - <a class="message" href="#SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</a><br /> - <a class="message" href="#SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</a><br /> <a class="message" href="#SCI_SETWORDCHARS">SCI_SETWORDCHARS(<unused>, const char *characters)</a><br /> <a class="message" href="#SCI_GETWORDCHARS">SCI_GETWORDCHARS(<unused>, char *characters)</a><br /> <a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(<unused>, const char *characters)</a><br /> @@ -3343,12 +3341,6 @@ struct Sci_TextToFind { and the inline behaviour with <code>SCI_SETIMEINTERACTION(SC_IME_INLINE)</code>. Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.</p> - <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b><br /> - <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b><br /> - On Windows, character keys are normally handled differently depending on whether Scintilla is a wide - or narrow character window with character messages treated as Unicode when wide and as 8 bit otherwise. - Set this property to always treat as Unicode. This option is needed for Delphi.</p> - <p><b id="SCI_SETWORDCHARS">SCI_SETWORDCHARS(<unused>, const char *characters)</b><br /> Scintilla has several functions that operate on words, which are defined to be contiguous sequences of characters from a particular set of characters. This message defines which @@ -7614,6 +7606,10 @@ EM_FORMATRANGE <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br /> Scintilla no longer supports palette mode. The last version to support palettes was 2.29. Any calls to these methods should be removed.</p> + + <p><b id="SCI_SETKEYSUNICODE">SCI_SETKEYSUNICODE(bool keysUnicode)</b> Deprecated<br /> + <b id="SCI_GETKEYSUNICODE">SCI_GETKEYSUNICODE</b> Deprecated<br /> + On Windows, Scintilla no longer supports narrow character windows so input is always treated as Unicode.</p> <p>The following are features that should be removed from calling code but are still defined to avoid breaking callers.</p> diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index f2b2b2acf..bcdc60933 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -488,6 +488,10 @@ Released 8 March 2015. </li> <li> + Scintilla on Windows is now always a wide character window so SCI_SETKEYSUNICODE has no effect + and SCI_GETKEYSUNICODE always returns true. These APIs are deprecated and should not be called. + </li> + <li> Verilog folder fixes bug with `end completing an `if* instead of `endif. </li> </ul> diff --git a/include/Scintilla.iface b/include/Scintilla.iface index f5fac5480..e9db97984 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2092,12 +2092,6 @@ get int GetRangePointer=2643(int position, int rangeLength) # the range of a call to GetRangePointer. get position GetGapPosition=2644(,) -# Always interpret keyboard input as Unicode -set void SetKeysUnicode=2521(bool keysUnicode,) - -# Are keys always interpreted as Unicode? -get bool GetKeysUnicode=2522(,) - # Set the alpha fill colour of the given indicator. set void IndicSetAlpha=2523(int indicator, int alpha) @@ -4660,3 +4654,11 @@ get bool GetUsePalette=2139(,) # In palette mode, Scintilla uses the environment's palette calls to display # more colours. This may lead to ugly displays. set void SetUsePalette=2039(bool usePalette,) + +# Deprecated in 3.5.5 + +# Always interpret keyboard input as Unicode +set void SetKeysUnicode=2521(bool keysUnicode,) + +# Are keys always interpreted as Unicode? +get bool GetKeysUnicode=2522(,) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 2a26eee04..131559542 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -351,7 +351,6 @@ private: HBITMAP sysCaretBitmap; int sysCaretWidth; int sysCaretHeight; - bool keysAlwaysUnicode; }; HINSTANCE ScintillaWin::hInstance = 0; @@ -403,8 +402,6 @@ ScintillaWin::ScintillaWin(HWND hwnd) { renderTargetValid = true; #endif - keysAlwaysUnicode = false; - caret.period = ::GetCaretBlinkTime(); if (caret.period < 0) caret.period = 0; @@ -1103,66 +1100,49 @@ UINT ScintillaWin::CodePageOfDocument() { } sptr_t ScintillaWin::GetTextLength() { - if (::IsWindowUnicode(MainHWND())) { - if (pdoc->Length() == 0) - return 0; - std::vector<char> docBytes(pdoc->Length(), '\0'); - pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length()); - if (IsUnicodeMode()) { - return UTF16Length(&docBytes[0], static_cast<unsigned int>(docBytes.size())); - } else { - return ::MultiByteToWideChar(CodePageOfDocument(), 0, &docBytes[0], - static_cast<int>(docBytes.size()), NULL, 0); - } + if (pdoc->Length() == 0) + return 0; + std::vector<char> docBytes(pdoc->Length(), '\0'); + pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length()); + if (IsUnicodeMode()) { + return UTF16Length(&docBytes[0], static_cast<unsigned int>(docBytes.size())); } else { - return pdoc->Length(); + return ::MultiByteToWideChar(CodePageOfDocument(), 0, &docBytes[0], + static_cast<int>(docBytes.size()), NULL, 0); } } sptr_t ScintillaWin::GetText(uptr_t wParam, sptr_t lParam) { - if (::IsWindowUnicode(MainHWND())) { - wchar_t *ptr = reinterpret_cast<wchar_t *>(lParam); - if (pdoc->Length() == 0) { - *ptr = L'\0'; - return 0; - } - std::vector<char> docBytes(pdoc->Length(), '\0'); - pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length()); - if (IsUnicodeMode()) { - size_t lengthUTF16 = UTF16Length(&docBytes[0], static_cast<unsigned int>(docBytes.size())); - if (lParam == 0) - return lengthUTF16; - if (wParam == 0) - return 0; - size_t uLen = UTF16FromUTF8(&docBytes[0], docBytes.size(), - ptr, static_cast<int>(wParam) - 1); - ptr[uLen] = L'\0'; - return uLen; - } else { - // Not Unicode mode - // Convert to Unicode using the current Scintilla code page - const UINT cpSrc = CodePageOfDocument(); - int lengthUTF16 = ::MultiByteToWideChar(cpSrc, 0, &docBytes[0], - static_cast<int>(docBytes.size()), NULL, 0); - if (lengthUTF16 >= static_cast<int>(wParam)) - lengthUTF16 = static_cast<int>(wParam)-1; - ::MultiByteToWideChar(cpSrc, 0, &docBytes[0], - static_cast<int>(docBytes.size()), - ptr, lengthUTF16); - ptr[lengthUTF16] = L'\0'; - return lengthUTF16; - } - } else { + wchar_t *ptr = reinterpret_cast<wchar_t *>(lParam); + if (pdoc->Length() == 0) { + *ptr = L'\0'; + return 0; + } + std::vector<char> docBytes(pdoc->Length(), '\0'); + pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length()); + if (IsUnicodeMode()) { + size_t lengthUTF16 = UTF16Length(&docBytes[0], static_cast<unsigned int>(docBytes.size())); if (lParam == 0) - return pdoc->Length() + 1; + return lengthUTF16; if (wParam == 0) return 0; - char *ptr = reinterpret_cast<char *>(lParam); - unsigned int iChar = 0; - for (; iChar < wParam - 1; iChar++) - ptr[iChar] = pdoc->CharAt(iChar); - ptr[iChar] = '\0'; - return iChar; + size_t uLen = UTF16FromUTF8(&docBytes[0], docBytes.size(), + ptr, static_cast<int>(wParam) - 1); + ptr[uLen] = L'\0'; + return uLen; + } else { + // Not Unicode mode + // Convert to Unicode using the current Scintilla code page + const UINT cpSrc = CodePageOfDocument(); + int lengthUTF16 = ::MultiByteToWideChar(cpSrc, 0, &docBytes[0], + static_cast<int>(docBytes.size()), NULL, 0); + if (lengthUTF16 >= static_cast<int>(wParam)) + lengthUTF16 = static_cast<int>(wParam)-1; + ::MultiByteToWideChar(cpSrc, 0, &docBytes[0], + static_cast<int>(docBytes.size()), + ptr, lengthUTF16); + ptr[lengthUTF16] = L'\0'; + return lengthUTF16; } } @@ -1377,28 +1357,20 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case WM_CHAR: if (((wParam >= 128) || !iscntrl(static_cast<int>(wParam))) || !lastKeyDownConsumed) { - if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) { - wchar_t wcs[2] = {static_cast<wchar_t>(wParam), 0}; - if (IsUnicodeMode()) { - // For a wide character version of the window: - char utfval[4]; - unsigned int len = UTF8Length(wcs, 1); - UTF8FromUTF16(wcs, 1, utfval, len); - AddCharUTF(utfval, len); - } else { - UINT cpDest = CodePageOfDocument(); - char inBufferCP[20]; - int size = ::WideCharToMultiByte(cpDest, - 0, wcs, 1, inBufferCP, sizeof(inBufferCP) - 1, 0, 0); - inBufferCP[size] = '\0'; - AddCharUTF(inBufferCP, size); - } + wchar_t wcs[2] = {static_cast<wchar_t>(wParam), 0}; + if (IsUnicodeMode()) { + // For a wide character version of the window: + char utfval[4]; + unsigned int len = UTF8Length(wcs, 1); + UTF8FromUTF16(wcs, 1, utfval, len); + AddCharUTF(utfval, len); } else { - if (IsUnicodeMode()) { - AddCharBytes('\0', LOBYTE(wParam)); - } else { - AddChar(LOBYTE(wParam)); - } + UINT cpDest = CodePageOfDocument(); + char inBufferCP[20]; + int size = ::WideCharToMultiByte(cpDest, + 0, wcs, 1, inBufferCP, sizeof(inBufferCP) - 1, 0, 0); + inBufferCP[size] = '\0'; + AddCharUTF(inBufferCP, size); } } return 0; @@ -1643,11 +1615,10 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam break; case SCI_SETKEYSUNICODE: - keysAlwaysUnicode = wParam != 0; break; case SCI_GETKEYSUNICODE: - return keysAlwaysUnicode; + return true; case SCI_SETTECHNOLOGY: if ((wParam == SC_TECHNOLOGY_DEFAULT) || |
