commit
40ea516801
13 changed files with 140 additions and 101 deletions
|
|
@ -127,6 +127,26 @@ exports.commands = [{
|
|||
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
||||
exec: function(editor) { editor.findPrevious(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectOrFindNext",
|
||||
bindKey: bindKey("ALt-K", "Ctrl-G"),
|
||||
exec: function(editor) {
|
||||
if (editor.selection.isEmpty())
|
||||
editor.selection.selectWord();
|
||||
else
|
||||
editor.findNext();
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectOrFindPrevious",
|
||||
bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
|
||||
exec: function(editor) {
|
||||
if (editor.selection.isEmpty())
|
||||
editor.selection.selectWord();
|
||||
else
|
||||
editor.findPrevious();
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "find",
|
||||
bindKey: bindKey("Ctrl-F", "Command-F"),
|
||||
|
|
@ -145,14 +165,14 @@ exports.commands = [{
|
|||
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true,
|
||||
group: "fileJump"
|
||||
aceCommandGroup: "fileJump"
|
||||
}, {
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
|
||||
exec: function(editor) { editor.navigateFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true,
|
||||
group: "fileJump"
|
||||
aceCommandGroup: "fileJump"
|
||||
}, {
|
||||
name: "selectup",
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||
|
|
@ -171,14 +191,14 @@ exports.commands = [{
|
|||
exec: function(editor) { editor.getSelection().selectFileEnd(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true,
|
||||
group: "fileJump"
|
||||
aceCommandGroup: "fileJump"
|
||||
}, {
|
||||
name: "gotoend",
|
||||
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
|
||||
exec: function(editor) { editor.navigateFileEnd(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true,
|
||||
group: "fileJump"
|
||||
aceCommandGroup: "fileJump"
|
||||
}, {
|
||||
name: "selectdown",
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
cursor: text;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.ace_dragging, .ace_dragging * {
|
||||
|
|
|
|||
|
|
@ -952,8 +952,8 @@ var EditSession = function(text, mode) {
|
|||
if (!$isPlaceholder) {
|
||||
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
|
||||
this.$setFolding(mode.foldingRules);
|
||||
this._emit("changeMode");
|
||||
this.bgTokenizer.start(0);
|
||||
this._emit("changeMode");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -128,13 +128,9 @@ function Folding() {
|
|||
var folds = [];
|
||||
var foldLines = this.$foldData;
|
||||
|
||||
function addFold(fold) {
|
||||
folds.push(fold);
|
||||
}
|
||||
|
||||
for (var i = 0; i < foldLines.length; i++)
|
||||
for (var j = 0; j < foldLines[i].folds.length; j++)
|
||||
addFold(foldLines[i].folds[j]);
|
||||
folds.push(foldLines[i].folds[j]);
|
||||
|
||||
return folds;
|
||||
};
|
||||
|
|
@ -655,12 +651,15 @@ function Folding() {
|
|||
if (range && range.isMultiLine()
|
||||
&& range.end.row <= endRow
|
||||
&& range.start.row >= startRow
|
||||
) try {
|
||||
var fold = this.addFold("...", range);
|
||||
fold.collapseChildren = depth;
|
||||
// addFold can change the range
|
||||
) {
|
||||
row = range.end.row;
|
||||
} catch(e) {}
|
||||
try {
|
||||
// addFold can change the range
|
||||
var fold = this.addFold("...", range);
|
||||
if (fold)
|
||||
fold.collapseChildren = depth;
|
||||
} catch(e) {}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -753,6 +752,8 @@ function Folding() {
|
|||
};
|
||||
|
||||
this.$toggleFoldWidget = function(row, options) {
|
||||
if (!this.getFoldWidget)
|
||||
return;
|
||||
var type = this.getFoldWidget(row);
|
||||
var line = this.getLine(row);
|
||||
|
||||
|
|
|
|||
|
|
@ -110,17 +110,17 @@ var Editor = function(renderer, session) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.$initOperationListeners = function() {
|
||||
function last(a) {return a[a.length - 1]};
|
||||
function last(a) {return a[a.length - 1]}
|
||||
|
||||
this.selections = [];
|
||||
this.commands.on("exec", function(e) {
|
||||
this.startOperation(e);
|
||||
|
||||
var command = e.command;
|
||||
if (command.group == "fileJump") {
|
||||
if (command.aceCommandGroup == "fileJump") {
|
||||
var prev = this.prevOp;
|
||||
if (!prev || prev.command.group != "fileJump") {
|
||||
this.lastFileJumpPos = last(this.selections)
|
||||
if (!prev || prev.command.aceCommandGroup != "fileJump") {
|
||||
this.lastFileJumpPos = last(this.selections);
|
||||
}
|
||||
} else {
|
||||
this.lastFileJumpPos = null;
|
||||
|
|
@ -130,10 +130,10 @@ var Editor = function(renderer, session) {
|
|||
this.commands.on("afterExec", function(e) {
|
||||
var command = e.command;
|
||||
|
||||
if (command.group == "fileJump") {
|
||||
if (command.aceCommandGroup == "fileJump") {
|
||||
if (this.lastFileJumpPos && !this.curOp.selectionChanged) {
|
||||
this.selection.fromJSON(this.lastFileJumpPos);
|
||||
return
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.endOperation(e);
|
||||
|
|
@ -150,7 +150,7 @@ var Editor = function(renderer, session) {
|
|||
this.curOp || this.startOperation();
|
||||
this.curOp.selectionChanged = true;
|
||||
}.bind(this), true);
|
||||
}
|
||||
};
|
||||
|
||||
this.curOp = null;
|
||||
this.prevOp = {};
|
||||
|
|
@ -218,12 +218,12 @@ var Editor = function(renderer, session) {
|
|||
|
||||
shouldMerge = shouldMerge
|
||||
&& this.mergeNextCommand // previous command allows to coalesce with
|
||||
&& (!/\s/.test(text) || /\s/.test(prev.args)) // previous insertion was of same type
|
||||
&& (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type
|
||||
|
||||
this.mergeNextCommand = true;
|
||||
} else {
|
||||
shouldMerge = shouldMerge
|
||||
&& mergeableCommands.indexOf(e.command.name) !== -1// the command is mergeable
|
||||
&& mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
@ -689,7 +689,7 @@ var Editor = function(renderer, session) {
|
|||
this.$updateHighlightActiveLine();
|
||||
}
|
||||
|
||||
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
|
||||
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
|
||||
this.session.highlight(re);
|
||||
|
||||
this._emit("changeSelection");
|
||||
|
|
@ -1205,9 +1205,9 @@ var Editor = function(renderer, session) {
|
|||
if (range.end.column == 0) {
|
||||
var text = session.getTextRange(range);
|
||||
if (text[text.length - 1] == "\n") {
|
||||
var line = session.getLine(range.end.row)
|
||||
var line = session.getLine(range.end.row);
|
||||
if (/^\s+$/.test(line)) {
|
||||
range.end.column = line.length
|
||||
range.end.column = line.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1353,7 +1353,7 @@ var Editor = function(renderer, session) {
|
|||
session.indentRows(rows.first, rows.last, "\t");
|
||||
return;
|
||||
} else if (range.start.column < range.end.column) {
|
||||
var text = session.getTextRange(range)
|
||||
var text = session.getTextRange(range);
|
||||
if (!/^\s+$/.test(text)) {
|
||||
var rows = this.$getSelectedRows();
|
||||
session.indentRows(rows.first, rows.last, "\t");
|
||||
|
|
@ -1444,19 +1444,19 @@ var Editor = function(renderer, session) {
|
|||
* Works like [[EditSession.getTokenAt]], except it returns a number.
|
||||
* @returns {Number}
|
||||
**/
|
||||
this.getNumberAt = function( row, column ) {
|
||||
var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g
|
||||
_numberRx.lastIndex = 0
|
||||
this.getNumberAt = function(row, column) {
|
||||
var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
|
||||
_numberRx.lastIndex = 0;
|
||||
|
||||
var s = this.session.getLine(row)
|
||||
var s = this.session.getLine(row);
|
||||
while (_numberRx.lastIndex < column) {
|
||||
var m = _numberRx.exec(s)
|
||||
var m = _numberRx.exec(s);
|
||||
if(m.index <= column && m.index+m[0].length >= column){
|
||||
var number = {
|
||||
value: m[0],
|
||||
start: m.index,
|
||||
end: m.index+m[0].length
|
||||
}
|
||||
};
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
|
@ -1542,7 +1542,7 @@ var Editor = function(renderer, session) {
|
|||
range.start = point;
|
||||
range.end = endPoint;
|
||||
|
||||
sel.setSelectionRange(range, reverse)
|
||||
sel.setSelectionRange(range, reverse);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1827,7 +1827,7 @@ var Editor = function(renderer, session) {
|
|||
var pos = {
|
||||
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
|
||||
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
|
||||
}
|
||||
};
|
||||
this.renderer.alignCursor(pos, 0.5);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,8 @@ exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
|||
exports.addListener(document, "mousemove", eventHandler, true);
|
||||
exports.addListener(document, "mouseup", onMouseUp, true);
|
||||
exports.addListener(document, "dragstart", onMouseUp, true);
|
||||
|
||||
return onMouseUp;
|
||||
};
|
||||
|
||||
exports.addMouseWheelListener = function(el, callback) {
|
||||
|
|
|
|||
|
|
@ -63,23 +63,22 @@ var C9SearchHighlightRules = function() {
|
|||
|
||||
var regex = stack[1];
|
||||
var str = values[3];
|
||||
if (regex && str)
|
||||
values = str.split(regex); // this doesn't work on ie8 but we don't care:)
|
||||
else
|
||||
values = [str];
|
||||
|
||||
for (var i = 0, l = values.length; i < l; i+=2) {
|
||||
if (values[i])
|
||||
tokens.push({
|
||||
type: types[2],
|
||||
value: values[i]
|
||||
});
|
||||
if (values[i+1])
|
||||
tokens.push({
|
||||
type: types[3],
|
||||
value: values[i + 1]
|
||||
});
|
||||
var m;
|
||||
var last = 0;
|
||||
if (regex) {
|
||||
regex.lastIndex = 0;
|
||||
while (m = regex.exec(str)) {
|
||||
var skipped = str.substring(last, m.index);
|
||||
last = regex.lastIndex;
|
||||
if (skipped)
|
||||
tokens.push({type: types[2], value: skipped});
|
||||
if (m[0])
|
||||
tokens.push({type: types[3], value: m[0]});
|
||||
}
|
||||
}
|
||||
if (last < str.length)
|
||||
tokens.push({type: types[2], value: str.substr(last)});
|
||||
return tokens;
|
||||
}
|
||||
},
|
||||
|
|
@ -102,7 +101,7 @@ var C9SearchHighlightRules = function() {
|
|||
search = "\\b" + search + "\\b";
|
||||
var regex = safeCreateRegexp(
|
||||
"(" + search + ")",
|
||||
/ sensitive/.test(options) ? "" : "i"
|
||||
/ sensitive/.test(options) ? "g" : "ig"
|
||||
);
|
||||
if (regex) {
|
||||
stack[0] = state;
|
||||
|
|
|
|||
|
|
@ -7875,7 +7875,7 @@ Lexer.prototype = {
|
|||
|
||||
this.skip();
|
||||
|
||||
while (this.peek() !== quote) {
|
||||
outer: while (this.peek() !== quote) {
|
||||
while (this.peek() === "") { // End Of Line
|
||||
|
||||
// If an EOL is not preceded by a backslash, show a warning
|
||||
|
|
@ -7927,6 +7927,9 @@ Lexer.prototype = {
|
|||
quote: quote
|
||||
};
|
||||
}
|
||||
|
||||
if (this.peek() == quote)
|
||||
break outer;
|
||||
}
|
||||
|
||||
allowNewLine = false;
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ var MouseHandler = function(editor) {
|
|||
self.x = e.clientX;
|
||||
self.y = e.clientY;
|
||||
mouseMoveHandler && mouseMoveHandler(e);
|
||||
self.mouseEvent = new MouseEvent(e, self.editor);
|
||||
self.$mouseMoved = true;
|
||||
};
|
||||
|
||||
var onCaptureEnd = function(e) {
|
||||
|
|
@ -127,20 +129,24 @@ var MouseHandler = function(editor) {
|
|||
renderer.$moveTextAreaToCursor();
|
||||
}
|
||||
self.isMousePressed = false;
|
||||
self.$onCaptureMouseMove = self.releaseMouse = null;
|
||||
self.onMouseEvent("mouseup", e);
|
||||
};
|
||||
|
||||
var onCaptureInterval = function() {
|
||||
self[self.state] && self[self.state]();
|
||||
self.$mouseMoved = false;
|
||||
};
|
||||
|
||||
if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
|
||||
return setTimeout(function() {onCaptureEnd(ev);});
|
||||
}
|
||||
|
||||
event.capture(this.editor.container, onMouseMove, onCaptureEnd);
|
||||
self.$onCaptureMouseMove = onMouseMove;
|
||||
self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);
|
||||
var timerId = setInterval(onCaptureInterval, 20);
|
||||
};
|
||||
this.releaseMouse = null;
|
||||
}).call(MouseHandler.prototype);
|
||||
|
||||
config.defineOptions(MouseHandler.prototype, "mouseHandler", {
|
||||
|
|
|
|||
|
|
@ -696,7 +696,8 @@ var Editor = require("./editor").Editor;
|
|||
range = session.getWordRange(range.start.row, range.start.column);
|
||||
range.cursor = dir == -1 ? range.start : range.end;
|
||||
this.multiSelect.addRange(range);
|
||||
return;
|
||||
// todo add option for sublime like behavior
|
||||
// return;
|
||||
}
|
||||
var needle = session.getTextRange(range);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ module.exports = {
|
|||
MultiSelect(editor);
|
||||
|
||||
editor.navigateFileEnd();
|
||||
exec("selectMoreBefore", 4);
|
||||
exec("selectMoreBefore", 3);
|
||||
assert.ok(editor.inMultiSelectMode);
|
||||
assert.equal(editor.selection.getAllRanges().length, 4);
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ var Tokenizer = function(rules) {
|
|||
if (matchcount > 1) {
|
||||
if (/\\\d/.test(rule.regex)) {
|
||||
// Replace any backreferences and offset appropriately.
|
||||
adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function (match, digit) {
|
||||
adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match, digit) {
|
||||
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
|
||||
});
|
||||
} else {
|
||||
|
|
@ -222,6 +222,10 @@ var Tokenizer = function(rules) {
|
|||
|
||||
var currentState = startState || "start";
|
||||
var state = this.states[currentState];
|
||||
if (!state) {
|
||||
currentState = "start";
|
||||
state = this.states[currentState];
|
||||
}
|
||||
var mapping = this.matchMappings[currentState];
|
||||
var re = this.regExps[currentState];
|
||||
re.lastIndex = 0;
|
||||
|
|
|
|||
|
|
@ -228,8 +228,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (this.scrollMargin.top && session.getScrollTop() <= 0)
|
||||
session.setScrollTop(-this.scrollMargin.top);
|
||||
|
||||
this.scroller.className = "ace_scroller";
|
||||
|
||||
this.$cursorLayer.setSession(session);
|
||||
this.$markerBack.setSession(session);
|
||||
this.$markerFront.setSession(session);
|
||||
|
|
@ -359,6 +357,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.$updateCachedSize = function(force, gutterWidth, width, height) {
|
||||
height -= (this.$extraHeight || 0);
|
||||
var changes = 0;
|
||||
var size = this.$size;
|
||||
var oldSize = {
|
||||
|
|
@ -407,8 +406,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
|
||||
if (size.$dirty)
|
||||
size.$dirty = !width && !height;
|
||||
size.$dirty = !width || !height;
|
||||
|
||||
if (changes)
|
||||
this._signal("resize", oldSize);
|
||||
|
|
@ -749,13 +747,22 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.scrollBarH.setInnerWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
|
||||
this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
|
||||
};
|
||||
|
||||
this.$frozen = false;
|
||||
this.freeze = function() {
|
||||
this.$frozen = true;
|
||||
};
|
||||
|
||||
this.unfreeze = function() {
|
||||
this.$frozen = false;
|
||||
};
|
||||
|
||||
this.$renderChanges = function(changes, force) {
|
||||
if (this.$changes) {
|
||||
changes |= this.$changes;
|
||||
this.$changes = 0;
|
||||
}
|
||||
if ((!this.session || !this.container.offsetWidth) || (!changes && !force)) {
|
||||
if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {
|
||||
this.$changes |= changes;
|
||||
return;
|
||||
}
|
||||
|
|
@ -769,6 +776,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
// this.$logChanges(changes);
|
||||
|
||||
this._signal("beforeRender");
|
||||
var config = this.layerConfig;
|
||||
// text, scrolling and resize changes can cause the view port size to change
|
||||
if (changes & this.CHANGE_FULL ||
|
||||
changes & this.CHANGE_SIZE ||
|
||||
|
|
@ -776,27 +784,33 @@ var VirtualRenderer = function(container, theme) {
|
|||
changes & this.CHANGE_LINES ||
|
||||
changes & this.CHANGE_SCROLL ||
|
||||
changes & this.CHANGE_H_SCROLL
|
||||
)
|
||||
) {
|
||||
changes |= this.$computeLayerConfig();
|
||||
|
||||
config = this.layerConfig;
|
||||
// update scrollbar first to not lose scroll position when gutter calls resize
|
||||
this.$updateScrollBarV();
|
||||
if (changes & this.CHANGE_H_SCROLL)
|
||||
this.$updateScrollBarH();
|
||||
this.$gutterLayer.element.style.marginTop = (-config.offset) + "px";
|
||||
this.content.style.marginTop = (-config.offset) + "px";
|
||||
this.content.style.width = config.width + 2 * this.$padding + "px";
|
||||
this.content.style.height = config.minHeight + "px";
|
||||
}
|
||||
|
||||
// horizontal scrolling
|
||||
if (changes & this.CHANGE_H_SCROLL) {
|
||||
this.$updateScrollBarH();
|
||||
this.content.style.marginLeft = -this.scrollLeft + "px";
|
||||
this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
|
||||
}
|
||||
|
||||
// full
|
||||
if (changes & this.CHANGE_FULL) {
|
||||
// update scrollbar first to not lose scroll position when gutter calls resize
|
||||
this.$updateScrollBarV();
|
||||
this.$updateScrollBarH();
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
this.$textLayer.update(config);
|
||||
if (this.$showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$gutterLayer.update(config);
|
||||
this.$markerBack.update(config);
|
||||
this.$markerFront.update(config);
|
||||
this.$cursorLayer.update(config);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
this._signal("afterRender");
|
||||
|
|
@ -805,17 +819,16 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
// scrolling
|
||||
if (changes & this.CHANGE_SCROLL) {
|
||||
this.$updateScrollBarV();
|
||||
if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
this.$textLayer.update(config);
|
||||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
this.$textLayer.scrollLines(config);
|
||||
|
||||
if (this.$showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$gutterLayer.update(config);
|
||||
this.$markerBack.update(config);
|
||||
this.$markerFront.update(config);
|
||||
this.$cursorLayer.update(config);
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
this.$moveTextAreaToCursor();
|
||||
this._signal("afterRender");
|
||||
|
|
@ -823,49 +836,44 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
if (changes & this.CHANGE_TEXT) {
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
this.$textLayer.update(config);
|
||||
if (this.$showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$gutterLayer.update(config);
|
||||
}
|
||||
else if (changes & this.CHANGE_LINES) {
|
||||
if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$gutterLayer.update(config);
|
||||
}
|
||||
else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
|
||||
if (this.$showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$gutterLayer.update(config);
|
||||
}
|
||||
|
||||
if (changes & this.CHANGE_CURSOR) {
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$cursorLayer.update(config);
|
||||
this.$moveTextAreaToCursor();
|
||||
this.$highlightGutterLine && this.$updateGutterLineHighlight();
|
||||
}
|
||||
|
||||
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$markerFront.update(config);
|
||||
}
|
||||
|
||||
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
}
|
||||
|
||||
if (changes & this.CHANGE_SIZE || changes & this.CHANGE_LINES) {
|
||||
this.$updateScrollBarV();
|
||||
this.$updateScrollBarH();
|
||||
this.$markerBack.update(config);
|
||||
}
|
||||
|
||||
this._signal("afterRender");
|
||||
};
|
||||
|
||||
|
||||
this.$autosize = function(height, width) {
|
||||
this.$autosize = function() {
|
||||
var height = this.session.getScreenLength() * this.lineHeight;
|
||||
var maxHeight = this.$maxLines * this.lineHeight;
|
||||
var desiredHeight = Math.max(
|
||||
(this.$minLines||1) * this.lineHeight,
|
||||
Math.min(maxHeight, height)
|
||||
);
|
||||
) + this.scrollMargin.v + (this.$extraHeight || 0);
|
||||
var vScroll = height > maxHeight;
|
||||
|
||||
if (desiredHeight != this.desiredHeight ||
|
||||
|
|
@ -890,7 +898,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
var session = this.session;
|
||||
|
||||
var hideScrollbars = this.$size.height <= 2 * this.lineHeight;
|
||||
var screenLines = this.session.getScreenLength()
|
||||
var screenLines = this.session.getScreenLength();
|
||||
var maxHeight = screenLines * this.lineHeight;
|
||||
|
||||
var offset = this.scrollTop % this.lineHeight;
|
||||
|
|
@ -981,12 +989,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
// For debugging.
|
||||
// console.log(JSON.stringify(this.layerConfig));
|
||||
|
||||
this.$gutterLayer.element.style.marginTop = (-offset) + "px";
|
||||
this.content.style.marginTop = (-offset) + "px";
|
||||
this.content.style.width = longestLine + 2 * this.$padding + "px";
|
||||
this.content.style.height = minHeight + "px";
|
||||
|
||||
return changes;
|
||||
return changes;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue