Skip to content

Commit

Permalink
Support home and end keys in WebSocket Terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Dec 11, 2023
1 parent e99f9de commit dc1db25
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commands/webSocketTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const keys = {
ctrlE: "\x05",
ctrlH: "\x08",
del: "\x1b[3~",
home: "\x1b\x5b\x48",
end: "\x1b\x5b\x46",
};

const actions = {
Expand Down Expand Up @@ -484,6 +486,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
this._state = "eval";
return;
}
case keys.home:
case keys.ctrlA: {
if (this._state == "prompt" && this._cursorCol - this._margin > 0) {
// Move the cursor to the beginning of the line
Expand All @@ -492,6 +495,7 @@ class WebSocketTerminal implements vscode.Pseudoterminal {
}
return;
}
case keys.end:
case keys.ctrlE: {
if (this._state == "prompt") {
// Move the cursor to the end of the line
Expand Down

0 comments on commit dc1db25

Please sign in to comment.