This document unifies the project's refactoring plan with the detailed development state and review findings. It serves as the single source of truth for the codebase's current status, identified areas for improvement, and the roadmap for future development.
[Lua 5.4 Engine]
^ |
| v
[Lua API Bridge] <-- C++ bindings for buffers, windows, keybindings, themes
^ |
| v
[Editor Core] <-- Buffer management, kill ring, face system, modeline
^ |
| v
[UI Interface] <-- Abstract UI layer
^ |
| v
[GTK4 Frontend] <-- Primary GUI (with TUI fallback available)
|
v
[Terminal/Display]
Lumacs/
├── CMakeLists.txt # Build configuration
├── init.lua # Main Lua initialization
├── themes.lua # Theme definitions
├── include/lumacs/
│ ├── editor_core.hpp # Core editor logic
│ ├── buffer.hpp # Text buffer management
│ ├── lua_api.hpp # C++/Lua bridge
│ ├── gtk_editor.hpp # GTK4 frontend
│ ├── tui_editor.hpp # TUI fallback
│ ├── keybinding.hpp # Key handling
│ ├── theme.hpp # Theme/face system
│ ├── command_system.hpp # Command registry & completion engine
│ ├── modeline.hpp # NEW: Modeline framework
│ ├── i_editor_notifier.hpp # NEW: Decoupling interface
│ ├── i_window_manager.hpp # NEW: Decoupling interface
│ └── [other headers]
├── src/
│ ├── main.cpp # Entry point
│ ├── editor_core.cpp # Core functionality
│ ├── lua_api.cpp # Lua bindings
│ ├── gtk_editor.cpp # GTK implementation
│ ├── command_system.cpp # Command execution & completion
│ ├── modeline.cpp # NEW: Modeline implementation
│ └── [other .cpp files]
├── tests/
├── examples/
├── scripts/
└── documentation/
EditorCore God Object: The EditorCore class currently handles a vast array of responsibilities, leading to high coupling and reduced modularity. The primary goal is to break down this monolithic class into smaller, more specialized, and cohesive components (manager classes, services).std::cerr debug outputs with a proper logging system for better debuggability and runtime insight.BufferManager (class, header, and implementation). EditorCore now delegates buffer-related operations to BufferManager.WindowManager (class, header, and implementation). EditorCore now delegates window-related operations to WindowManager.KillRingManager (class, header, and implementation). EditorCore now delegates kill-ring-related operations to KillRingManager.RegisterManager (class, header, and implementation). EditorCore now delegates register-related operations to RegisterManager.MacroManager (class, header, and implementation). EditorCore now delegates macro-related operations to MacroManager.RectangleManager (class, header, and implementation). EditorCore now delegates rectangle-related operations to RectangleManager.EditorCore have been moved to their respective new manager classes.EditorCore now holds std::unique_ptr instances of these new manager classes.EditorCore methods have been refactored to delegate calls to the appropriate manager classes.EditorCore and the new manager classes occurs through well-defined, minimal interfaces.IEditorNotifier and IWindowManager interfaces. EditorCore implements these interfaces.BufferManager and WindowManager now depend on these interfaces instead of the concrete EditorCore class, breaking the strong circular dependency.test_framework.hpp.test_buffer.cpp and test_editor_core.cpp have been converted to Google Test format.spdlog via FetchContent in CMakeLists.txt.Logger wrapper class in include/lumacs/logger.hpp and src/logger.cpp.std::cerr Calls: ✅ Completed
std::cerr for debug/error output with appropriate calls to the new logging library.src/main.cpp, src/plugin_manager.cpp, src/buffer_manager.cpp, src/gtk_editor.cpp, src/editor_core.cpp, src/command_system.cpp, src/window_manager.cpp, src/macro_manager.cpp, and src/lua_api.cpp.sol2 Dependency: ✅ Completed
sol2 releases and updated CMakeLists.txt to use GIT_TAG v3.5.0 instead of develop for improved stability.LuaApi, CommandSystem, and Window.sol2 dependency).MinibufferManager. Integrations for command argument handling are fully implemented as part of Phase C.Window class, while UI rendering (blinking, inverted block style) is handled correctly by GtkEditor.Buffer class are comprehensive, robust, and correctly handle multi-line scenarios, state updates and events.*Messages* buffer to log all minibuffer outputs, ensuring history is accessible via buffer switching.curs_set(2)). Added fallback software cursor with forced A_REVERSE to ensure visibility on all terminals.editor:create_and_register_theme Lua API to allow theme definition from Lua.default, everforest-dark, dracula, solarized-dark, nord, gruvbox-light) into individual Lua files (lua/themes/*.lua).src/theme.cpp, include/lumacs/theme.hpp).init.lua to load the new individual theme files and themes_init.lua.create_and_register_theme method binding was missing the EditorCore& first parameter, causing empty theme names.set-theme command to defaults.hpp as a fundamental command that theme switching functions depend on.active_theme property access in lua/themes/themes_init.lua - changed from editor.theme_manager.active_theme to editor.theme_manager:active_theme() function calls.M-x set-theme, C-x t keybindings work (including C-x t l for listing), and theme cycling is operational.EditorEvent::ThemeChanged and GtkRenderer::invalidate_cache() to ensure UI updates immediately when a new theme is applied.GtkRenderer.BufferManager class.WindowManager class.KillRingManager class.RegisterManager class.MacroManager class.RectangleManager class.test_buffer.cpp and test_editor_core.cpp to Google Test format.GtkRenderer (undeclared identifier, unused variable) and TuiEditor (missing implementation due to file corruption). Restored TUI hardware cursor support.sol2 binding issues for C++ managed objects (non-copyable) resolved via manual Lua C functions for core interactions.Gtk::Popover.lumacs_backward_delete_char function regarding position calculation for erase_char and cursor update.EditorCoreTest.MoveCursorRight Disabled: ✅ Fixed. Re-enabled and passing.snake_case for functions/variables, PascalCase for classes).std::unique_ptr/std::shared_ptr, const correctness, and move semantics where appropriate.feat:, fix:, refactor:, test:, docs: prefixes). Explain why the change was made, not just what was changed.refactor(editor_core): Extract buffer management into BufferManager classinclude/lumacs/, src/, tests/).README.md, documentation/) if changes impact the project's architecture or build process.cmake --build build, ctest).