# 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
```
