#pragma once #include "lumacs/buffer.hpp" #include "lumacs/window.hpp" #include "lumacs/config.hpp" #include "lumacs/theme.hpp" #include #include #include #include #include namespace lumacs { // Forward declarations class LuaApi; class KillRing; class KeyBindingManager; class ModelineManager; class MinibufferManager; class CommandSystem; class CompletionSystem; /// @brief Interface defining the essential editor services that commands can interact with. /// This interface aims to reduce the direct coupling of CommandSystem and individual commands /// to the entire EditorCore class, making them more testable and modular. class ICommandTarget { public: virtual ~ICommandTarget() = default; // Buffer Management virtual const Buffer& buffer() const noexcept = 0; virtual Buffer& buffer() noexcept = 0; virtual bool load_file(const std::filesystem::path& path) = 0; virtual void new_buffer(std::string name = "*scratch*") = 0; virtual std::vector get_buffer_names() const = 0; virtual std::shared_ptr get_buffer_by_name(const std::string& name) = 0; virtual bool switch_buffer_in_window(const std::string& name) = 0; virtual bool close_buffer(const std::string& name) = 0; // Window Management virtual std::shared_ptr active_window() const = 0; virtual bool set_active_window(std::shared_ptr window) = 0; virtual void split_horizontally() = 0; virtual void split_vertically() = 0; virtual void close_active_window() = 0; virtual void next_window() = 0; // Cursor Management virtual Position cursor() const noexcept = 0; virtual void set_cursor(Position pos) = 0; // Basic Editing (proxied from EditorCore for commands) virtual void move_up() = 0; virtual void move_down() = 0; virtual void move_left() = 0; virtual void move_right() = 0; virtual void move_to_line_start() = 0; virtual void move_to_line_end() = 0; virtual void move_forward_word() = 0; virtual void move_backward_word() = 0; virtual void page_up() = 0; virtual void page_down() = 0; virtual void goto_beginning() = 0; virtual void goto_end() = 0; virtual void goto_line(size_t line) = 0; virtual void kill_line() = 0; virtual void kill_region() = 0; virtual void copy_region_as_kill() = 0; virtual void yank() = 0; virtual void yank_pop() = 0; virtual void kill_word() = 0; virtual void backward_kill_word() = 0; // Message Display virtual void set_message(std::string msg) = 0; // Quit virtual void request_quit() = 0; // Configuration virtual Config& config() = 0; virtual const Config& config() const = 0; // Theme Management virtual ThemeManager& theme_manager() = 0; virtual const ThemeManager& theme_manager() const = 0; }; } // namespace lumacs