On Fri, Apr 13, 2012 at 5:19 PM, Keith Winstein &lt;<a href="mailto:keithw@mit.edu">keithw@mit.edu</a>&gt; wrote:<br>&gt; I&#39;m a little less confident that the kernel is &quot;supposed&quot; to send two<br>&gt; backspaces in this case, since it&#39;s not like there is any spec for<br>
&gt; double-wide characters in an ECMA-48 terminal. To the best of my<br>&gt; knowledge, ECMA-48 does not cover this, except to say that backspace<br>&gt; moves the cursor &quot;one character position&quot; backwards.<br>
<br>Unicode aware terminal apps like bash send N &quot;\b \b&quot; 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&#39;s i18n manual</a> on this topic says&quot;Note that control codes such as &#39;backspace&#39; (0x08) and so on are column-oriented everytime. It backs &#39;one&#39; column even if the character at the position is a doublewidth character.&quot; <br>
<br>&gt; And as for<br>&gt; deleting combining characters, definitely there is no authority here.<br><br>Hm.<br><br>&gt; If OpenBSD wants to go a different and more correct direction than<br>&gt; what OS X and Linux have done, I would say that is totally their<br>
&gt; decision. But I don&#39;t understand your proposed solution. Do I<br>&gt; understand correctly that to make that work, you would have to modify<br>&gt; (a) every terminal emulator in existence [xterm, gnome-terminal,<br>
&gt; screen, tmux, Terminal.app, PuTTY] as well as (b) every remote login<br>&gt; protocol [ssh, telnet, rlogin, mosh] to convey this switch to<br>&gt; 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&#39;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&#39;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 &quot;SendEnv LANG LC_*&quot; on the client and &quot;AcceptEnv LANG LC_*&quot; or the server.  I just emailed the OpenSSH guys to ask if we can add this to the default config.<br>
<br>&gt; I must have misunderstood because that seems totally impossible. If<br>&gt; you&#39;re going to change all the terminal emulators, you might as well<br>&gt; just declare that the true meaning of backspace IS to move &quot;one<br>
&gt; character position [possible two columns]&quot; to the left and be done<br>&gt; 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>
&gt; Bottom line: Whatever mechanism OpenBSD comes up with, just let us<br>&gt; know and mosh will be happy to set whatever flag we need on the server<br>&gt; side.<br><br>Great.<br><br>I think it would be as simple as exec&#39;ing &quot;ucanon sh&quot; instead of just &quot;sh&quot; (assuming ucanon is the name of the userspace canonicalization wrapper).  Alternatively, I can envision a rather simple ucanon_read()/ucanon_write() API that you&#39;d just need to use instead of read()/write() for working with the pty.</div>
<div><br></div><div>I&#39;ll discuss with the OpenSSH and tmux devs what they think is reasonable here, and try to come up with something generically reusable.</div>