Improve workspace navigation, search, and tab actions

This commit is contained in:
Knotty Wyvern
2026-09-29 07:48:24 -07:00
parent bdc15e952d
commit 43106ed9c7
34 changed files with 1798 additions and 100 deletions
+20 -1
View File
@@ -71,7 +71,7 @@ export class Documents {
}
if (!this.disposed && request === this.selection) {
// Replace only after a successful read, and never discard edits or disk conflicts.
if (!alreadyOpen && previous && previous.contents === previous.saved
if (!alreadyOpen && previous && !previous.pinned && previous.contents === previous.saved
&& previous.diskContents === undefined && !previous.diskError) {
const index = this.buffers.indexOf(previous);
const opened = this.buffers.find(b => b.relPath === entry.rel_path);
@@ -102,6 +102,25 @@ export class Documents {
this.emit();
}
togglePin(path: string) {
if (this.disposed) return;
const buffer = this.buffers.find(b => b.relPath === path);
if (!buffer) return;
buffer.pinned = !buffer.pinned;
this.emit();
}
move(path: string, to: number) {
if (this.disposed || !Number.isInteger(to)) return;
const from = this.buffers.findIndex(b => b.relPath === path);
if (from < 0) return;
const index = Math.max(0, Math.min(to, this.buffers.length - 1));
if (from === index) return;
const [buffer] = this.buffers.splice(from, 1);
this.buffers.splice(index, 0, buffer);
this.emit();
}
rename(from: string, to: string) {
for (const b of this.buffers) {
if (b.kind === "empty") continue;