find scrolls search result into the view port
This commit is contained in:
parent
abe2ee869b
commit
291259a750
1 changed files with 7 additions and 10 deletions
|
|
@ -271,13 +271,9 @@ var Editor = function(renderer, doc) {
|
||||||
var pos = this.renderer.screenToTextCoordinates(pageX, pageY);
|
var pos = this.renderer.screenToTextCoordinates(pageX, pageY);
|
||||||
pos.row = Math.max(0, Math.min(pos.row, this.doc.getLength()-1));
|
pos.row = Math.max(0, Math.min(pos.row, this.doc.getLength()-1));
|
||||||
|
|
||||||
if (e.shiftKey)
|
|
||||||
this.selection.selectToPosition(pos)
|
|
||||||
else {
|
|
||||||
this.moveCursorToPosition(pos);
|
this.moveCursorToPosition(pos);
|
||||||
if (!this.$clickSelection)
|
if (!this.$clickSelection)
|
||||||
this.selection.clearSelection(pos.row, pos.column);
|
this.selection.setSelectionAnchor(pos.row, pos.column);
|
||||||
}
|
|
||||||
|
|
||||||
this.renderer.scrollCursorIntoView();
|
this.renderer.scrollCursorIntoView();
|
||||||
|
|
||||||
|
|
@ -732,9 +728,9 @@ var Editor = function(renderer, doc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.gotoLine = function(lineNumber) {
|
this.gotoLine = function(lineNumber, row) {
|
||||||
this.$blockScrolling = true;
|
this.$blockScrolling = true;
|
||||||
this.moveCursorTo(lineNumber-1, 0);
|
this.moveCursorTo(lineNumber-1, row || 0);
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling = false;
|
||||||
|
|
||||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||||
|
|
@ -905,6 +901,7 @@ var Editor = function(renderer, doc) {
|
||||||
if (range) {
|
if (range) {
|
||||||
this.selection.setSelectionRange(range);
|
this.selection.setSelectionRange(range);
|
||||||
this.$updateDesiredColumn();
|
this.$updateDesiredColumn();
|
||||||
|
this.gotoLine(range.end.row+1, range.end.column);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue