On Fri, Apr 13, 2012 at 5:19 PM, Keith Winstein <<a href="mailto:keithw@mit.edu">keithw@mit.edu</a>> wrote:<br>> I'm a little less confident that the kernel is "supposed" to send two<br>> backspaces in this case, since it's not like there is any spec for<br>
> double-wide characters in an ECMA-48 terminal. To the best of my<br>> knowledge, ECMA-48 does not cover this, except to say that backspace<br>> moves the cursor "one character position" backwards.<br>
<br>Unicode aware terminal apps like bash send N "\b \b" sequences when backspacing over an N column character at least, and at least <a href="http://www.debian.org/doc/manuals/intro-i18n/ch-output.en.html">Debian's i18n manual</a> on this topic says"Note that control codes such as 'backspace' (0x08) and so on are column-oriented everytime. It backs 'one' column even if the character at the position is a doublewidth character." <br>
<br>> And as for<br>> deleting combining characters, definitely there is no authority here.<br><br>Hm.<br><br>> If OpenBSD wants to go a different and more correct direction than<br>> what OS X and Linux have done, I would say that is totally their<br>
> decision. But I don't understand your proposed solution. Do I<br>> understand correctly that to make that work, you would have to modify<br>> (a) every terminal emulator in existence [xterm, gnome-terminal,<br>
> screen, tmux, Terminal.app, PuTTY] as well as (b) every remote login<br>> protocol [ssh, telnet, rlogin, mosh] to convey this switch to<br>> canonical mode over the connection to the terminal emulator?<br><br>Well, you have to do all of that for IUTF8 support anyway. :)<br>
<br>But I'm suggesting a program similar to rlwrap that can correctly handle as the child process changes its terminal modes around. The code could alternatively be integrated into the app that manages the pty if you want to avoid the overhead of an extra process.<br>
<br>Also, there's no need for any additional switch; it just depends on LANG/LC_ALL/whatever getting set correctly on the server.<div><br></div><div>With OpenSSH currently, this requires setting "SendEnv LANG LC_*" on the client and "AcceptEnv LANG LC_*" or the server. I just emailed the OpenSSH guys to ask if we can add this to the default config.<br>
<br>> I must have misunderstood because that seems totally impossible. If<br>> you're going to change all the terminal emulators, you might as well<br>> just declare that the true meaning of backspace IS to move "one<br>
> character position [possible two columns]" to the left and be done<br>> with it.<br><br>The kernel would also need to start emitting literal tab characters rather than trying to do its own tab expansion.<br><br>
> Bottom line: Whatever mechanism OpenBSD comes up with, just let us<br>> know and mosh will be happy to set whatever flag we need on the server<br>> side.<br><br>Great.<br><br>I think it would be as simple as exec'ing "ucanon sh" instead of just "sh" (assuming ucanon is the name of the userspace canonicalization wrapper). Alternatively, I can envision a rather simple ucanon_read()/ucanon_write() API that you'd just need to use instead of read()/write() for working with the pty.</div>
<div><br></div><div>I'll discuss with the OpenSSH and tmux devs what they think is reasonable here, and try to come up with something generically reusable.</div>