From 55aac466308dcdd014498198f2c6d47478d4b2b9 Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Thu, 13 Nov 2025 23:59:38 +0100 Subject: [PATCH] Add keyboard shortcuts for resizing editors --- src/app/editor.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/editor.ts b/src/app/editor.ts index a3610d5..73cba68 100644 --- a/src/app/editor.ts +++ b/src/app/editor.ts @@ -84,6 +84,8 @@ export class Editor { return true; }, }, + { key: "Alt--", run: () => this.changeWidth(-100) }, + { key: "Alt-=", run: () => this.changeWidth(100) }, ]); this.view = new EditorView({ doc: file.rootState.val.doc, @@ -128,6 +130,12 @@ export class Editor { this.view.focus(); } + changeWidth(increment: number) { + const w = parseInt(window.getComputedStyle(this.view.dom).width, 10); + this.view.dom.style.width = (w + increment) + 'px'; + return true; + } + close() { if (this.deleteFn) { this.file.removeEditor(this, this.deleteFn);