Merge pull request #1430 from ajaxorg/misc

several small bugs
This commit is contained in:
Ruben Daniels 2013-05-15 09:33:22 -07:00
commit 62a3954b22
8 changed files with 31 additions and 18 deletions

View file

@ -62,8 +62,8 @@ var _define = function(module, deps, payload) {
payload = deps; payload = deps;
if (!_define.modules) { if (!_define.modules) {
_define.modules = Object.create(null); _define.modules = {};
_define.payloads = Object.create(null); _define.payloads = {};
} }
_define.payloads[module] = payload; _define.payloads[module] = payload;

View file

@ -108,7 +108,7 @@ exports.edit = function(el) {
* *
**/ **/
exports.createEditSession = function(text, mode) { exports.createEditSession = function(text, mode) {
var doc = new EditSession(text, doc); var doc = new EditSession(text, mode);
doc.setUndoManager(new UndoManager()); doc.setUndoManager(new UndoManager());
return doc; return doc;
} }

View file

@ -190,12 +190,18 @@ var optionsProvider = {
this.setOption(key, optList[key]); this.setOption(key, optList[key]);
}, this); }, this);
}, },
getOptions: function(a) { getOptions: function(optionNames) {
var b = {}; var result = {};
Object.keys(a).forEach(function(key) { if (!optionNames) {
b[key] = this.getOption(key); optionNames = Object.keys(this.$options);
} else if (!Array.isArray(optionNames)) {
result = optionNames;
optionNames = Object.keys(result);
}
optionNames.forEach(function(key) {
result[key] = this.getOption(key);
}, this); }, this);
return b; return result;
}, },
setOption: function(name, value) { setOption: function(name, value) {
if (this["$" + name] === value) if (this["$" + name] === value)

View file

@ -295,11 +295,12 @@
border-radius: 3px; border-radius: 3px;
border: 1px solid transparent; border: 1px solid transparent;
cursor: pointer;
}
.ace_folding-enabled .ace_fold-widget {
display: inline-block;
} }
.ace_folding-enabled .ace_fold-widget {
display: inline-block;
}
.ace_fold-widget.ace_end { .ace_fold-widget.ace_end {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82"); background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");

View file

@ -1799,6 +1799,8 @@ var Editor = function(renderer, session) {
this.session.unfold({row: lineNumber - 1, column: column || 0}); this.session.unfold({row: lineNumber - 1, column: column || 0});
this.$blockScrolling += 1; this.$blockScrolling += 1;
// todo: find a way to automatically exit multiselect mode
this.exitMultiSelectMode && this.exitMultiSelectMode()
this.moveCursorTo(lineNumber - 1, column || 0); this.moveCursorTo(lineNumber - 1, column || 0);
this.$blockScrolling -= 1; this.$blockScrolling -= 1;

View file

@ -90,7 +90,7 @@ var supportedModes = {
Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"], Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
Markdown: ["md|markdown"], Markdown: ["md|markdown"],
MUSHCode: ["mc|mush"], MUSHCode: ["mc|mush"],
ObjectiveC: ["m"], ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"], OCaml: ["ml|mli"],
Pascal: ["pas|p"], Pascal: ["pas|p"],
Perl: ["pl|pm"], Perl: ["pl|pm"],

View file

@ -499,9 +499,13 @@ var Editor = require("./editor").Editor;
this.inVirtualSelectionMode = false; this.inVirtualSelectionMode = false;
selection._eventRegistry = reg; selection._eventRegistry = reg;
selection.mergeOverlappingRanges(); selection.mergeOverlappingRanges();
var anim = this.renderer.$scrollAnimation;
this.onCursorChange(); this.onCursorChange();
this.onSelectionChange(); this.onSelectionChange();
if (anim && anim.from == anim.to)
this.renderer.animateScrolling(anim.from);
return result; return result;
}; };

View file

@ -105,7 +105,7 @@ var VirtualRenderer = function(container, theme) {
this.scrollBar = new ScrollBar(this.container); this.scrollBar = new ScrollBar(this.container);
this.scrollBar.addEventListener("scroll", function(e) { this.scrollBar.addEventListener("scroll", function(e) {
if (!_self.$inScrollAnimation) if (!_self.$scrollAnimation)
_self.session.setScrollTop(e.data); _self.session.setScrollTop(e.data);
}); });
@ -1063,10 +1063,10 @@ var VirtualRenderer = function(container, theme) {
this.animateScrolling = function(fromValue, callback) { this.animateScrolling = function(fromValue, callback) {
var toValue = this.scrollTop; var toValue = this.scrollTop;
if (this.$animatedScroll && Math.abs(fromValue - toValue) < 100000) { if (this.$animatedScroll) {
var _self = this; var _self = this;
var steps = _self.$calcSteps(fromValue, toValue); var steps = _self.$calcSteps(fromValue, toValue);
this.$inScrollAnimation = true; this.$scrollAnimation = {from: fromValue, to: toValue};
clearInterval(this.$timer); clearInterval(this.$timer);
@ -1083,7 +1083,7 @@ var VirtualRenderer = function(container, theme) {
} else { } else {
// do this on separate step to not get spurious scroll event from scrollbar // do this on separate step to not get spurious scroll event from scrollbar
_self.$timer = clearInterval(_self.$timer); _self.$timer = clearInterval(_self.$timer);
_self.$inScrollAnimation = false; _self.$scrollAnimation = null;
callback && callback(); callback && callback();
} }
}, 10); }, 10);