Cursor column is now updated if clicking the area below the text
This commit is contained in:
parent
36a7b98766
commit
b0f9097d3b
2 changed files with 8 additions and 5 deletions
|
|
@ -242,11 +242,13 @@ ace.Editor = function(renderer, doc) {
|
|||
var pageY = ace.getDocumentY(e);
|
||||
|
||||
var pos = this.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
pos.row = Math.max(0, Math.min(pos.row, this.doc.getLength()-1));
|
||||
|
||||
this.moveCursorToPosition(pos);
|
||||
this.selection.setSelectionAnchor(pos.row, pos.column);
|
||||
this.renderer.scrollCursorIntoView();
|
||||
|
||||
var _self = this;
|
||||
var self = this;
|
||||
var mousePageX, mousePageY;
|
||||
|
||||
var onMouseSelection = function(e) {
|
||||
|
|
@ -262,10 +264,11 @@ ace.Editor = function(renderer, doc) {
|
|||
if (mousePageX === undefined || mousePageY === undefined)
|
||||
return;
|
||||
|
||||
selectionLead = _self.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
selectionLead = self.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
selectionLead.row = Math.max(0, Math.min(selectionLead.row, self.doc.getLength()-1));
|
||||
|
||||
_self.selection.selectToPosition(selectionLead);
|
||||
_self.renderer.scrollCursorIntoView();
|
||||
self.selection.selectToPosition(selectionLead);
|
||||
self.renderer.scrollCursorIntoView();
|
||||
};
|
||||
|
||||
ace.capture(this.container, onMouseSelection, onMouseSelectionEnd);
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ ace.VirtualRenderer = function(container) {
|
|||
|
||||
return {
|
||||
row : row,
|
||||
column : this.$screenToDocumentColumn(row, col)
|
||||
column : this.$screenToDocumentColumn(Math.max(0, Math.min(row, this.doc.getLength()-1)), col)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue