parent
88363fe911
commit
4084931f19
2 changed files with 30 additions and 20 deletions
|
|
@ -316,7 +316,11 @@ var Editor = function(renderer, session) {
|
||||||
this.renderer.updateCursor();
|
this.renderer.updateCursor();
|
||||||
|
|
||||||
if (!this.$blockScrolling) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
var selection = this.getSelection();
|
||||||
|
if (selection.isEmpty())
|
||||||
|
this.renderer.scrollCursorIntoView(selection.getCursor());
|
||||||
|
else
|
||||||
|
this.renderer.scrollSelectionIntoView(selection.getSelectionLead(), selection.getSelectionAnchor());
|
||||||
}
|
}
|
||||||
|
|
||||||
// move text input over the cursor
|
// move text input over the cursor
|
||||||
|
|
|
||||||
|
|
@ -647,12 +647,18 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.$cursorLayer.showCursor();
|
this.$cursorLayer.showCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.scrollCursorIntoView = function() {
|
this.scrollSelectionIntoView = function(anchor, lead) {
|
||||||
|
// first scroll anchor into view then scroll lead into view
|
||||||
|
this.scrollCursorIntoView(anchor);
|
||||||
|
this.scrollCursorIntoView(lead);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.scrollCursorIntoView = function(cursor) {
|
||||||
// the editor is not visible
|
// the editor is not visible
|
||||||
if (this.$size.scrollerHeight === 0)
|
if (this.$size.scrollerHeight === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = this.$cursorLayer.getPixelPosition();
|
var pos = this.$cursorLayer.getPixelPosition(cursor);
|
||||||
|
|
||||||
var left = pos.left;
|
var left = pos.left;
|
||||||
var top = pos.top;
|
var top = pos.top;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue