The code editor is built on ImGuiColorTextEdit (from cpp/imgui_bundle/external/ImGuiColorTextEdit/).
EditorWindow
EditorWindow in bcad/binterpreter/bcode_editor.py replaces the old Tab/TabbedEditor approach. Each file gets its own standalone ImGui window with a close button.
Class vars
_instances— list of all openEditorWindowobjects. Self-registered in__init__, self-removed inrender()early return on close._active_instance— the currently focused editor (set onis_window_appearing, cleared on close)._dock_left_id/_saved_dock_ids— docking node state cached for layout persistence.
Lifecycle
__init__— appends self to_instancesrender()— callsimgui.begin()withp_open, handles close via early return with_instances.remove(self)render_all()— classmethod, iteratesreversed(_instances)for safe self-removal during loop
Focus
On tab activation (is_window_appearing) the TextEditor calls set_focus(). The _active_instance class var tracks which editor is active.
Layout persistence
Dock positions are saved to layout.ini in a custom [EditorDockNodes] section (not settings.conf). Auto-save is disabled (ini_saving_rate = 0) to prevent ImGui from overwriting custom sections. Save/load is manual via load_ini_settings_from_disk / save_ini_settings_to_disk.
Customizations
- Bracket matching highlight disabled via
set_show_matching_brackets(False)inbcode_editor.py