revert changes to worker
This commit is contained in:
parent
5c1db2dbcc
commit
dc198344d5
7 changed files with 186 additions and 196 deletions
|
|
@ -46,7 +46,6 @@ var Search = require("./search").Search;
|
|||
var Range = require("./range").Range;
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var CommandManager = require("./commands/command_manager").CommandManager;
|
||||
var Autocomplete = require("./autocomplete").Autocomplete;
|
||||
var defaultCommands = require("./commands/default_commands").commands;
|
||||
var config = require("./config");
|
||||
|
||||
|
|
@ -90,7 +89,6 @@ var Editor = function(renderer, session) {
|
|||
});
|
||||
|
||||
this.setSession(session || new EditSession(""));
|
||||
Autocomplete.addTo(this);
|
||||
config.resetOptions(this);
|
||||
config._emit("editor", this);
|
||||
};
|
||||
|
|
@ -1468,7 +1466,7 @@ var Editor = function(renderer, session) {
|
|||
if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
|
||||
var range = selection.toOrientedRange();
|
||||
var rows = this.$getSelectedRows(range);
|
||||
var linesMoved = mover.call(this, rows.first, rows.last);
|
||||
var linesMoved = mover.call(this, rows.first, rows.last);
|
||||
range.moveBy(linesMoved, 0);
|
||||
selection.fromOrientedRange(range);
|
||||
} else {
|
||||
|
|
@ -1486,14 +1484,14 @@ var Editor = function(renderer, session) {
|
|||
first = rows.end.row;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
||||
var linesMoved = mover.call(this, first, last);
|
||||
while (rangeIndex >= i) {
|
||||
ranges[rangeIndex].moveBy(linesMoved, 0);
|
||||
rangeIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
selection.fromOrientedRange(selection.ranges[0]);
|
||||
selection.rangeList.attach(this.session);
|
||||
|
|
|
|||
|
|
@ -1,58 +1,58 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new GolangHighlightRules();
|
||||
var Mode = function() {
|
||||
var highlighter = new GolangHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.foldingRules = new CStyleFoldMode();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
(function() {
|
||||
|
||||
this.lineCommentStart = "//";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
}
|
||||
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
}
|
||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||
var tokens = tokenizedLine.tokens;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||
return indent;
|
||||
};//end getNextLineIndent
|
||||
}
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
if (state == "start") {
|
||||
var match = line.match(/^.*[\{\(\[]\s*$/);
|
||||
if (match) {
|
||||
indent += tab;
|
||||
}
|
||||
}
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
return indent;
|
||||
};//end getNextLineIndent
|
||||
|
||||
}).call(Mode.prototype);
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
exports.Mode = Mode;
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,33 +30,33 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("../mode/text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("../mode/text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new PgsqlHighlightRules();
|
||||
var Mode = function() {
|
||||
var highlighter = new PgsqlHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$keywordList = highlighter.$keywordList;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
(function() {
|
||||
this.lineCommentStart = "--";
|
||||
this.blockComment = {start: "/*", end: "*/"};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
if (state == "start" || state == "keyword.statementEnd") {
|
||||
return "";
|
||||
} else {
|
||||
return this.$getIndent(line); // Keep whatever indent the previous line has
|
||||
}
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
if (state == "start" || state == "keyword.statementEnd") {
|
||||
return "";
|
||||
} else {
|
||||
return this.$getIndent(line); // Keep whatever indent the previous line has
|
||||
}
|
||||
}
|
||||
|
||||
}).call(Mode.prototype);
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,34 +7,26 @@ var lang = require("../lib/lang");
|
|||
var Mirror = exports.Mirror = function(sender) {
|
||||
this.sender = sender;
|
||||
var doc = this.doc = new Document("");
|
||||
this.data = {};
|
||||
|
||||
var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
|
||||
|
||||
var _self = this;
|
||||
sender.on("change", function(e) {
|
||||
doc.applyDeltas(e.data);
|
||||
if (_self.$defer)
|
||||
deferredUpdate.schedule(_self.$timeout);
|
||||
deferredUpdate.schedule(_self.$timeout);
|
||||
});
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.$timeout = 500;
|
||||
this.$defer = true;
|
||||
|
||||
this.setTimeout = function(timeout) {
|
||||
this.$timeout = timeout;
|
||||
};
|
||||
|
||||
this.setDeferredUpdate = function(defer) {
|
||||
this.$defer = defer;
|
||||
};
|
||||
|
||||
this.setValue = function(value, data) {
|
||||
this.setValue = function(value) {
|
||||
this.doc.setValue(value);
|
||||
this.data = data;
|
||||
this.deferredUpdate.schedule(this.$timeout);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -144,12 +144,12 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) {
|
|||
catch(ex) {}
|
||||
};
|
||||
|
||||
this.attachToDocument = function(doc, data, ignore) {
|
||||
if (this.$doc && !ignore)
|
||||
this.attachToDocument = function(doc) {
|
||||
if(this.$doc)
|
||||
this.terminate();
|
||||
|
||||
this.$doc = doc;
|
||||
this.call("setValue", [doc.getValue(), data]);
|
||||
this.call("setValue", [doc.getValue()]);
|
||||
doc.on("change", this.changeListener);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue