update package
This commit is contained in:
parent
da0113ba98
commit
5ae074024a
5 changed files with 140 additions and 93 deletions
|
|
@ -5667,6 +5667,7 @@ var Editor =function(renderer, session) {
|
|||
this.onChangeBackMarker();
|
||||
this.onChangeBreakpoint();
|
||||
this.onChangeAnnotation();
|
||||
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
||||
this.renderer.scrollToRow(session.getScrollTopRow());
|
||||
this.renderer.updateFull();
|
||||
|
||||
|
|
@ -5694,15 +5695,19 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.getTheme = function() {
|
||||
return this.renderer.getTheme();
|
||||
}
|
||||
};
|
||||
|
||||
this.setStyle = function(style) {
|
||||
this.renderer.setStyle(style)
|
||||
this.renderer.setStyle(style);
|
||||
};
|
||||
|
||||
this.unsetStyle = function(style) {
|
||||
this.renderer.unsetStyle(style)
|
||||
}
|
||||
this.renderer.unsetStyle(style);
|
||||
};
|
||||
|
||||
this.setFontSize = function(size) {
|
||||
this.container.style.fontSize = size;
|
||||
};
|
||||
|
||||
this.$highlightBrackets = function() {
|
||||
if (this.session.$bracketHighlight) {
|
||||
|
|
@ -6471,11 +6476,11 @@ var Editor =function(renderer, session) {
|
|||
};
|
||||
|
||||
|
||||
this.gotoLine = function(lineNumber, row) {
|
||||
this.gotoLine = function(lineNumber, column) {
|
||||
this.selection.clearSelection();
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
this.moveCursorTo(lineNumber-1, row || 0);
|
||||
this.moveCursorTo(lineNumber-1, column || 0);
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||
|
|
@ -6728,6 +6733,10 @@ var TextInput = function(parentNode, host) {
|
|||
host.onTextInput(value);
|
||||
} else
|
||||
host.onTextInput(value);
|
||||
|
||||
// If editor is no longer focused we quit immediately, since
|
||||
// it means that something else like CLI is in charge now.
|
||||
if (!isFocused()) return false;
|
||||
}
|
||||
}
|
||||
copied = false;
|
||||
|
|
@ -6883,6 +6892,11 @@ var TextInput = function(parentNode, host) {
|
|||
text.blur();
|
||||
};
|
||||
|
||||
function isFocused() {
|
||||
return document.activeElement === text;
|
||||
};
|
||||
this.isFocused = isFocused;
|
||||
|
||||
this.getElement = function() {
|
||||
return text;
|
||||
};
|
||||
|
|
@ -7653,7 +7667,7 @@ canon.addCommand({
|
|||
});
|
||||
canon.addCommand({
|
||||
name: "removewordleft",
|
||||
bindKey: bindKey(null, "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
|
|
@ -12890,6 +12904,20 @@ var VirtualRenderer = function(container, theme) {
|
|||
scrollerWidth: 0
|
||||
};
|
||||
|
||||
this.layerConfig = {
|
||||
width : 1,
|
||||
padding : 0,
|
||||
firstRow : 0,
|
||||
firstRowScreen: 0,
|
||||
lastRow : 0,
|
||||
lineHeight : 1,
|
||||
characterWidth : 1,
|
||||
minHeight : 1,
|
||||
maxHeight : 1,
|
||||
offset : 0,
|
||||
height : 1
|
||||
};
|
||||
|
||||
this.$loop = new RenderLoop(this.$renderChanges.bind(this));
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
|
||||
|
|
@ -12970,13 +12998,15 @@ var VirtualRenderer = function(container, theme) {
|
|||
*/
|
||||
this.onResize = function(force) {
|
||||
var changes = this.CHANGE_SIZE;
|
||||
var size = this.$size;
|
||||
|
||||
var height = dom.getInnerHeight(this.container);
|
||||
if (force || this.$size.height != height) {
|
||||
this.$size.height = height;
|
||||
if (force || size.height != height) {
|
||||
size.height = height;
|
||||
|
||||
this.scroller.style.height = height + "px";
|
||||
this.scrollBar.setHeight(this.scroller.clientHeight);
|
||||
size.scrollerHeight = this.scroller.clientHeight;
|
||||
this.scrollBar.setHeight(size.scrollerHeight);
|
||||
|
||||
if (this.session) {
|
||||
this.scrollToY(this.getScrollTop());
|
||||
|
|
@ -12985,27 +13015,27 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
var width = dom.getInnerWidth(this.container);
|
||||
if (force || this.$size.width != width) {
|
||||
this.$size.width = width;
|
||||
if (force || size.width != width) {
|
||||
size.width = width;
|
||||
|
||||
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.scroller.style.left = gutterWidth + "px";
|
||||
this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px";
|
||||
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth())
|
||||
this.scroller.style.width = size.scrollerWidth + "px";
|
||||
|
||||
if (this.session.getUseWrapMode()) {
|
||||
var availableWidth = this.scroller.clientWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
|
||||
if (this.session.adjustWrapLimit(limit) || force) {
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
}
|
||||
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
|
||||
this.$size.scrollerWidth = this.scroller.clientWidth;
|
||||
this.$size.scrollerHeight = this.scroller.clientHeight;
|
||||
this.$loop.schedule(changes);
|
||||
};
|
||||
|
||||
this.adjustWrapLimit = function(){
|
||||
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
|
||||
return this.session.adjustWrapLimit(limit);
|
||||
};
|
||||
|
||||
this.$onGutterClick = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
|
@ -13099,33 +13129,27 @@ var VirtualRenderer = function(container, theme) {
|
|||
return;
|
||||
|
||||
var bounds = this.content.getBoundingClientRect();
|
||||
var offset = (this.layerConfig && this.layerConfig.offset) || 0;
|
||||
var offset = this.layerConfig.offset;
|
||||
|
||||
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
|
||||
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
|
||||
};
|
||||
|
||||
this.getFirstVisibleRow = function() {
|
||||
return (this.layerConfig || {}).firstRow || 0;
|
||||
return this.layerConfig.firstRow;
|
||||
};
|
||||
|
||||
this.getFirstFullyVisibleRow = function(){
|
||||
if (!this.layerConfig)
|
||||
return 0;
|
||||
|
||||
this.getFirstFullyVisibleRow = function() {
|
||||
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
|
||||
};
|
||||
|
||||
this.getLastFullyVisibleRow = function() {
|
||||
if (!this.layerConfig)
|
||||
return 0;
|
||||
|
||||
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
|
||||
return this.layerConfig.firstRow - 1 + flint;
|
||||
};
|
||||
|
||||
this.getLastVisibleRow = function() {
|
||||
return (this.layerConfig || {}).lastRow || 0;
|
||||
return this.layerConfig.lastRow;
|
||||
};
|
||||
|
||||
this.$padding = null;
|
||||
|
|
@ -13162,8 +13186,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
return;
|
||||
|
||||
// text, scrolling and resize changes can cause the view port size to change
|
||||
if (!this.layerConfig ||
|
||||
changes & this.CHANGE_FULL ||
|
||||
if (changes & this.CHANGE_FULL ||
|
||||
changes & this.CHANGE_SIZE ||
|
||||
changes & this.CHANGE_TEXT ||
|
||||
changes & this.CHANGE_LINES ||
|
||||
|
|
@ -13189,7 +13212,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$textLayer.update(this.layerConfig);
|
||||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
|
||||
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
|
|
@ -13236,7 +13259,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
var minHeight = this.$size.scrollerHeight + this.lineHeight;
|
||||
|
||||
var longestLine = this.$getLongestLine();
|
||||
var widthChanged = !this.layerConfig ? true : (this.layerConfig.width != longestLine);
|
||||
var widthChanged = this.layerConfig.width != longestLine;
|
||||
|
||||
var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
|
||||
var horizScrollChanged = this.$horizScroll !== horizScroll;
|
||||
|
|
@ -13536,7 +13559,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
this.setTheme = function(theme) {
|
||||
var _self = this;
|
||||
|
||||
|
||||
this.$themeValue = theme;
|
||||
if (!theme || typeof theme == "string") {
|
||||
theme = theme || "ace/theme/textmate";
|
||||
|
|
@ -14282,19 +14305,19 @@ var Text = function(parentEl) {
|
|||
else {
|
||||
stringBuilder.push(output);
|
||||
}
|
||||
return value.length;
|
||||
return screenColumn + value.length;
|
||||
};
|
||||
|
||||
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits) {
|
||||
var chars = 0,
|
||||
split = 0,
|
||||
splitChars,
|
||||
characterWidth = this.config.characterWidth,
|
||||
screenColumn = 0,
|
||||
self = this;
|
||||
var chars = 0;
|
||||
var split = 0;
|
||||
var splitChars;
|
||||
var characterWidth = this.config.characterWidth;
|
||||
var screenColumn = 0;
|
||||
var self = this;
|
||||
|
||||
function addToken(token, value) {
|
||||
screenColumn += self.$renderToken(
|
||||
screenColumn = self.$renderToken(
|
||||
stringBuilder, screenColumn, token, value);
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -5656,6 +5656,7 @@ var Editor =function(renderer, session) {
|
|||
this.onChangeBackMarker();
|
||||
this.onChangeBreakpoint();
|
||||
this.onChangeAnnotation();
|
||||
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
||||
this.renderer.scrollToRow(session.getScrollTopRow());
|
||||
this.renderer.updateFull();
|
||||
|
||||
|
|
@ -5683,15 +5684,19 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.getTheme = function() {
|
||||
return this.renderer.getTheme();
|
||||
}
|
||||
};
|
||||
|
||||
this.setStyle = function(style) {
|
||||
this.renderer.setStyle(style)
|
||||
this.renderer.setStyle(style);
|
||||
};
|
||||
|
||||
this.unsetStyle = function(style) {
|
||||
this.renderer.unsetStyle(style)
|
||||
}
|
||||
this.renderer.unsetStyle(style);
|
||||
};
|
||||
|
||||
this.setFontSize = function(size) {
|
||||
this.container.style.fontSize = size;
|
||||
};
|
||||
|
||||
this.$highlightBrackets = function() {
|
||||
if (this.session.$bracketHighlight) {
|
||||
|
|
@ -6460,11 +6465,11 @@ var Editor =function(renderer, session) {
|
|||
};
|
||||
|
||||
|
||||
this.gotoLine = function(lineNumber, row) {
|
||||
this.gotoLine = function(lineNumber, column) {
|
||||
this.selection.clearSelection();
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
this.moveCursorTo(lineNumber-1, row || 0);
|
||||
this.moveCursorTo(lineNumber-1, column || 0);
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||
|
|
@ -6717,6 +6722,10 @@ var TextInput = function(parentNode, host) {
|
|||
host.onTextInput(value);
|
||||
} else
|
||||
host.onTextInput(value);
|
||||
|
||||
// If editor is no longer focused we quit immediately, since
|
||||
// it means that something else like CLI is in charge now.
|
||||
if (!isFocused()) return false;
|
||||
}
|
||||
}
|
||||
copied = false;
|
||||
|
|
@ -6872,6 +6881,11 @@ var TextInput = function(parentNode, host) {
|
|||
text.blur();
|
||||
};
|
||||
|
||||
function isFocused() {
|
||||
return document.activeElement === text;
|
||||
};
|
||||
this.isFocused = isFocused;
|
||||
|
||||
this.getElement = function() {
|
||||
return text;
|
||||
};
|
||||
|
|
@ -7642,7 +7656,7 @@ canon.addCommand({
|
|||
});
|
||||
canon.addCommand({
|
||||
name: "removewordleft",
|
||||
bindKey: bindKey(null, "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
|
|
@ -12879,6 +12893,20 @@ var VirtualRenderer = function(container, theme) {
|
|||
scrollerWidth: 0
|
||||
};
|
||||
|
||||
this.layerConfig = {
|
||||
width : 1,
|
||||
padding : 0,
|
||||
firstRow : 0,
|
||||
firstRowScreen: 0,
|
||||
lastRow : 0,
|
||||
lineHeight : 1,
|
||||
characterWidth : 1,
|
||||
minHeight : 1,
|
||||
maxHeight : 1,
|
||||
offset : 0,
|
||||
height : 1
|
||||
};
|
||||
|
||||
this.$loop = new RenderLoop(this.$renderChanges.bind(this));
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
|
||||
|
|
@ -12959,13 +12987,15 @@ var VirtualRenderer = function(container, theme) {
|
|||
*/
|
||||
this.onResize = function(force) {
|
||||
var changes = this.CHANGE_SIZE;
|
||||
var size = this.$size;
|
||||
|
||||
var height = dom.getInnerHeight(this.container);
|
||||
if (force || this.$size.height != height) {
|
||||
this.$size.height = height;
|
||||
if (force || size.height != height) {
|
||||
size.height = height;
|
||||
|
||||
this.scroller.style.height = height + "px";
|
||||
this.scrollBar.setHeight(this.scroller.clientHeight);
|
||||
size.scrollerHeight = this.scroller.clientHeight;
|
||||
this.scrollBar.setHeight(size.scrollerHeight);
|
||||
|
||||
if (this.session) {
|
||||
this.scrollToY(this.getScrollTop());
|
||||
|
|
@ -12974,27 +13004,27 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
var width = dom.getInnerWidth(this.container);
|
||||
if (force || this.$size.width != width) {
|
||||
this.$size.width = width;
|
||||
if (force || size.width != width) {
|
||||
size.width = width;
|
||||
|
||||
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.scroller.style.left = gutterWidth + "px";
|
||||
this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px";
|
||||
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth())
|
||||
this.scroller.style.width = size.scrollerWidth + "px";
|
||||
|
||||
if (this.session.getUseWrapMode()) {
|
||||
var availableWidth = this.scroller.clientWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
|
||||
if (this.session.adjustWrapLimit(limit) || force) {
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
}
|
||||
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
|
||||
this.$size.scrollerWidth = this.scroller.clientWidth;
|
||||
this.$size.scrollerHeight = this.scroller.clientHeight;
|
||||
this.$loop.schedule(changes);
|
||||
};
|
||||
|
||||
this.adjustWrapLimit = function(){
|
||||
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
|
||||
return this.session.adjustWrapLimit(limit);
|
||||
};
|
||||
|
||||
this.$onGutterClick = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
|
@ -13088,33 +13118,27 @@ var VirtualRenderer = function(container, theme) {
|
|||
return;
|
||||
|
||||
var bounds = this.content.getBoundingClientRect();
|
||||
var offset = (this.layerConfig && this.layerConfig.offset) || 0;
|
||||
var offset = this.layerConfig.offset;
|
||||
|
||||
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
|
||||
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
|
||||
};
|
||||
|
||||
this.getFirstVisibleRow = function() {
|
||||
return (this.layerConfig || {}).firstRow || 0;
|
||||
return this.layerConfig.firstRow;
|
||||
};
|
||||
|
||||
this.getFirstFullyVisibleRow = function(){
|
||||
if (!this.layerConfig)
|
||||
return 0;
|
||||
|
||||
this.getFirstFullyVisibleRow = function() {
|
||||
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
|
||||
};
|
||||
|
||||
this.getLastFullyVisibleRow = function() {
|
||||
if (!this.layerConfig)
|
||||
return 0;
|
||||
|
||||
var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
|
||||
return this.layerConfig.firstRow - 1 + flint;
|
||||
};
|
||||
|
||||
this.getLastVisibleRow = function() {
|
||||
return (this.layerConfig || {}).lastRow || 0;
|
||||
return this.layerConfig.lastRow;
|
||||
};
|
||||
|
||||
this.$padding = null;
|
||||
|
|
@ -13151,8 +13175,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
return;
|
||||
|
||||
// text, scrolling and resize changes can cause the view port size to change
|
||||
if (!this.layerConfig ||
|
||||
changes & this.CHANGE_FULL ||
|
||||
if (changes & this.CHANGE_FULL ||
|
||||
changes & this.CHANGE_SIZE ||
|
||||
changes & this.CHANGE_TEXT ||
|
||||
changes & this.CHANGE_LINES ||
|
||||
|
|
@ -13178,7 +13201,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$textLayer.update(this.layerConfig);
|
||||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
|
||||
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
|
|
@ -13225,7 +13248,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
var minHeight = this.$size.scrollerHeight + this.lineHeight;
|
||||
|
||||
var longestLine = this.$getLongestLine();
|
||||
var widthChanged = !this.layerConfig ? true : (this.layerConfig.width != longestLine);
|
||||
var widthChanged = this.layerConfig.width != longestLine;
|
||||
|
||||
var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
|
||||
var horizScrollChanged = this.$horizScroll !== horizScroll;
|
||||
|
|
@ -13525,7 +13548,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
this.setTheme = function(theme) {
|
||||
var _self = this;
|
||||
|
||||
|
||||
this.$themeValue = theme;
|
||||
if (!theme || typeof theme == "string") {
|
||||
theme = theme || "ace/theme/textmate";
|
||||
|
|
@ -14271,19 +14294,19 @@ var Text = function(parentEl) {
|
|||
else {
|
||||
stringBuilder.push(output);
|
||||
}
|
||||
return value.length;
|
||||
return screenColumn + value.length;
|
||||
};
|
||||
|
||||
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits) {
|
||||
var chars = 0,
|
||||
split = 0,
|
||||
splitChars,
|
||||
characterWidth = this.config.characterWidth,
|
||||
screenColumn = 0,
|
||||
self = this;
|
||||
var chars = 0;
|
||||
var split = 0;
|
||||
var splitChars;
|
||||
var characterWidth = this.config.characterWidth;
|
||||
var screenColumn = 0;
|
||||
var self = this;
|
||||
|
||||
function addToken(token, value) {
|
||||
screenColumn += self.$renderToken(
|
||||
screenColumn = self.$renderToken(
|
||||
stringBuilder, screenColumn, token, value);
|
||||
}
|
||||
|
||||
|
|
@ -15550,7 +15573,7 @@ function setupApi(editor, editorDiv, settingDiv, ace, options) {
|
|||
}
|
||||
}
|
||||
|
||||
for (option in ace.options) {
|
||||
for (var option in ace.options) {
|
||||
ret.setOption(option, ace.options[option]);
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-json.js
Normal file
1
build/textarea/src/mode-json.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue