pull back changes from cloud9
This commit is contained in:
parent
cc0b6386aa
commit
1400d82d34
8 changed files with 31 additions and 35 deletions
|
|
@ -52,15 +52,13 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
**/
|
||||
|
||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
this.document = doc;
|
||||
|
||||
this.$onChange = this.onChange.bind(this);
|
||||
this.attach(doc);
|
||||
|
||||
if (typeof column == "undefined")
|
||||
this.setPosition(row.row, row.column);
|
||||
else
|
||||
this.setPosition(row, column);
|
||||
|
||||
this.$onChange = this.onChange.bind(this);
|
||||
doc.on("change", this.$onChange);
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -71,7 +69,6 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
* Returns an object identifying the `row` and `column` position of the current anchor.
|
||||
* @returns {Object}
|
||||
**/
|
||||
|
||||
this.getPosition = function() {
|
||||
return this.$clipPositionToDocument(this.row, this.column);
|
||||
};
|
||||
|
|
@ -81,7 +78,6 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
* Returns the current document.
|
||||
* @returns {Document}
|
||||
**/
|
||||
|
||||
this.getDocument = function() {
|
||||
return this.document;
|
||||
};
|
||||
|
|
@ -98,9 +94,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
* - `old`: An object describing the old Anchor position
|
||||
* - `value`: An object describing the new Anchor position
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
this.onChange = function(e) {
|
||||
var delta = e.data;
|
||||
var range = delta.range;
|
||||
|
|
@ -122,6 +116,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
if (delta.action === "insertText") {
|
||||
if (start.row === row && start.column <= column) {
|
||||
if (start.row === end.row) {
|
||||
//if (start.column == column)
|
||||
column += end.column - start.column;
|
||||
} else {
|
||||
column -= start.column;
|
||||
|
|
@ -169,10 +164,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
* @param {Number} column The column index to move the anchor to
|
||||
* @param {Boolean} noClip Identifies if you want the position to be clipped
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
this.setPosition = function(row, column, noClip) {
|
||||
var pos;
|
||||
if (noClip) {
|
||||
|
|
@ -204,10 +196,13 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
* When called, the `'change'` event listener is removed.
|
||||
*
|
||||
**/
|
||||
|
||||
this.detach = function() {
|
||||
this.document.removeEventListener("change", this.$onChange);
|
||||
};
|
||||
this.attach = function(doc) {
|
||||
this.document = doc || this.document;
|
||||
this.document.on("change", this.$onChange);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clips the anchor position to the specified row and column.
|
||||
|
|
|
|||
|
|
@ -395,8 +395,8 @@ exports.commands = [{
|
|||
}, {
|
||||
name: "backspace",
|
||||
bindKey: bindKey(
|
||||
"Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||
"Shift-Backspace|Backspace",
|
||||
"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||
),
|
||||
exec: function(editor) { editor.remove("left"); },
|
||||
multiSelectAction: "forEach"
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ var Document = function(text) {
|
|||
**/
|
||||
this.getTextRange = function(range) {
|
||||
if (range.start.row == range.end.row) {
|
||||
return this.$lines[range.start.row]
|
||||
return this.getLine(range.start.row)
|
||||
.substring(range.start.column, range.end.column);
|
||||
}
|
||||
var lines = this.getLines(range.start.row, range.end.row);
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ var Gutter = function(parentEl) {
|
|||
var gutterWidth = ("" + lastLineNumber).length * config.characterWidth;
|
||||
var padding = this.$padding || this.$computePadding();
|
||||
gutterWidth += padding.left + padding.right;
|
||||
if (gutterWidth !== this.gutterWidth) {
|
||||
if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
|
||||
this.gutterWidth = gutterWidth;
|
||||
this.element.style.width = Math.ceil(this.gutterWidth) + "px";
|
||||
this._emit("changeGutterWidth", gutterWidth);
|
||||
|
|
@ -200,9 +200,9 @@ var Gutter = function(parentEl) {
|
|||
if (!this.element.firstChild)
|
||||
return {left: 0, right: 0};
|
||||
var style = dom.computedStyle(this.element.firstChild);
|
||||
this.$padding = {}
|
||||
this.$padding.left = parseInt(style.paddingLeft) + 1;
|
||||
this.$padding.right = parseInt(style.paddingRight);
|
||||
this.$padding = {};
|
||||
this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;
|
||||
this.$padding.right = parseInt(style.paddingRight) || 0;
|
||||
return this.$padding;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@
|
|||
color: #FFFFFF
|
||||
}
|
||||
|
||||
.ace-idle-fingers .ace_text-layer {
|
||||
color: #FFFFFF
|
||||
}
|
||||
|
||||
.ace-idle-fingers .ace_cursor {
|
||||
border-left: 2px solid #91FF00
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@
|
|||
}
|
||||
|
||||
.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,
|
||||
.ace-solarized-dark .ace_storage,
|
||||
.ace-solarized-dark .ace_text-layer {
|
||||
.ace-solarized-dark .ace_storage {
|
||||
color: #93A1A1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ define(function(require, exports, module) {
|
|||
|
||||
var oop = require("./lib/oop");
|
||||
var dom = require("./lib/dom");
|
||||
var event = require("./lib/event");
|
||||
var useragent = require("./lib/useragent");
|
||||
var config = require("./config");
|
||||
var GutterLayer = require("./layer/gutter").Gutter;
|
||||
|
|
@ -159,7 +158,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
bottom: 0,
|
||||
v: 0,
|
||||
h: 0
|
||||
}
|
||||
};
|
||||
|
||||
this.$loop = new RenderLoop(
|
||||
this.$renderChanges.bind(this),
|
||||
|
|
@ -311,7 +310,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.onResize = function(force, gutterWidth, width, height) {
|
||||
if (this.resizing > 2)
|
||||
return;
|
||||
else if (this.resizing > 1)
|
||||
else if (this.resizing > 0)
|
||||
this.resizing++;
|
||||
else
|
||||
this.resizing = force ? 1 : 0;
|
||||
|
|
@ -338,7 +337,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.$updateCachedSize = function(force, gutterWidth, width, height) {
|
||||
var changes = this.$changes || 0;
|
||||
var changes = 0;
|
||||
var size = this.$size;
|
||||
if (height && (force || size.height != height)) {
|
||||
size.height = height;
|
||||
|
|
@ -360,7 +359,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
changes = this.CHANGE_SIZE;
|
||||
size.width = width;
|
||||
|
||||
var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
|
||||
gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.scrollBarH.element.style.left =
|
||||
this.scroller.style.left = gutterWidth + "px";
|
||||
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth());
|
||||
|
|
@ -373,11 +372,19 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
|
||||
if (changes)
|
||||
this._signal("resize");
|
||||
|
||||
if (this.$changes) {
|
||||
changes |= this.$changes;
|
||||
this.$changes = 0;
|
||||
}
|
||||
|
||||
return changes;
|
||||
};
|
||||
|
||||
this.onGutterResize = function() {
|
||||
var width = this.$size.width;
|
||||
var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,10 +88,9 @@ window.define = function(id, deps, factory) {
|
|||
};
|
||||
|
||||
require.modules[id] = {
|
||||
exports: {},
|
||||
factory: function() {
|
||||
var module = {
|
||||
exports: {}
|
||||
};
|
||||
var module = this;
|
||||
var returnExports = factory(req, module.exports, module);
|
||||
if (returnExports)
|
||||
module.exports = returnExports;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue