Using the latest version of xterm.js 4.2.0 i want to be able to detect key events and pass them on the terminal , i am not able to detect when ENTER or ALT or SHIFT is pressed like i used to with older version 3.x.x

Why Enter is returning "" ?
What i have done:
term.onKey(key => {
const char = key;
console.log(key);
console.log(char.key === "");
if (char === "") {
console.log("Enter pressed");
prompt();
} else {
term.write(char);
}
});
prompt = () => {
var shellprompt = "$ ";
term.write("\r\n" + shellprompt);
};
I am a new user of the library :)
@jerch @Tyriar @parisk
It's there you'll find it's actually \r:

That is what a terminal emulator would normally send to a shell. If key doesn't have what you're after we also expose the KeyboardEvent directly:
@Tyriar You are amazing you know that :) ?
I ended up using KeyboardEvent => keyboardEvent.domEvent.key
Most helpful comment
It's there you'll find it's actually
\r:That is what a terminal emulator would normally send to a shell. If
keydoesn't have what you're after we also expose theKeyboardEventdirectly:https://github.com/xtermjs/xterm.js/blob/414eea2a2c4cde4c8fb72bb98cd48650bb89c927/typings/xterm.d.ts#L439-L445