Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/view/PanelManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,28 @@ define(function (require, exports, module) {
$panel.on("panelCollapsed panelExpanded panelResizeUpdate", function () {
triggerEditorResize();
});

$panel.on("panelExpanded", function () {
var _currentEditor = EditorManager.getCurrentFullEditor();

// Make sure that we're not switching files
// and still on an active editor
if (_currentEditor) {

// Gather info to determine whether to scroll after editor resizes
var height = _currentEditor._codeMirror.getScrollInfo().clientHeight,
textHeight = _currentEditor.getTextHeight(),
cursorTop = _currentEditor._codeMirror.cursorCoords().top,
bottom = cursorTop - $("#editor-holder").offset().top + textHeight - height;

// Determine whether panel would block text at cursor
// If so, scroll the editor to expose the cursor above
// the panel
if (bottom <= $panel.height() && bottom >= 5) {
_currentEditor._codeMirror.scrollIntoView();
}
}
});
}


Expand Down