summaryrefslogtreecommitdiff
path: root/macro.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-05 12:18:52 -0400
committerpommicket <pommicket@gmail.com>2023-08-05 12:18:52 -0400
commit601c081d62e0cd9c0e6750b424ecc5baa9a45b5f (patch)
tree0852f1fcbcebc31a05ec97c77e2634cc90237de7 /macro.c
parentef84bb759becde98318011652c6c5b8a52433359 (diff)
more plugin preparation
Diffstat (limited to 'macro.c')
-rw-r--r--macro.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/macro.c b/macro.c
index 14ec016..19ebcd8 100644
--- a/macro.c
+++ b/macro.c
@@ -27,15 +27,16 @@ void macro_stop_recording(Ted *ted) {
ted->recording_macro = NULL;
}
-void macro_add(Ted *ted, Command command, CommandArgument argument) {
+void macro_add(Ted *ted, Command command, const CommandArgument *argument) {
if (!ted->recording_macro) return;
if (command == CMD_MACRO_EXECUTE || command == CMD_MACRO_RECORD || command == CMD_MACRO_STOP)
return;
- if (argument.string)
- argument.string = str_dup(argument.string);
+ CommandArgument arg = *argument;
+ if (arg.string)
+ arg.string = str_dup(arg.string);
Action action = {
.command = command,
- .argument = argument
+ .argument = arg
};
arr_add(ted->recording_macro->actions, action);
}
@@ -49,10 +50,9 @@ void macro_execute(Ted *ted, u32 index) {
}
ted->executing_macro = true;
- CommandContext context = {0};
- context.from_macro = true;
+ const CommandContext context = {.running_macro = true};
arr_foreach_ptr(macro->actions, Action, act) {
- command_execute_ex(ted, act->command, act->argument, context);
+ command_execute_ex(ted, act->command, &act->argument, &context);
}
ted->executing_macro = false;
}