Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #393 from adobe/nj/issue339
Browse files Browse the repository at this point in the history
Fix issue #339 (Height of inline editor is sometimes too short) -- ensure the inline editor has been refreshed at least once before measuring its height
  • Loading branch information
peterflynn committed Mar 3, 2012
2 parents 091bcbb + cbbc6d7 commit e35d7e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/EditorManager.js
Expand Up @@ -344,20 +344,30 @@ define(function (require, exports, module) {

// Hide all lines other than those we want to show. We do this rather than trimming the
// text itself so that the editor still shows accurate line numbers.
var hidLines = false;
if (range) {
inlineEditor.operation(function () {
var i;
for (i = 0; i < range.startLine; i++) {
hidLines = true;
inlineEditor.hideLine(i);
}
var lineCount = inlineEditor.lineCount();
for (i = range.endLine + 1; i < lineCount; i++) {
hidLines = true;
inlineEditor.hideLine(i);
}
});
inlineEditor.setCursor(range.startLine, 0);
}

// If we haven't hidden any lines (which would have caused an update already),
// force the editor to update its display so we measure the correct height below
// in totalHeight().
if (!hidLines) {
inlineEditor.refresh();
}

// Auto-size editor to its remaining content
var widgetHeight = inlineEditor.totalHeight(true);

Expand Down
2 changes: 1 addition & 1 deletion src/thirdparty/CodeMirror2

0 comments on commit e35d7e0

Please sign in to comment.