MCPcopy
hub / github.com/anomalyco/opencode / draw

Function draw

packages/opencode/src/cli/cmd/run/splash.ts:144–172  ·  view source on GitHub ↗
(
  lines: Array<{ left: number; top: number; text: string; fg: ColorInput; bg?: ColorInput; attrs?: number }>,
  row: string,
  input: {
    left: number
    top: number
    fg: ColorInput
    shadow: ColorInput
    attrs?: number
  },
)

Source from the content-addressed store, hash-verified

142}
143
144function draw(
145 lines: Array<{ left: number; top: number; text: string; fg: ColorInput; bg?: ColorInput; attrs?: number }>,
146 row: string,
147 input: {
148 left: number
149 top: number
150 fg: ColorInput
151 shadow: ColorInput
152 attrs?: number
153 },
154) {
155 let x = input.left
156 for (const cell of cells(row)) {
157 if (cell.mark === "full" || cell.mark === "mix") {
158 push(lines, x, input.top, cell.char, input.fg, input.shadow, input.attrs)
159 x += 1
160 continue
161 }
162
163 if (cell.mark === "top") {
164 push(lines, x, input.top, cell.char, input.shadow, undefined, input.attrs)
165 x += 1
166 continue
167 }
168
169 push(lines, x, input.top, cell.char, input.fg, undefined, input.attrs)
170 x += 1
171 }
172}
173
174function build(input: SplashWriterInput, kind: "entry" | "exit", ctx: ScrollbackRenderContext): ScrollbackSnapshot {
175 const width = Math.max(1, ctx.width)

Callers 5

toolInlineInfoFunction · 0.70
toolScrollFunction · 0.70
toolPermissionInfoFunction · 0.70
toolSnapshotFunction · 0.70
buildFunction · 0.70

Calls 2

cellsFunction · 0.85
pushFunction · 0.70

Tested by

no test coverage detected