王牌编辑 - 走线

M M*_*ler 8 javascript ace-editor

我正在尝试使用Ace Editor进行相当简单的操作:让编辑器跳转到特定的行.但是,我不能让它工作!

看到这个jsFiddle:http://jsfiddle.net/Xu9Tb/

var editor = ace.edit('editor');

editor.scrollToLine(50, true, true, function () {});
    // Doesn't do anything at all

editor.gotoLine(50, 10, true);
    // Will move the caret to the line, but it will not scroll
    // to the editor to the line if it's off screen
Run Code Online (Sandbox Code Playgroud)

有什么建议?

谢谢.

M M*_*ler 12

当前版本的Ace Editor似乎存在一个错误.如果您手动调用editor.resize(true),它将重新计算高度,滚动功能正常工作:

var editor = ace.edit('editor');
editor.resize(true);

editor.scrollToLine(50, true, true, function () {});

editor.gotoLine(50, 10, true);
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/Xu9Tb/1/