Skip to content

Commit

Permalink
Merge pull request #1633 from technomancy/fix-eval-command
Browse files Browse the repository at this point in the history
Fix eval command
  • Loading branch information
nesbox authored Nov 1, 2021
2 parents 60e63de + f62cce3 commit 8c6aecf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/studio/screens/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ static void commandDoneLine(Console* console, bool newLine)
clearSelection(console);

FREE(console->desc->src);
FREE(console->desc->command);
FREE(console->desc->params);

memset(console->desc, 0, sizeof(CommandDesc));
Expand Down Expand Up @@ -2317,7 +2318,8 @@ static void onEvalCommand(Console* console)
if (script_config->eval)
{
if(console->desc->count)
script_config->eval(console->tic, console->desc->params->key);
script_config->eval(console->tic,
console->desc->src+strlen(console->desc->command));
else printError(console, "nothing to eval");
}
else
Expand Down Expand Up @@ -3100,11 +3102,12 @@ static void onHelpCommand(Console* console)
commandDone(console);
}

static CommandDesc parseCommand(const char* command)
static CommandDesc parseCommand(const char* input)
{
CommandDesc desc = {.src = strdup(command)};
CommandDesc desc = {.src = strdup(input),
.command = strdup(input)};

char* token = desc.command = strtok(desc.src, " ");
char* token = strtok(desc.command, " ");

while((token = strtok(NULL, " ")))
{
Expand Down

0 comments on commit 8c6aecf

Please sign in to comment.