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') {