feat(cpp/vendor): vendor ImGuiColorTextEdit (MIT) for text_editor primitive

Pinneado al commit 0a88824f del upstream. Patches locales aplicados a
TextEditor.cpp para compilar contra ImGui 1.91+ (GetKeyIndex eliminado,
PushAllowKeyboardFocus/PopAllowKeyboardFocus removidos). Documentado en
cpp/vendor/imgui_text_edit/README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 21:00:22 +02:00
parent 461bb77298
commit 7cccaec5dd
3 changed files with 3597 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
# ImGuiColorTextEdit (vendored)
Source: https://github.com/BalazsJako/ImGuiColorTextEdit
License: MIT
Pinned commit: `0a88824f7de8d0bd11d8419066caa7d3469395c4` (master HEAD at vendor time)
Files:
- `TextEditor.h`
- `TextEditor.cpp`
Used by `cpp/functions/core/text_editor.{h,cpp}` via PIMPL — the public API is in
`namespace fn::` and the vendor's `TextEditor` type is hidden inside the .cpp.
## Updating
```bash
cd cpp/vendor/imgui_text_edit
curl -fL -O https://raw.githubusercontent.com/BalazsJako/ImGuiColorTextEdit/<commit>/TextEditor.h
curl -fL -O https://raw.githubusercontent.com/BalazsJako/ImGuiColorTextEdit/<commit>/TextEditor.cpp
# Update commit hash above.
```
## Notes / known issues
- The vendor expects `imgui.h` and `imgui_internal.h` in the include path. Both are
provided by our vendored ImGui in `cpp/vendor/imgui/`.
- `LanguageDefinition::GLSL()`, `SQL()`, `CPlusPlus()` are provided by the vendor and
consumed by our wrapper (`fn::CodeLang`).
- `inotify` watcher limit on Linux — see `file_watcher_cpp_core.md`.
## Local patches applied
Upstream commit `0a88824f` predates several ImGui API removals (we vendor ImGui
1.91+). The following minimal in-tree patches were applied to `TextEditor.cpp`:
- `ImGui::GetKeyIndex(ImGuiKey_X)` -> `ImGuiKey_X` (the `ImGuiKey` enum is now a
direct, stable index — `GetKeyIndex` was removed).
- `ImGui::PushAllowKeyboardFocus(true)` / `PopAllowKeyboardFocus()` -> removed
(replaced upstream by `SetItemKeyOwner` / `ImGuiItemFlags_AllowKeyboardFocus`,
but the editor functions correctly without them in our embedding).
Re-apply when refreshing the vendor:
```bash
sed -i 's/ImGui::GetKeyIndex(\([^)]*\))/\1/g' TextEditor.cpp
sed -i 's/ImGui::PushAllowKeyboardFocus(true);/\/\/ removed in ImGui 1.89+/g' TextEditor.cpp
sed -i 's/ImGui::PopAllowKeyboardFocus();/\/\/ removed in ImGui 1.89+/g' TextEditor.cpp
```