@crouton-kit/humanloop 0.3.15 → 0.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tui/input.js +9 -0
- package/dist/tui/terminal.js +6 -1
- package/package.json +1 -1
package/dist/tui/input.js
CHANGED
|
@@ -326,6 +326,15 @@ function handleInputMode(input, key, state, render) {
|
|
|
326
326
|
render();
|
|
327
327
|
return;
|
|
328
328
|
}
|
|
329
|
+
// Ctrl-U: delete to the start of the line (readline "unix-line-discard").
|
|
330
|
+
// iTerm2 maps Cmd+Backspace to a bare 0x15, which arrives here as ctrl+'u'.
|
|
331
|
+
// The buffer is end-anchored (no mid-string cursor), so "to line start" is
|
|
332
|
+
// the entire buffer.
|
|
333
|
+
if (key.ctrl && input === 'u') {
|
|
334
|
+
mode.buffer = '';
|
|
335
|
+
render();
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
329
338
|
if (key.backspace) {
|
|
330
339
|
const chars = [...mode.buffer];
|
|
331
340
|
chars.pop();
|
package/dist/tui/terminal.js
CHANGED
|
@@ -27,7 +27,12 @@ export function parseKeypress(data) {
|
|
|
27
27
|
}
|
|
28
28
|
// Alt+Backspace: terminals send ESC followed by DEL/BS. Must precede the
|
|
29
29
|
// bare-ESC check so the two-byte sequence isn't swallowed as plain escape.
|
|
30
|
-
|
|
30
|
+
// iTerm2 (and many readline configs) instead map Option/Alt+Backspace to a
|
|
31
|
+
// bare Ctrl-W (0x17, the "word-erase" byte) with no ESC prefix — fold it into
|
|
32
|
+
// the same meta+backspace key so the word-delete path fires either way. This
|
|
33
|
+
// must also precede the generic Ctrl-<letter> branch below, which would
|
|
34
|
+
// otherwise turn 0x17 into a literal 'w' in the buffer.
|
|
35
|
+
if (str === '\x1b\x7f' || str === '\x1b\b' || str === '\x17') {
|
|
31
36
|
key.meta = true;
|
|
32
37
|
key.backspace = true;
|
|
33
38
|
return { input: '', key };
|