Skip to content

fixed(RunButton): Fixed the BUG in CodeBlockContext where srcCode was overwritten after multiple executions#424

Open
shunlibest wants to merge 1 commit intotwibiral:masterfrom
shunlibest:fix/bug
Open

fixed(RunButton): Fixed the BUG in CodeBlockContext where srcCode was overwritten after multiple executions#424
shunlibest wants to merge 1 commit intotwibiral:masterfrom
shunlibest:fix/bug

Conversation

@shunlibest
Copy link

A new field 'injectedCode' has been added to the 'CodeBlockContext' interface in 'RunButton.ts', and the reference to this field has been updated in the relevant code block handling method. This can more clearly distinguish between the original code and the processed code.

fixed:#417

src/RunButton.ts Outdated
function runCode(cmd: string, cmdArgs: string, ext: string, block: CodeBlockContext, options?: { shell?: boolean; transform?: (code: string) => string; }) {
const useShell: boolean = (options?.shell) ? options.shell : false;
if (options?.transform) block.srcCode = options.transform(block.srcCode);
if (options?.transform) block.injectedCode = options.transform(block.injectCode);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

injectedCode instead of injectCode

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

… overwritten after multiple executions

A new field 'injectCode' has been added to the 'CodeBlockContext' interface in 'RunButton.ts', and the reference to this field has been updated in the relevant code block handling method. This can more clearly distinguish between the original code and the processed code.
Copy link

@cu1ch3n cu1ch3n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works well on my machine, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants