Function
write
(
root: BoxRenderable,
ctx: ScrollbackRenderContext,
line: {
left: number
top: number
text: string
fg: ColorInput
bg?: ColorInput
attrs?: number
},
)
Source from the content-addressed store, hash-verified
| 98 | } |
| 99 | |
| 100 | function write( |
| 101 | root: BoxRenderable, |
| 102 | ctx: ScrollbackRenderContext, |
| 103 | line: { |
| 104 | left: number |
| 105 | top: number |
| 106 | text: string |
| 107 | fg: ColorInput |
| 108 | bg?: ColorInput |
| 109 | attrs?: number |
| 110 | }, |
| 111 | ): void { |
| 112 | if (line.left >= ctx.width) { |
| 113 | return |
| 114 | } |
| 115 | |
| 116 | root.add( |
| 117 | new TextRenderable(ctx.renderContext, { |
| 118 | position: "absolute", |
| 119 | left: line.left, |
| 120 | top: line.top, |
| 121 | width: Math.max(1, ctx.width - line.left), |
| 122 | height: 1, |
| 123 | wrapMode: "none", |
| 124 | content: line.text, |
| 125 | fg: line.fg, |
| 126 | bg: line.bg, |
| 127 | attributes: line.attrs, |
| 128 | }), |
| 129 | ) |
| 130 | } |
| 131 | |
| 132 | function push( |
| 133 | lines: Array<{ left: number; top: number; text: string; fg: ColorInput; bg?: ColorInput; attrs?: number }>, |
Tested by
no test coverage detected