2

I successfully installed the terminal on a test page and want to highlight parentheses that match, something like this:
http://profgra.org/lycee/calcul.html
So I already have a working solution that I now need to hook to the terminal.
My first idea was to see if I could grab the term content, using the keypress option:

keypress: function(e) {
   console.log(term.html());
}

But the content always lacks the last letter typed. Any idea to fix this? Or any other direction to try?

Thanks reading.

4

1 回答 1

0

keypress 首先执行用户功能然后插入文本,所以你可以尝试延迟操作:

keypress: function(e, term) {
    setTimeout(function() {
        console.log(term.html());
    }, 10);
}

除了 setTimeout 之外,您还可以使用终端文件中包含的jQuery 计时器。

于 2014-05-24T04:18:52.383 回答