johnsonj:
> The new API seems to need more time for well design.
Yes. We don’t want to go through the effort of updating applications and platform layers twice.
> It appears more complicated than I have expected.
> I implement it with copy&paste, trial&error, and finally your instructions.
You should be trying to find the set of options that are needed to support all the potential IME actions in a way that can be supported well into the future.
> =============================================================================
> About WM_UNICHAR:
> I have suggested to have a chance for these APIs.
>
> inline bool IsLeadSurrogate(wchar_t uch)
> inline bool IsTrailSurrogate(wchar_t uch)
> inline bool IsSurrogate(wchar_t uch)
>
> Might it be better IS_HIGH_SURROGATE(x) and IS_LOW_SURROGATE(x) reside as functions in uniconversion.h?
The code in the change set comes from Sam Hocevar, not me, but I’ll try to channel his probable reasons.
IS_HIGH_SURROGATE and IS_LOW_SURROGATE are defined by the Win32 API and their uses are only currently in ScintillaWin.cxx which sees the Win32 headers. Almost all builds will use the versions of these macros from the Windows headers.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd318683(v=vs.85).aspx
However, they were introduced for Windows Vista, so there is the possibility that Scintilla will be built with an old version of the Windows headers. Therefore there is also a definition.
I thought about changing these to functions in UniConversion.h but didn’t. There are some small benefits and costs either way. wchar_t is defined to be different sizes on Win32 and Unix and adding more wchar_t functions will spread the problems. If we could depend on C++11 then they could take char16_t and be the same on both platforms.
> Why addChar() is used instead of the existing addCharUTF()?
Because the code was copied from HandleCompositionWindowed. HandleCompositionWindowed and its predecessor HandleComposition have always called addChar.
Neil