#include "lumacs/register_manager.hpp"

namespace lumacs {

void RegisterManager::copy_to_register(char register_name, const std::string& text) {
    // Basic validation, EditorCore will handle messages
    if (std::isalnum(static_cast<unsigned char>(register_name))) {
        registers_[register_name] = text;
    }
}

std::optional<std::string> RegisterManager::get_from_register(char register_name) const {
    if (std::isalnum(static_cast<unsigned char>(register_name))) {
        auto it = registers_.find(register_name);
        if (it != registers_.end()) {
            return it->second;
        }
    }
    return std::nullopt;
}

} // namespace lumacs