Improve display of save as

This commit is contained in:
Timothy Warren 2023-11-30 11:15:37 -05:00
parent 02be6a133c
commit 1b748ed63e
2 changed files with 9 additions and 3 deletions

View File

@ -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,

View File

@ -97,8 +97,9 @@ class Editor {
public async save(): Promise<void> {
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);