diff --git a/src/common/document.ts b/src/common/document.ts index 26c9929..9024e64 100644 --- a/src/common/document.ts +++ b/src/common/document.ts @@ -84,7 +84,7 @@ export class Document { } const row = this.row(at.y)!; - const mergeNextRow = at.x === row.size && at.y < len - 1; + const mergeNextRow = at.x === row.size && at.y + 1 < len; const mergeIntoPrevRow = at.x === 0 && at.y > 0; // If we are at the end of a line, and press delete, diff --git a/src/common/editor.ts b/src/common/editor.ts index d5bdbb1..1a2c8a3 100644 --- a/src/common/editor.ts +++ b/src/common/editor.ts @@ -97,8 +97,9 @@ class Editor { public async save(): Promise { if (this.#filename === '') { - const filename = await this.prompt('Save as: '); + const filename = await this.prompt('Save as: %s (ESC to cancel)'); if (filename === null) { + this.setStatusMessage('Save aborted'); return; } @@ -232,7 +233,12 @@ class Editor { let res = ''; outer: while (true) { - this.setStatusMessage(`${p}${res}`); + if (p.includes('%s')) { + this.setStatusMessage(p.replace('%s', res)); + } else { + this.setStatusMessage(`${p}${res}`); + } + await this.refreshScreen(); for await (const chunk of term.inputLoop()) { const char = readKey(chunk);