@@ -539,6 +539,10 @@ export class Terminal implements ITerminalCore {
539539 // Write directly to WASM terminal (handles VT parsing internally)
540540 this . wasmTerm ! . write ( data ) ;
541541
542+ // Process any responses generated by the terminal (e.g., DSR cursor position)
543+ // These need to be sent back to the PTY via onData
544+ this . processTerminalResponses ( ) ;
545+
542546 // Check for bell character (BEL, \x07)
543547 // WASM doesn't expose bell events, so we detect it in the data stream
544548 if ( typeof data === 'string' && data . includes ( '\x07' ) ) {
@@ -1721,6 +1725,29 @@ export class Terminal implements ITerminalCore {
17211725 animate ( ) ;
17221726 }
17231727
1728+ /**
1729+ * Process any pending terminal responses and emit them via onData.
1730+ *
1731+ * This handles escape sequences that require the terminal to send a response
1732+ * back to the PTY, such as:
1733+ * - DSR 6 (cursor position): Shell sends \x1b[6n, terminal responds with \x1b[row;colR
1734+ * - DSR 5 (operating status): Shell sends \x1b[5n, terminal responds with \x1b[0n
1735+ *
1736+ * Without this, shells like nushell that rely on cursor position queries
1737+ * will hang waiting for a response that never comes.
1738+ */
1739+ private processTerminalResponses ( ) : void {
1740+ if ( ! this . wasmTerm ) return ;
1741+
1742+ // Read any pending responses from the WASM terminal
1743+ const response = this . wasmTerm . readResponse ( ) ;
1744+ if ( response ) {
1745+ // Send response back to the PTY via onData
1746+ // This is the same path as user keyboard input
1747+ this . dataEmitter . fire ( response ) ;
1748+ }
1749+ }
1750+
17241751 /**
17251752 * Check for title changes in written data (OSC sequences)
17261753 * Simplified implementation - looks for OSC 0, 1, 2
0 commit comments