From 2fb4ff4b1bc1a473d80260455c80d7ec19c62616 Mon Sep 17 00:00:00 2001
From: Neil
Date: Fri, 13 Mar 2015 09:17:40 +1100
Subject: Scintilla is now always a wide character window so remove vestiges of
narrow character window support.
---
doc/ScintillaDoc.html | 12 ++---
doc/ScintillaHistory.html | 4 ++
include/Scintilla.iface | 14 ++---
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 {
SCI_GETCODEPAGE
SCI_SETIMEINTERACTION(int imeInteraction)
SCI_GETIMEINTERACTION
- SCI_SETKEYSUNICODE(bool keysUnicode)
- SCI_GETKEYSUNICODE
SCI_SETWORDCHARS(<unused>, const char *characters)
SCI_GETWORDCHARS(<unused>, char *characters)
SCI_SETWHITESPACECHARS(<unused>, const char *characters)
@@ -3343,12 +3341,6 @@ struct Sci_TextToFind {
and the inline behaviour with SCI_SETIMEINTERACTION(SC_IME_INLINE).
Scintilla may ignore this call in some cases. For example, the inline behaviour might only be supported for some languages.
- SCI_SETKEYSUNICODE(bool keysUnicode)
- SCI_GETKEYSUNICODE
- 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.
-
SCI_SETWORDCHARS(<unused>, const char *characters)
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
SCI_GETUSEPALETTE Deprecated
Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
Any calls to these methods should be removed.
+
+ SCI_SETKEYSUNICODE(bool keysUnicode) Deprecated
+ SCI_GETKEYSUNICODE Deprecated
+ On Windows, Scintilla no longer supports narrow character windows so input is always treated as Unicode.
The following are features that should be removed from calling code but are still
defined to avoid breaking callers.
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.
+ 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.
+
+
Verilog folder fixes bug with `end completing an `if* instead of `endif.
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 docBytes(pdoc->Length(), '\0');
- pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length());
- if (IsUnicodeMode()) {
- return UTF16Length(&docBytes[0], static_cast(docBytes.size()));
- } else {
- return ::MultiByteToWideChar(CodePageOfDocument(), 0, &docBytes[0],
- static_cast(docBytes.size()), NULL, 0);
- }
+ if (pdoc->Length() == 0)
+ return 0;
+ std::vector docBytes(pdoc->Length(), '\0');
+ pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length());
+ if (IsUnicodeMode()) {
+ return UTF16Length(&docBytes[0], static_cast(docBytes.size()));
} else {
- return pdoc->Length();
+ return ::MultiByteToWideChar(CodePageOfDocument(), 0, &docBytes[0],
+ static_cast(docBytes.size()), NULL, 0);
}
}
sptr_t ScintillaWin::GetText(uptr_t wParam, sptr_t lParam) {
- if (::IsWindowUnicode(MainHWND())) {
- wchar_t *ptr = reinterpret_cast(lParam);
- if (pdoc->Length() == 0) {
- *ptr = L'\0';
- return 0;
- }
- std::vector docBytes(pdoc->Length(), '\0');
- pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length());
- if (IsUnicodeMode()) {
- size_t lengthUTF16 = UTF16Length(&docBytes[0], static_cast(docBytes.size()));
- if (lParam == 0)
- return lengthUTF16;
- if (wParam == 0)
- return 0;
- size_t uLen = UTF16FromUTF8(&docBytes[0], docBytes.size(),
- ptr, static_cast(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(docBytes.size()), NULL, 0);
- if (lengthUTF16 >= static_cast(wParam))
- lengthUTF16 = static_cast(wParam)-1;
- ::MultiByteToWideChar(cpSrc, 0, &docBytes[0],
- static_cast(docBytes.size()),
- ptr, lengthUTF16);
- ptr[lengthUTF16] = L'\0';
- return lengthUTF16;
- }
- } else {
+ wchar_t *ptr = reinterpret_cast(lParam);
+ if (pdoc->Length() == 0) {
+ *ptr = L'\0';
+ return 0;
+ }
+ std::vector docBytes(pdoc->Length(), '\0');
+ pdoc->GetCharRange(&docBytes[0], 0, pdoc->Length());
+ if (IsUnicodeMode()) {
+ size_t lengthUTF16 = UTF16Length(&docBytes[0], static_cast(docBytes.size()));
if (lParam == 0)
- return pdoc->Length() + 1;
+ return lengthUTF16;
if (wParam == 0)
return 0;
- char *ptr = reinterpret_cast(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(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(docBytes.size()), NULL, 0);
+ if (lengthUTF16 >= static_cast(wParam))
+ lengthUTF16 = static_cast(wParam)-1;
+ ::MultiByteToWideChar(cpSrc, 0, &docBytes[0],
+ static_cast(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(wParam))) || !lastKeyDownConsumed) {
- if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) {
- wchar_t wcs[2] = {static_cast(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(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) ||
--
cgit v1.2.3