Attempt to fix deno prompt
This commit is contained in:
parent
759450222f
commit
4d54d4bf8a
2
justfile
2
justfile
@ -61,4 +61,4 @@ deno-coverage:
|
|||||||
|
|
||||||
# Run with deno
|
# Run with deno
|
||||||
deno-run file="":
|
deno-run file="":
|
||||||
deno run --allow-all --allow-ffi --deny-net --deny-hrtime --unstable ./src/scroll.ts {{file}}
|
deno run --allow-all --allow-ffi --deny-hrtime --unstable ./src/scroll.ts {{file}}
|
||||||
|
@ -51,6 +51,11 @@ const BunTerminalIO: ITerminal = {
|
|||||||
|
|
||||||
return defaultTerminalSize;
|
return defaultTerminalSize;
|
||||||
},
|
},
|
||||||
|
readStdin: async function (): Promise<string> {
|
||||||
|
const gen = BunTerminalIO.inputLoop();
|
||||||
|
const chunk = await gen.next();
|
||||||
|
return chunk.value!;
|
||||||
|
},
|
||||||
writeStdout: async function write(s: string): Promise<void> {
|
writeStdout: async function write(s: string): Promise<void> {
|
||||||
const buffer = new TextEncoder().encode(s);
|
const buffer = new TextEncoder().encode(s);
|
||||||
|
|
||||||
|
@ -232,8 +232,7 @@ class Editor {
|
|||||||
while (true) {
|
while (true) {
|
||||||
this.setStatusMessage(`${p}${res}`);
|
this.setStatusMessage(`${p}${res}`);
|
||||||
await this.refreshScreen();
|
await this.refreshScreen();
|
||||||
const chunk = await term.inputLoop().next();
|
const char = await term.readStdin();
|
||||||
const char = chunk.value!;
|
|
||||||
// End the prompt
|
// End the prompt
|
||||||
if (char === KeyCommand.Enter) {
|
if (char === KeyCommand.Enter) {
|
||||||
this.setStatusMessage('');
|
this.setStatusMessage('');
|
||||||
|
@ -71,6 +71,8 @@ export interface ITerminal {
|
|||||||
*/
|
*/
|
||||||
getTerminalSize(): Promise<ITerminalSize>;
|
getTerminalSize(): Promise<ITerminalSize>;
|
||||||
|
|
||||||
|
readStdin(): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pipe a string to stdout
|
* Pipe a string to stdout
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
export * as stdAssert from 'https://deno.land/std@0.205.0/assert/mod.ts';
|
export * as stdAssert from 'https://deno.land/std@0.208.0/assert/mod.ts';
|
||||||
|
@ -18,6 +18,11 @@ const DenoTerminalIO: ITerminal = {
|
|||||||
cols: size.columns,
|
cols: size.columns,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
readStdin: async function (): Promise<string> {
|
||||||
|
const gen = DenoTerminalIO.inputLoop();
|
||||||
|
const chunk = await gen.next();
|
||||||
|
return chunk.value!;
|
||||||
|
},
|
||||||
writeStdout: async function write(s: string): Promise<void> {
|
writeStdout: async function write(s: string): Promise<void> {
|
||||||
const buffer: Uint8Array = new TextEncoder().encode(s);
|
const buffer: Uint8Array = new TextEncoder().encode(s);
|
||||||
const stdout: WritableStream<Uint8Array> = Deno.stdout.writable;
|
const stdout: WritableStream<Uint8Array> = Deno.stdout.writable;
|
||||||
|
Loading…
Reference in New Issue
Block a user