MCPcopy Create free account
hub / github.com/Marus/cortex-debug / writeNonBinary

Method writeNonBinary

src/frontend/rtt_terminal.ts:102–125  ·  view source on GitHub ↗
(buf: Buffer)

Source from the content-addressed store, hash-verified

100 }
101
102 private writeNonBinary(buf: Buffer) {
103 let start = 0;
104 let time = '';
105 if (this.options.timestamp) {
106 time = this.hrTimer.createDateTimestamp() + ' ';
107 }
108
109 for (let ix = 1; ix < buf.length; ix++ ) {
110 if (buf[ix - 1] !== 0xff) { continue; }
111 const chr = buf[ix];
112 if (((chr >= 48) && (chr <= 57)) || ((chr >= 65) && (chr <= 90))) {
113 if (ix >= 1) {
114 this.ptyTerm.writeWithHeader(buf.slice(start, ix - 1), time);
115 }
116 this.ptyTerm.write(`<switch to vTerm#${String.fromCharCode(chr)}>\n`);
117 buf = buf.slice(ix + 1);
118 ix = 0;
119 start = 0;
120 }
121 }
122 if (buf.length > 0) {
123 this.ptyTerm.writeWithHeader(buf, time);
124 }
125 }
126
127 protected createTermOptions(existing: string | null): IPtyTerminalOptions {
128 const ret: IPtyTerminalOptions = {

Callers 1

onDataMethod · 0.95

Calls 3

createDateTimestampMethod · 0.80
writeWithHeaderMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected