Skip to content

Wire xterm resize events to RazorConsoleRenderer for dynamic re-rendering#199

Merged
LittleLittleCloud merged 3 commits intomainfrom
copilot/fix-xterm-resize-re-render
Nov 26, 2025
Merged

Wire xterm resize events to RazorConsoleRenderer for dynamic re-rendering#199
LittleLittleCloud merged 3 commits intomainfrom
copilot/fix-xterm-resize-re-render

Conversation

Copy link
Contributor

Copilot AI commented Nov 26, 2025

The xterm terminal in RazorConsole.Website would resize visually via FitAddon, but the C# renderer remained unaware of dimension changes, causing content to render at stale dimensions.

Changes

C# WASM Interface

  • Added HandleResize(string elementID, int cols, int rows) JSExport method in Registry
  • Added HandleResize(int cols, int rows) to IRazorConsoleRenderer interface
  • Stored LiveDisplayCanvas reference in RazorConsoleRenderer to enable manual refresh

Resize Handler Implementation

  • RazorConsoleRenderer.HandleResize() updates AnsiConsole.Profile.Width/Height and calls canvas.Refresh()
  • TypeScript handleResize() forwards terminal dimensions to WASM exports

Browser Integration

  • XTermPreview.tsx ResizeObserver now captures term.cols/rows after fit and invokes handleResize()
  • Updated TypeScript definitions in main.d.ts to include HandleResize signature

Flow: Browser resize → FitAddon adjusts terminal → ResizeObserver captures dimensions → JS calls WASM → C# updates profile and triggers re-render.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: website - xterm resize should trigger a re-render in RazorConsoleRenderer in RazorConsole.Website</issue_title>
<issue_description>### Description

As title

Steps to Reproduce

N/a

Expected Behavior

Resize trigger re-render

Actual Behavior

Not re-render

Environment

No response

Additional Context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 26, 2025 02:52
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Co-authored-by: LittleLittleCloud <16876986+LittleLittleCloud@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix xterm resize triggering re-render in RazorConsoleRenderer Wire xterm resize events to RazorConsoleRenderer for dynamic re-rendering Nov 26, 2025
@github-actions
Copy link

github-actions bot commented Nov 26, 2025

🚀 Preview Deployment

A preview build has been generated for this PR from CI run #19690981536!

Download the artifact:
website-preview-199-ffce4080f2cea33d6c82ee67ea789e006ed3c9b9

To view the preview locally:

  1. Download the artifact from the CI workflow run
  2. Extract the ZIP file
  3. Serve the files with a local web server
    (e.g., npx serve dist)

🌐 Live Preview URL: https://86a02b77.razorconsole.pages.dev

The live preview will be automatically updated when you push new
commits to this PR.

@LittleLittleCloud LittleLittleCloud marked this pull request as ready for review November 26, 2025 04:23
@LittleLittleCloud LittleLittleCloud enabled auto-merge (squash) November 26, 2025 05:23
@LittleLittleCloud LittleLittleCloud merged commit fa619cb into main Nov 26, 2025
12 checks passed
@LittleLittleCloud LittleLittleCloud deleted the copilot/fix-xterm-resize-re-render branch November 26, 2025 06:24
@github-actions github-actions bot added this to the v0.2.0 milestone Nov 26, 2025
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.

[Bug]: website - xterm resize should trigger a re-render in RazorConsoleRenderer in RazorConsole.Website

2 participants