Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/common/InputHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,11 @@ export class InputHandler extends Disposable implements IInputHandler {
}

// Log debug data, the log level gate is to prevent extra work in this hot path
if (this._logService.logLevel <= LogLevelEnum.DEBUG) {
Comment thread
anthonykim1 marked this conversation as resolved.
this._logService.debug(`parsing data${typeof data === 'string' ? ` "${data}"` : ` "${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}"`}`, typeof data === 'string'
? data.split('').map(e => e.charCodeAt(0))
: data
);
}
this._logService.debug(`parsing data ${typeof data === 'string' ? ` "${data}"` : ` "${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}"`}`);
this._logService.trace(`parsing data (codes)`, () => typeof data === 'string'
? data.split('').map(e => e.charCodeAt(0))
: Array.from(data)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't need Array.from before?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Facts!! You're right.. data is Uint8Array, doing Array.from(data) feels like complete waste.
When we use logService to print, it would look identical, right?
I dont think I ever saw Uint8Array(5) that prepends these characters in the log

);

// resize input buffer if needed
if (this._parseBuffer.length < data.length) {
Expand Down Expand Up @@ -606,7 +605,7 @@ export class InputHandler extends Disposable implements IInputHandler {
// since an empty cell is only set by fullwidth chars
bufferRow.addCodepointToCell(this._activeBuffer.x - offset,
code, chWidth);
for (let delta = chWidth - oldWidth; --delta >= 0; ) {
for (let delta = chWidth - oldWidth; --delta >= 0;) {
bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);
}
continue;
Expand Down Expand Up @@ -1622,7 +1621,7 @@ export class InputHandler extends Disposable implements IInputHandler {
const text = bufferRow.getString(x);
const data = new Uint32Array(text.length * length);
let idata = 0;
for (let itext = 0; itext < text.length; ) {
for (let itext = 0; itext < text.length;) {
const ch = text.codePointAt(itext) || 0;
data[idata++] = ch;
itext += ch > 0xffff ? 2 : 1;
Expand Down
Loading