|
|
@@ -889,6 +889,57 @@ bool EditorCore::yank_from_register(char register_name) {
|
|
|
return insert_register(register_name);
|
|
|
}
|
|
|
|
|
|
+// === Keyboard Macros ===
|
|
|
+
|
|
|
+void EditorCore::start_kbd_macro() {
|
|
|
+ if (recording_macro_) {
|
|
|
+ set_message("Already recording macro");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ recording_macro_ = true;
|
|
|
+ current_macro_.clear();
|
|
|
+ set_message("Recording macro...");
|
|
|
+}
|
|
|
+
|
|
|
+void EditorCore::end_kbd_macro_or_call() {
|
|
|
+ if (recording_macro_) {
|
|
|
+ // End recording
|
|
|
+ recording_macro_ = false;
|
|
|
+ last_macro_ = current_macro_;
|
|
|
+ current_macro_.clear();
|
|
|
+
|
|
|
+ if (last_macro_.empty()) {
|
|
|
+ set_message("Macro recorded (empty)");
|
|
|
+ } else {
|
|
|
+ set_message(std::string("Macro recorded (") + std::to_string(last_macro_.size()) + " keys)");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // Call last macro
|
|
|
+ if (last_macro_.empty()) {
|
|
|
+ set_message("No macro recorded");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ set_message(std::string("Executing macro (") + std::to_string(last_macro_.size()) + " keys)");
|
|
|
+
|
|
|
+ // This is a simplified approach - in a real implementation, you'd need
|
|
|
+ // to replay the actual commands through the key binding system
|
|
|
+ // For now, we just show that the macro system is set up
|
|
|
+ for (const auto& key : last_macro_) {
|
|
|
+ // TODO: Execute the actual key binding for this key
|
|
|
+ // This would require access to the LuaApi from EditorCore
|
|
|
+ std::cerr << "[MACRO] Would execute key: " << key << std::endl;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void EditorCore::record_key_sequence(const std::string& key_sequence) {
|
|
|
+ if (recording_macro_) {
|
|
|
+ current_macro_.push_back(key_sequence);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// === Private ===
|
|
|
|
|
|
void EditorCore::emit_event(EditorEvent event) {
|