Thursday, March 24, 2016

Google's hterm: HTML5 terminal emulator

Google's hterm is a nice terminal emulator. I would like to use the hterm part only and do some remote telnet session test (I used libtelnet for the back-end server). But I encountered some usage problems.

First, you could not build a functional hterm script with the github repository, you will need to checkout the full repository from https://chromium.googlesource.com/apps/libapps/ and build from there.

Second, the embedded document is lagging. After following the description in the document, the terminal could be displayed without problem, but there is no input at all. The call back function register to the io.onVTKeystroke() never get called. After digging through other part of the libapps repository for hterm's usage, I found term.installKeyboard() function of the hterm terminal instance need to be called after the term.decorate() call. After that input event could be received.

Third, I haven't found a way to make it acknowledge IME input. Cut and paste utf8 encoded characters causing it to output escaped utf8 stream (utf8 encoded of an utf8 stream).