Skip to content

Commit

Permalink
fix: don't use deprecated Deno.write* API's
Browse files Browse the repository at this point in the history
  • Loading branch information
Im-Beast committed Jan 29, 2024
1 parent b773573 commit 1468491
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ export function handleKeyboardControls(tui: Tui): void {
* Enable handling of controlling Tui using mouse
*/
export function handleMouseControls(tui: Tui): void {
const { rid } = tui.stdout;
Deno.writeSync(rid, textEncoder.encode(ENABLE_MOUSE));
const { stdout } = tui;
stdout.writeSync(textEncoder.encode(ENABLE_MOUSE));
tui.on("destroy", () => {
Deno.writeSync(rid, textEncoder.encode(DISABLE_MOUSE));
stdout.writeSync(textEncoder.encode(DISABLE_MOUSE));
});

tui.on("mousePress", ({ x, y, drag, shift, meta, ctrl, release }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/tui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class Tui extends EventEmitter<
box.draw();
}

Deno.writeSync(stdout.rid, textEncoder.encode(USE_SECONDARY_BUFFER + HIDE_CURSOR));
stdout.write(textEncoder.encode(USE_SECONDARY_BUFFER + HIDE_CURSOR));

const updateStep = () => {
canvas.render();
Expand All @@ -141,7 +141,7 @@ export class Tui extends EventEmitter<
this.stdin.setRaw(false);
} catch { /**/ }

Deno.writeSync(this.stdout.rid, textEncoder.encode(USE_PRIMARY_BUFFER + SHOW_CURSOR));
this.stdout.write(textEncoder.encode(USE_PRIMARY_BUFFER + SHOW_CURSOR));

for (const component of this.components) {
component.destroy();
Expand Down

0 comments on commit 1468491

Please sign in to comment.