I'm trying a fairly simple operation with Ace Editor: having the editor jump to a particular line. I can't get it to work, though!
See this jsFiddle: /
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
Any advice?
Thanks.
I'm trying a fairly simple operation with Ace Editor: having the editor jump to a particular line. I can't get it to work, though!
See this jsFiddle: http://jsfiddle/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
Any advice?
Thanks.
Share Improve this question asked May 19, 2014 at 23:28 M MillerM Miller 5,65210 gold badges48 silver badges69 bronze badges1 Answer
Reset to default 15There appears to be a bug in the current version of Ace Editor. If you manually call editor.resize(true)
, it will recalculate the height and the scrolling functions work correctly:
var editor = ace.edit('editor');
editor.resize(true);
editor.scrollToLine(50, true, true, function () {});
editor.gotoLine(50, 10, true);
http://jsfiddle/Xu9Tb/1/