let the document act as anchor factory
This commit is contained in:
parent
3b0e49539b
commit
8e3c1e6096
2 changed files with 7 additions and 3 deletions
|
|
@ -40,6 +40,7 @@ define(function(require, exports, module) {
|
|||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var Range = require("ace/range").Range;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
|
||||
var Document = function(text) {
|
||||
this.$lines = [];
|
||||
|
|
@ -69,6 +70,10 @@ var Document = function(text) {
|
|||
this.getValue = function() {
|
||||
return this.getAllLines().join(this.getNewLineCharacter());
|
||||
};
|
||||
|
||||
this.createAnchor = function(row, column) {
|
||||
return new Anchor(this, row, column);
|
||||
};
|
||||
|
||||
// check for IE split bug
|
||||
if ("aaa".split(/a/).length == 0)
|
||||
|
|
|
|||
|
|
@ -42,15 +42,14 @@ var oop = require("pilot/oop");
|
|||
var lang = require("pilot/lang");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var Range = require("ace/range").Range;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
|
||||
var Selection = function(session) {
|
||||
this.session = session;
|
||||
this.doc = session.getDocument();
|
||||
|
||||
this.clearSelection();
|
||||
this.selectionLead = new Anchor(this.doc, 0, 0);
|
||||
this.selectionAnchor = new Anchor(this.doc, 0, 0);
|
||||
this.selectionLead = this.doc.createAnchor(0, 0);
|
||||
this.selectionAnchor = this.doc.createAnchor(0, 0);
|
||||
|
||||
var _self = this;
|
||||
this.selectionLead.on("change", function(e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue