Add integrated terminal panel with xterm.js and node-pty#881
Open
bobicloudvision wants to merge 4 commits into
Open
Add integrated terminal panel with xterm.js and node-pty#881bobicloudvision wants to merge 4 commits into
bobicloudvision wants to merge 4 commits into
Conversation
Add an integrated terminal as a dockable panel in the editor layout,
backed by node-pty and rendered with xterm.js (fit + webgl addons).
- editor/src/editor/layout/terminal.tsx: terminal panel component
- editor/src/editor/layout.{tsx,json}: register the terminal tab
- editor/src/electron/node-pty.ts, src/tools/node-pty.ts, src/export.ts: pty backend wiring
- Bump layout version (5.0.0-alpha.2 -> 5.0.0-alpha.3) so existing users, whose saved layout predates the Terminal tab, reset to the default layout that now includes it. - Guard FitAddon.fit() against invalid (NaN/Infinity/zero) dimensions, which occur when an inactive flexlayout tab is mounted at 0x0 and corrupted the rendered terminal on resize. - Track the ResizeObserver and disconnect it on dispose to avoid leaking / stacking duplicate observers across re-inits.
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.
Summary
This pull request introduces a built-in terminal panel to the editor layout. It uses
xterm.jswithfitandwebgladdons for rendering andnode-ptyfor an interactive shell. The terminal automatically initializes when a project is open, follows the project’s working directory, resizes responsively, and restarts when the project path changes.Changes Made
Terminal integration
EditorTerminalcomponent rendering an embedded terminal panel with a sticky header.xterm.jswithFitAddonand optionalWebglAddonfor high-quality rendering and auto-fit behavior.node-ptyviaexecNodePtyto provide an interactive shell session.Project-awareness and lifecycle
projectConfiguration.pathand updates viaonProjectConfigurationChangedObservable.cwdis set relative to the current project path and re-initialized when the project changes.Responsiveness and UX
ResizeObservertriggersfit()for responsive sizing.Benefits
cwd, auto-restart on project switch).