#pragma once

#include <string>
#include <vector>
#include <memory>
#include <optional>

#include "lumacs/buffer.hpp" // For Position and Range

namespace lumacs {

class EditorCore; // Forward declaration

/// @brief Manages Emacs-like rectangle operations (kill, yank, string).
class RectangleManager {
public:
    explicit RectangleManager(EditorCore& core);

    /// @brief Kills (cuts) a rectangular region of text.
    void kill_rectangle();

    /// @brief Yanks (pastes) the last killed rectangular region.
    void yank_rectangle();

    /// @brief Replaces a rectangular region with a given string, repeating it as necessary.
    void string_rectangle(const std::string& text);

private:
    EditorCore& core_;
    std::vector<std::string> rectangle_kill_ring_; // Stores the last killed rectangle
};

} // namespace lumacs
