Unicode: Changelog, comments, minimum CI integration. (#2541, #2538, #2815)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ff83bd3..ccc5c24 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -54,7 +54,7 @@
       - name: Build example_null (single file build)
         shell: bash
         run: |
-          echo '#define IMGUI_IMPLEMENTATION'                    >> example_single_file.cpp
+          echo '#define IMGUI_IMPLEMENTATION'                    >  example_single_file.cpp
           echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
           echo '#include "examples/example_null/main.cpp"'       >> example_single_file.cpp
           g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp
@@ -190,6 +190,14 @@
 
     - name: Build example_null (single file build)
       run: |
+        echo '#define IMGUI_IMPLEMENTATION'                    >  example_single_file.cpp
+        echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
+        echo '#include "examples/example_null/main.cpp"'       >> example_single_file.cpp
+        g++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
+
+    - name: Build example_null (with ImWchar32)
+      run: |
+        echo '#define ImWchar ImWchar32'                       >  example_single_file.cpp
         echo '#define IMGUI_IMPLEMENTATION'                    >> example_single_file.cpp
         echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
         echo '#include "examples/example_null/main.cpp"'       >> example_single_file.cpp
@@ -226,7 +234,7 @@
 
     - name: Build example_null (single file build)
       run: |
-        echo '#define IMGUI_IMPLEMENTATION'                    >> example_single_file.cpp
+        echo '#define IMGUI_IMPLEMENTATION'                    >  example_single_file.cpp
         echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
         echo '#include "examples/example_null/main.cpp"'       >> example_single_file.cpp
         clang++ -I. -Wall -Wformat -o example_single_file example_single_file.cpp
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 7a7c1cd..792b833 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -45,6 +45,15 @@
   when the menu is not open. (#3030)
 - InputText: Fixed password fields displaying ASCII spaces as blanks instead of using the '*'
   glyph. (#2149, #515)
+- Added optional support for Unicode plane 1-16 (#2538, #2541, #2815) [@cloudwu, @samhocevar]
+  - Compile-time enable with '#define ImWchar ImWchar32' in imconfig.h.
+  - Generally more consistent support for unsupported codepoints (0xFFFD), in particular when
+    using the default, non-fitting characters will be turned into 0xFFFD instead of being ignored.
+  - Surrogate pairs are supported when submitting UTF-16 data via io.AddInputCharacterUTF16(),
+    allowing for more complete CJK input.
+  - sizeof(ImWchar) goes from 2 to 4. IM_UNICODE_CODEPOINT_MAX goes from 0xFFFF to 0x10FFFF.
+  - Various structures such as ImFont, ImFontGlyphRangesBuilder will use more memory, this
+    is currently not particularly efficient.
 - Window: Fixed a bug with child window inheriting ItemFlags from their parent when the child
   window also manipulate the ItemFlags stack. (#3024) [@Stanbroek]
 - Font: Fixed non-ASCII space occasionally creating unnecessary empty polygons.
@@ -53,6 +62,8 @@
   ImGui_ImplWin32_GetDpiScaleForMonitor() helpers functions (backported from the docking branch).
   Those functions makes it easier for example apps to support hi-dpi features without setting up
   a manifest.
+- Backends: Win32: Calling AddInputCharacterUTF16() from WM_CHAR message handler in order to support
+  high-plane surrogate pairs. (#2815) [@cloudwu, @samhocevar]
 - Backends: SDL: Added ImGui_ImplSDL2_InitForMetal() for API consistency (even though the function
   currently does nothing).
 - Backends: SDL: Fixed mapping for ImGuiKey_KeyPadEnter. (#3031) [@Davido71]
diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp
index 8b1c808..f8868ce 100644
--- a/examples/imgui_impl_win32.cpp
+++ b/examples/imgui_impl_win32.cpp
@@ -28,6 +28,7 @@
 
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
+//  2020-03-03: Inputs: Calling AddInputCharacterUTF16() to support surrogate pairs leading to codepoint >= 0x10000 (for more complete CJK inputs)
 //  2020-02-17: Added ImGui_ImplWin32_EnableDpiAwareness(), ImGui_ImplWin32_GetDpiScaleForHwnd(), ImGui_ImplWin32_GetDpiScaleForMonitor() helper functions.
 //  2020-01-14: Inputs: Added support for #define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD/IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT.
 //  2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
diff --git a/imgui.cpp b/imgui.cpp
index 8b1bda5..75c2fee 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -1525,6 +1525,7 @@
 {
 #if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(__CYGWIN__) && !defined(__GNUC__)
     // We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames.
+    // Previously we used ImTextCountCharsFromUtf8/ImTextStrFromUtf8 here but we now need to support ImWchar16 and ImWchar32!
     const int filename_wsize = ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
     const int mode_wsize = ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);
     ImVector<ImWchar> buf;
diff --git a/imgui.h b/imgui.h
index 021c12b..7079823 100644
--- a/imgui.h
+++ b/imgui.h
@@ -2101,7 +2101,7 @@
     inline void     Clear()                 { int size_in_bytes = (IM_UNICODE_CODEPOINT_MAX + 1) / 8; UsedChars.resize(size_in_bytes / (int)sizeof(ImU32)); memset(UsedChars.Data, 0, (size_t)size_in_bytes); }
     inline bool     GetBit(size_t n) const  { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); return (UsedChars[off] & mask) != 0; }  // Get bit n in the array
     inline void     SetBit(size_t n)        { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; }               // Set bit n in the array
-    inline void     AddChar(ImWchar c)      { SetBit(c); }                          // Add character
+    inline void     AddChar(ImWchar c)      { SetBit(c); }                      // Add character
     IMGUI_API void  AddText(const char* text, const char* text_end = NULL);     // Add string (each character of the UTF-8 string are added)
     IMGUI_API void  AddRanges(const ImWchar* ranges);                           // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext
     IMGUI_API void  BuildRanges(ImVector<ImWchar>* out_ranges);                 // Output new ranges