fix(v0.2.1): writeTerm this-binding (Critical — v0.2.0 load crash)#2
Merged
Conversation
…ding) v0.2.0 regression: writeTerm did (t.terminal.write ?? t.write)?.(seq) which detaches the write fn from its Terminal instance → this=undefined in ESM strict mode → Terminal.write reads this.writeLogPath → throws 'Cannot read properties of undefined'. Broke the extension on every load (updateConfig→applyCursorMode→ writeTerm throws during setCustomEditorComponent). Fix: call as a method (t.terminal.write(seq)) so this=Terminal. Added a regression test using a regular function (not arrow) reading this.writes — mirrors the real Terminal.write this-dependence; verified red (6 fails) on the buggy version, green on the fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v0.2.0 regression: writeTerm detached terminal.write from its Terminal instance → this=undefined → Terminal.write reads this.writeLogPath → throws on every load (updateConfig→applyCursorMode→writeTerm during setCustomEditorComponent). Broke the extension for all v0.2.0 users on reload/start.
Fix: call write as a method (t.terminal.write(seq)) so this=Terminal. Regression test uses a regular function reading this (mirrors real Terminal.write); verified red (6 fails) on buggy version, green on fix. 122/122 pass. Bump 0.2.0→0.2.1.