How can I configure arrow key to work as a terminal arrow key #4730
-
I have a created a terminal using xtermjs and it's working fine, I have configured all basic shortcut and configured arrows button to do stuff in xtermjs prompt area but I also want to to make arrow button to work in whole Terminal, mainly while using vite , user are not able to use up/down arrow key to choose from given option. Is there any guide for it? Or Any hint will be appreciated.
And I have used Demo of my TerminalHere's how i write data to terminal, comes from websocket: ws.onmessage = (ev) => {
let data = ev.data;
terminal.write(
typeof data === "string" ? data : new Uint8Array(data)
);
}; :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Didnt we have a similar discussion recently? Seems I cant find it anymore... The answer is still the same - it is almost impossible to marry your browser-local echo/history controller with that of the remote shell. Main issue - on what predicate you gonna decide, whether to route the the arrow key to your history controller or the remote shell? Because there is no reliable way to distinguish that... You still can introduce an artificial distinction, e.g. by prepending all local commands with a token unique to browser commands, e.g. And once again - if you want to avoid the headache to create that, just dump your local echo/history controller, and use the remote shell for all of that. Problem solved. |
Beta Was this translation helpful? Give feedback.
Yes, avoids all of these problems.
The controlling shell on the PTY slave (backend). That shell is remote to your browser, while your self-implemented history controller is browser-local (thus partially mimicks a local shell).