Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
fix issue with sub commands reusing command state
- Loading branch information
Showing
with
5 additions
and
1 deletion.
-
+5
−1
src/teletype.c
|
|
@@ -169,7 +169,6 @@ process_result_t run_command(scene_state_t *ss, const tele_command_t *cmd) { |
|
|
process_result_t process_command(scene_state_t *ss, exec_state_t *es, |
|
|
const tele_command_t *c) { |
|
|
command_state_t cs; |
|
|
cs_init(&cs); |
|
|
|
|
|
// 1. Do we have a PRE seperator? |
|
|
// ------------------------------ |
|
|
@@ -214,6 +213,11 @@ process_result_t process_command(scene_state_t *ss, exec_state_t *es, |
|
|
const ssize_t sub_start = subs[sub_idx].start; |
|
|
const ssize_t sub_end = subs[sub_idx].end; |
|
|
|
|
|
// initialise the command state for each sub, otherwise a value left on |
|
|
// the stack for the previous sub, can cause the set fn to trigger when |
|
|
// it shouldn't |
|
|
cs_init(&cs); |
|
|
|
|
|
// as we are using a stack based language, we must process commands from |
|
|
// right to left |
|
|
for (ssize_t idx = sub_end; idx >= sub_start; idx--) { |
|
|
|