From aa6c4739dddfd38ff98309c2ea34ac8579fcdaf9 Mon Sep 17 00:00:00 2001 From: Jaakko Vanhala Date: Sun, 5 Apr 2026 09:51:39 +0300 Subject: [PATCH] Shift-TAB poistaa viimeisen sanan kpn-terminaalissa MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Poistaa viimeisen sanan tai lainausmerkeissä olevan kokonaisuuden: - "kpn run coder " → Shift-TAB → "kpn run " - 'kpn run coder "hello world"' → Shift-TAB → "kpn run coder " Co-Authored-By: Claude Opus 4.6 (1M context) --- network-poc/static/index.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/network-poc/static/index.html b/network-poc/static/index.html index 213023a..a5e74c7 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -1983,7 +1983,20 @@ } termInput?.addEventListener('keydown', (e) => { - if (e.key === 'Tab') { + if (e.key === 'Tab' && e.shiftKey) { + // Shift-TAB: poista viimeinen sana (tai lainausmerkkien sisältö) + e.preventDefault(); + const val = termInput.value.trimEnd(); + if (!val) return; + // Jos päättyy lainausmerkkeihin, poista koko lainattu osa + const quoteMatch = val.match(/^(.+\s)".*"?$|^(.+\s)'.*'?$/); + if (quoteMatch) { + termInput.value = (quoteMatch[1] || quoteMatch[2]).trimEnd() + ' '; + } else { + const lastSpace = val.lastIndexOf(' '); + termInput.value = lastSpace > 0 ? val.substring(0, lastSpace + 1) : ''; + } + } else if (e.key === 'Tab') { e.preventDefault(); tabComplete(termInput); } else if (e.key === 'Enter') {