diff options
-rw-r--r-- | doc/ScintillaDoc.html | 8 | ||||
-rw-r--r-- | include/Scintilla.h | 2 | ||||
-rw-r--r-- | include/Scintilla.iface | 6 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 12 |
4 files changed, 27 insertions, 1 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index cb4728e06..ee4e1670d 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -2431,6 +2431,8 @@ struct TextToFind { <a class="message" href="#SCI_GETTWOPHASEDRAW">SCI_GETTWOPHASEDRAW</a><br /> <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE(int codePage)</a><br /> <a class="message" href="#SCI_GETCODEPAGE">SCI_GETCODEPAGE</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 *chars)</a><br /> <a class="message" href="#SCI_SETWHITESPACECHARS">SCI_SETWHITESPACECHARS(<unused>, const char @@ -2527,6 +2529,12 @@ struct TextToFind { <p>Setting <code>codePage</code> to a non-zero value that is not <code>SC_CP_UTF8</code> is operating system dependent.</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 *chars)</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 diff --git a/include/Scintilla.h b/include/Scintilla.h index b1e6e3504..7dca10ae4 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -669,6 +669,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETPOSITIONCACHE 2515 #define SCI_COPYALLOWLINE 2519 #define SCI_GETCHARACTERPOINTER 2520 +#define SCI_SETKEYSUNICODE 2521 +#define SCI_GETKEYSUNICODE 2522 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 949452efb..c8759e591 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1804,6 +1804,12 @@ fun void CopyAllowLine=2519(,) # characters in the document. get int GetCharacterPointer=2520(,) +# Always interpret keyboard input as Unicode +set void SetKeysUnicode=2521(bool keysUnicode,) + +# Are keys always interpreted as Unicode? +get bool GetKeysUnicode=2522(,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index b06683a9b..b4c5a825f 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -283,6 +283,7 @@ private: HBITMAP sysCaretBitmap; int sysCaretWidth; int sysCaretHeight; + bool keysAlwaysUnicode; }; HINSTANCE ScintillaWin::hInstance = 0; @@ -320,6 +321,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) { sysCaretWidth = 0; sysCaretHeight = 0; + keysAlwaysUnicode = false; + Initialise(); } @@ -763,7 +766,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case WM_CHAR: if (((wParam >= 128) || !iscntrl(wParam)) || !lastKeyDownConsumed) { - if (::IsWindowUnicode(MainHWND())) { + if (::IsWindowUnicode(MainHWND()) || keysAlwaysUnicode) { wchar_t wcs[2] = {wParam, 0}; if (IsUnicodeMode()) { // For a wide character version of the window: @@ -1011,6 +1014,13 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam ::SetFocus(MainHWND()); break; + case SCI_SETKEYSUNICODE: + keysAlwaysUnicode = wParam != 0; + break; + + case SCI_GETKEYSUNICODE: + return keysAlwaysUnicode; + #ifdef SCI_LEXER case SCI_LOADLEXERLIBRARY: LexerManager::GetInstance()->Load(reinterpret_cast<const char*>(lParam)); |