call scroll output

This commit is contained in:
Anthony Kim
2026-07-17 11:36:15 -07:00
parent 4d93815c36
commit abce6f1c62
+11 -11
View File
@@ -12,7 +12,7 @@ export class WebglWindow extends BaseWindow implements IControlWindow {
private _textureAtlasContainer!: HTMLElement;
private _stressRunning = false;
private _stressScrolling: HTMLInputElement | undefined;
private _scrollOutput: HTMLInputElement | undefined;
public build(container: HTMLElement): void {
const stressButtons = document.createElement('div');
@@ -30,14 +30,14 @@ export class WebglWindow extends BaseWindow implements IControlWindow {
container.appendChild(stressButtons);
const stressOptions = document.createElement('div');
this._stressScrolling = document.createElement('input');
this._stressScrolling.type = 'checkbox';
this._stressScrolling.id = 'stress-scrolling';
stressOptions.appendChild(this._stressScrolling);
const stressScrollingLabel = document.createElement('label');
stressScrollingLabel.htmlFor = 'stress-scrolling';
stressScrollingLabel.textContent = 'stress scrolling';
stressOptions.appendChild(stressScrollingLabel);
this._scrollOutput = document.createElement('input');
this._scrollOutput.type = 'checkbox';
this._scrollOutput.id = 'scroll-output';
stressOptions.appendChild(this._scrollOutput);
const scrollOutputLabel = document.createElement('label');
scrollOutputLabel.htmlFor = 'scroll-output';
scrollOutputLabel.textContent = 'Scroll output';
stressOptions.appendChild(scrollOutputLabel);
container.appendChild(stressOptions);
const zoomCheckbox = document.createElement('input');
@@ -82,7 +82,7 @@ export class WebglWindow extends BaseWindow implements IControlWindow {
return;
}
this._stressRunning = true;
const scrolling = !!(this._stressScrolling?.checked);
const scrollOutput = !!(this._scrollOutput?.checked);
for (let r = 0; r < 256; r += 2) {
for (let g = 0; g < 256; g += 2) {
let s: string[] = [];
@@ -93,7 +93,7 @@ export class WebglWindow extends BaseWindow implements IControlWindow {
const rbg = `RGB: ${[r, g, b]}`;
s.push(`\r\x1b[38;2;${r};${g};${b}m${rbg.padEnd(18, ' ')}${TEXT}`);
if (s.length >= 16) {
if (scrolling) {
if (scrollOutput) {
await new Promise<void>(r => this._terminal.write(s.join('\r\n') + '\r\n', r));
} else {
await new Promise<void>(r => this._terminal.write('\x1b[H' + s.join('\r\n'), r));