BCad fork

Editor System
Login

Editor System

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

Lifecycle

  1. __init__ — appends self to _instances
  2. render() — calls imgui.begin() with p_open, handles close via early return with _instances.remove(self)
  3. render_all() — classmethod, iterates reversed(_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