Skip to content

Commit 6e318ba

Browse files
Added width constraints to toast component for proper text wrapping. (#4441) Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <[email protected]>
1 parent ddddecf commit 6e318ba

File tree

1 file changed

+4
-0
lines changed
  • packages/opencode/src/cli/cmd/tui/ui

1 file changed

+4
-0
lines changed

packages/opencode/src/cli/cmd/tui/ui/toast.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createContext, useContext, type ParentProps, Show } from "solid-js"
22
import { createStore } from "solid-js/store"
33
import { useTheme } from "@tui/context/theme"
4+
import { useTerminalDimensions } from "@opentui/solid"
45
import { SplitBorder } from "../component/border"
56
import { TextAttributes } from "@opentui/core"
67
import z from "zod"
@@ -11,6 +12,7 @@ export type ToastOptions = z.infer<typeof TuiEvent.ToastShow.properties>
1112
export function Toast() {
1213
const toast = useToast()
1314
const { theme } = useTheme()
15+
const dimensions = useTerminalDimensions()
1416

1517
return (
1618
<Show when={toast.currentToast}>
@@ -21,6 +23,8 @@ export function Toast() {
2123
alignItems="flex-start"
2224
top={2}
2325
right={2}
26+
width={Math.min(60, dimensions().width - 6)}
27+
maxWidth={Math.min(60, dimensions().width - 6)}
2428
paddingLeft={2}
2529
paddingRight={2}
2630
paddingTop={1}

0 commit comments

Comments
 (0)