MCPcopy Create free account
hub / github.com/SplootCode/splootcode / reflowInput

Method reflowInput

packages/editor/src/runtime/wasm-tty/wasm-tty.ts:44–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42 }
43
44 reflowInput() {
45 const cols = this.xterm.cols
46 const lines: string[][] = []
47
48 const inputChars = Array.from(this.input)
49
50 const firstLine = inputChars.slice(0, cols - this.inputStartCursorX)
51 lines.push(firstLine)
52 let index = firstLine.length
53 let lastLineFull = firstLine.length === cols - this.inputStartCursorX
54 while (index < inputChars.length) {
55 const line = inputChars.slice(index, index + cols)
56 lines.push(line)
57 index += line.length
58 lastLineFull = line.length == cols
59 }
60 if (lastLineFull) {
61 lines.push([''])
62 }
63
64 // TODO: Redraw relevant lines
65 this.inputSplit = lines
66 }
67
68 getInput(): string {
69 return this.input.join('')

Callers 2

WasmTTYClass · 0.95
PythonFrameClass · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected