[mosh-devel] mosh and IUTF8
Matthew Dempsky
matthew at dempsky.org
Sat Apr 14 06:18:25 EDT 2012
On Fri, Apr 13, 2012 at 5:19 PM, Keith Winstein <keithw at mit.edu> wrote:
> I'm a little less confident that the kernel is "supposed" to send two
> backspaces in this case, since it's not like there is any spec for
> double-wide characters in an ECMA-48 terminal. To the best of my
> knowledge, ECMA-48 does not cover this, except to say that backspace
> moves the cursor "one character position" backwards.
Unicode aware terminal apps like bash send N "\b \b" sequences when
backspacing over an N column character at least, and at least Debian's i18n
manual <http://www.debian.org/doc/manuals/intro-i18n/ch-output.en.html> 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."
> And as for
> deleting combining characters, definitely there is no authority here.
Hm.
> If OpenBSD wants to go a different and more correct direction than
> what OS X and Linux have done, I would say that is totally their
> decision. But I don't understand your proposed solution. Do I
> understand correctly that to make that work, you would have to modify
> (a) every terminal emulator in existence [xterm, gnome-terminal,
> screen, tmux, Terminal.app, PuTTY] as well as (b) every remote login
> protocol [ssh, telnet, rlogin, mosh] to convey this switch to
> canonical mode over the connection to the terminal emulator?
Well, you have to do all of that for IUTF8 support anyway. :)
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.
Also, there's no need for any additional switch; it just depends on
LANG/LC_ALL/whatever getting set correctly on the server.
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.
> I must have misunderstood because that seems totally impossible. If
> you're going to change all the terminal emulators, you might as well
> just declare that the true meaning of backspace IS to move "one
> character position [possible two columns]" to the left and be done
> with it.
The kernel would also need to start emitting literal tab characters rather
than trying to do its own tab expansion.
> Bottom line: Whatever mechanism OpenBSD comes up with, just let us
> know and mosh will be happy to set whatever flag we need on the server
> side.
Great.
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.
I'll discuss with the OpenSSH and tmux devs what they think is reasonable
here, and try to come up with something generically reusable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/mosh-devel/attachments/20120414/4c883f55/attachment.html
More information about the mosh-devel
mailing list