migueldeicaza / SwiftTermApp

MIT License
305 stars 29 forks source link

Enter/return key sends ^j instead of ^m (line feed instead of carriage return) #207

Closed EmiliaBlasten closed 1 year ago

EmiliaBlasten commented 1 year ago

Connecting to an Ubuntu server and using nano, emacs, etc. is difficult because the app sends ^j instead of ^m. For example to write

hello
world

in nano, I cannot type

hello[enter-key on the keyboard]world

but have to type

hello^mworld

Is there a setting which allows modifying these? I do not have this issue when using the ssh command in apps like ish or a-Shell.

migueldeicaza commented 1 year ago

Likely your terminal settings are wrong. Check stty -a

EmiliaBlasten commented 1 year ago

stty -a gives

speed 38400 baud; rows 41; columns 62; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal
-crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr
icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0
tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase
-tostop -echoprt echoctl echoke -flusho -extproc

I am using the default terminal settings on Ubuntu server. I'm runing SwiftTermApp on iOS 16.4.1 on an iPhone Xs Max with the default keyboard. If I connect to the same server with:

then each time the enter key sends ^m instead of ^j on the server. Only SwiftTermApp sends ^j. Does SwiftTermApp read the remote terminal settings and change its behaviour based on that, or could it be that all the other apps and machines read the remote terminal settings and send ^m despite them? I think it is more likely that the app has a bug on my phone (installed from the App Store, non-jailbroken phone).

To further test this, please see if you can create carriage returns (newlines in nano) by joining a similar environment: I joined a free NetBSD ssh server on sdf.org (login as user: new, password: new at sdf@org and answer briefly the questionnaire to set up an account instantly). Nano has the same behaviour: typing edit tttt.txt behaves as I described above from SwiftTermApp on the iphone, but behaves correctly from other ssh clients mentioned above. Do you get the correct behaviour on sdf.org?