@@ -434,8 +434,31 @@ export function App({ projectRoot, initialPrompt, onRestart }: AppProps): React.
434434 }
435435 lastRenderedColumnsRef . current = stableColumns ;
436436
437+ if ( mode === RawMode . Raw ) {
438+ // In raw mode, re-render all messages directly to stdout at the new width.
439+ // Use process.stdout.write instead of writeRef to avoid Ink interference.
440+ process . stdout . write ( "\u001B[2J\u001B[3J\u001B[H" ) ;
441+ const activeSessionId = sessionManager . getActiveSessionId ( ) ;
442+ const allMessages = activeSessionId ? loadVisibleMessages ( sessionManager , activeSessionId ) : [ ] ;
443+ for ( const msg of allMessages ) {
444+ process . stdout . write ( "\n" ) ;
445+ process . stdout . write ( renderMessageToStdout ( msg , mode ) + "\n\n" ) ;
446+ }
447+ if ( allMessages . length > 0 ) {
448+ process . stdout . write ( "\n\n" ) ;
449+ process . stdout . write ( chalk . dim ( "Press ESC to exit raw mode" ) ) ;
450+ } else {
451+ process . stdout . write ( "\n" ) ;
452+ process . stdout . write ( chalk . dim ( "(No messages in this session yet. Start chatting to see them here.)" ) ) ;
453+ process . stdout . write ( "\n\n" ) ;
454+ process . stdout . write ( chalk . dim ( "Press ESC to exit raw mode" ) ) ;
455+ }
456+ return ;
457+ }
458+
437459 // Force full redraw on terminal resize to avoid stale wrapped rows.
438460 writeRef . current ( "\u001B[2J\u001B[H" ) ;
461+
439462 setMessages ( [ ] ) ;
440463 setShowWelcome ( false ) ;
441464 setWelcomeNonce ( ( n ) => n + 1 ) ;
@@ -447,7 +470,8 @@ export function App({ projectRoot, initialPrompt, onRestart }: AppProps): React.
447470 setMessages ( nextMessages ) ;
448471 setShowWelcome ( true ) ;
449472 } , 0 ) ;
450- } , [ busy , sessionManager , stableColumns , stdout ] ) ;
473+ } , [ busy , mode , sessionManager , stableColumns , stdout ] ) ;
474+
451475 const screenWidth = useMemo ( ( ) => stableColumns ?? stdout ?. columns ?? 80 , [ stableColumns , stdout ] ) ;
452476 const promptHistory = useMemo ( ( ) => {
453477 return messages
0 commit comments