You can't paste enter into a Linux terminal
I love my Linux laptop. But, once in a while, it forgets it has a keyboard. I wake it from a little nap and it's all like "no, sir! no keyboards here! just use a mouse please!"
Logging in is pretty simple. Pop_OS has an on-screen keyboard which lets me hunt-n-peck P4ssW0rd123!
into the box.
But then I'm stuck. I can launch apps - but I can't type into them.
The on-screen keyboard only seems to work on certain OS elements. It didn't pop up for the Terminal app.
I could have plugged in a USB keyboard. Or even a Yubikey. But where's the fun in that? Similarly, I could have rebooted and manually changed Bash's behaviour. Or done some weird config which turns a middle click into an enter. Or SSH'd in from another machine. But I like a challenge!
So I opened up my browser, clicked to a news story, and then laboriously copied and pasted the letters l
s
u
s
b
into the terminal. That would show me if my keyboard was stolen by goblins.
But how to run the command? I found a newline on the web page and c&p'd that.
Nothing.
And that's how I learned that most modern terminals don't let you paste in an enter. It becomes a newline to stop you automatically running code you shouldn't. This is the default behaviour on Bash since 5.1.
Anyway, there's a long running bug about this intermittently glitchy keyboard behaviour. In future, I'll just reboot.
user8e8f87c said on berlin.social:
@Edent Is it the #GNOME onscreen keyboard? It is broken for me as well. gnome
Bram Diederik said on mastodon.online:
@Edent cant you connect to your machine from your phone for example and diagnose the problem.
I dont know if you use wayland but there is a tool called xdotool.
Ivan says:
If the keyboard works in the browser, does it also work if you somehow launch Jupyter and start a browser terminal from there? I think it should either live in the start menu or be launchable from start menu → run command.
Hales says:
URXVT started prompting you when you paste something with control characters a few months (?) back:
"y" strips the control characters but "p" works as you actually want.
James says:
This seems to be a terminal emulator specific issue. GNOME Terminal doesn't seem to allow this, but Tilix has an option to enable and disable this.
As a work around it will only strip newlines if they are leading or trailing characters, so if you copy the last letter of your command, a newline, and a subsequent letter it will execute. You may want a text editor handy to compose this sequence.
Hales says:
Oh and whilst I'm here: Ctrl+J is equivalent to LF. Sadly I don't know how you enter that with a broken OSK 😐
More comments on Mastodon.