Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Alt-DEL and fix Ctrl-W behavior #877

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ function setupHterm() {
// move cursor back to beginning of the line
io.print(`\x1b[${window.promptMessage.length + 1}G`);
break;
case String.fromCharCode(23): // Ctrl+W: kill the word behind point
case String.fromCharCode(27) + String.fromCharCode(127): // Alt-delete key from iOS keyboard: kill the word behind point
disableAutocompleteMenu();
deleteBackward();
while (currentCommandCursorPosition > 0) {
Expand All @@ -1276,6 +1276,17 @@ function setupHterm() {
deleteBackward();
}
break;
case String.fromCharCode(23): // Ctrl+W: kill the word behind point, using white space as a word boundary
disableAutocompleteMenu();
deleteBackward();
while (currentCommandCursorPosition > 0) {
const currentChar = io.currentCommand[currentCommandCursorPosition - 1];
if (currentChar === ' ') {
break;
}
deleteBackward();
}
break;
case String.fromCharCode(12): // Ctrl-L: clear screen
disableAutocompleteMenu();
// erase display, move cursor to (1,1)
Expand Down