1

我已经构建了一个基于 Xtermjs 和 Websocket 的 web shh 工具。一切看起来都很好,除了在 vi 中重叠的字符,如下所示:

在此处输入图像描述

我打开终端的 xterm 代码:

function openTerminal() {
    var client = new WSSHClient();
    var term = new Terminal({cols: 70, rows: 30, screenKeys: true, useStyle: true});
    term.on('data', function (data) {
        client.sendClientData(data);
    });
    term.open();
    $('.terminal').detach().appendTo('#term');
    $("#term").show();
    term.write('Connecting...\r\n');
    client.connect({
        onError: function (error) {
            term.write('Error: ' + error + '\r\n');
            console.debug('error happened');
        },
        onConnect: function () {
            console.debug('connection established');
        },
        onClose: function () {
            term.write("\rconnection closed")
            console.debug('connection reset by peer');
            $('term').hide()
        },
        onData: function (data) {
            term.write(data);
            console.debug('get data:' + data);
        }
    })
}
4

0 回答 0