Shift-TAB poistaa viimeisen sanan kpn-terminaalissa
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user