11import React from "react" ;
2- import { Box , Text } from "ink" ;
2+ import { Box , Text , useWindowSize } from "ink" ;
33import { renderMarkdown } from "./markdown" ;
44import type { SessionMessage } from "../session" ;
55
@@ -9,6 +9,7 @@ type Props = {
99} ;
1010
1111export function MessageView ( { message, collapsed } : Props ) : React . ReactElement | null {
12+ const { columns } = useWindowSize ( ) ;
1213 if ( ! message . visible ) {
1314 return null ;
1415 }
@@ -46,20 +47,20 @@ export function MessageView({ message, collapsed }: Props): React.ReactElement |
4647 return (
4748 < Box marginLeft = { 1 } flexDirection = "column" marginY = { 0 } >
4849 < StatusLine bulletColor = "gray" name = "Thinking" params = { summary } />
49- < Box flexDirection = "column" marginLeft = { 2 } >
50+ < Box flexDirection = "column" marginLeft = { 4 } >
5051 { content ? < Text dimColor > { renderMarkdown ( content ) } </ Text > : null }
5152 </ Box >
5253 </ Box >
5354 ) ;
5455 }
5556
5657 return (
57- < Box marginLeft = { 1 } marginBottom = { 1 } flexGrow = { 1 } gap = { 1 } marginY = { 0 } >
58- < Box >
58+ < Box marginLeft = { 1 } marginBottom = { 1 } width = { columns - 2 } gap = { 1 } marginY = { 0 } flexDirection = "row" >
59+ < Box alignSelf = "stretch" >
5960 < Text color = "#229ac3" > ✦</ Text >
6061 </ Box >
61- < Box flexDirection = "column" flexGrow = { 1 } >
62- { content ? < Text > { renderMarkdown ( content ) } </ Text > : null }
62+ < Box flexGrow = { 1 } width = { columns - 4 } >
63+ { content ? < Text wrap = "wrap" > { renderMarkdown ( content ) } </ Text > : null }
6364 </ Box >
6465 </ Box >
6566 ) ;
0 commit comments