diff options
author | pommicket <pommicket@gmail.com> | 2023-08-05 12:18:52 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-08-05 12:18:52 -0400 |
commit | 601c081d62e0cd9c0e6750b424ecc5baa9a45b5f (patch) | |
tree | 0852f1fcbcebc31a05ec97c77e2634cc90237de7 /macro.c | |
parent | ef84bb759becde98318011652c6c5b8a52433359 (diff) |
more plugin preparation
Diffstat (limited to 'macro.c')
-rw-r--r-- | macro.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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; } |