fix centerSelection for wrapped documents
This commit is contained in:
parent
a82c1c52d8
commit
67b1c62c03
1 changed files with 5 additions and 2 deletions
|
|
@ -1678,8 +1678,11 @@ var Editor = function(renderer, session) {
|
||||||
**/
|
**/
|
||||||
this.centerSelection = function() {
|
this.centerSelection = function() {
|
||||||
var range = this.getSelectionRange();
|
var range = this.getSelectionRange();
|
||||||
var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
|
var pos = {
|
||||||
this.renderer.scrollToLine(line, true);
|
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
|
||||||
|
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
|
||||||
|
}
|
||||||
|
this.renderer.alignCursor(pos, 0.5);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** related to: Selection.getCursor
|
/** related to: Selection.getCursor
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue