rectangle_manager.hpp 834 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <string>
  3. #include <vector>
  4. #include <memory>
  5. #include <optional>
  6. #include "lumacs/buffer.hpp" // For Position and Range
  7. namespace lumacs {
  8. class EditorCore; // Forward declaration
  9. /// @brief Manages Emacs-like rectangle operations (kill, yank, string).
  10. class RectangleManager {
  11. public:
  12. explicit RectangleManager(EditorCore& core);
  13. /// @brief Kills (cuts) a rectangular region of text.
  14. void kill_rectangle();
  15. /// @brief Yanks (pastes) the last killed rectangular region.
  16. void yank_rectangle();
  17. /// @brief Replaces a rectangular region with a given string, repeating it as necessary.
  18. void string_rectangle(const std::string& text);
  19. private:
  20. EditorCore& core_;
  21. std::vector<std::string> rectangle_kill_ring_; // Stores the last killed rectangle
  22. };
  23. } // namespace lumacs