diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 2bc36f8b..bac090f7 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -359,7 +359,7 @@ function buildAce(options) { buildSubmodule(options, { projectType: "theme", require: ["ace/theme/" + name] - }, "theme-" + name.replace("_theme", "")); + }, "theme-" + name); }); // keybindings ["vim", "emacs"].forEach(function(name) { diff --git a/lib/ace/autocomplete/popup.js b/lib/ace/autocomplete/popup.js index a34ebf09..4f31f01c 100644 --- a/lib/ace/autocomplete/popup.js +++ b/lib/ace/autocomplete/popup.js @@ -52,6 +52,7 @@ var $singleLineEditor = function(el) { editor.renderer.setHighlightGutterLine(false); editor.$mouseHandler.$focusWaitTimout = 0; + editor.$highlightTagPending = true; return editor; }; @@ -103,7 +104,7 @@ var AcePopup = function(parentNode) { popup.session.removeMarker(hoverMarker.id); hoverMarker.id = null; } - } + }; popup.setSelectOnHover(false); popup.on("mousemove", function(e) { if (!lastMouseEvent) { @@ -171,8 +172,8 @@ var AcePopup = function(parentNode) { }; var bgTokenizer = popup.session.bgTokenizer; - bgTokenizer.$tokenizeRow = function(i) { - var data = popup.data[i]; + bgTokenizer.$tokenizeRow = function(row) { + var data = popup.data[row]; var tokens = []; if (!data) return tokens; @@ -206,7 +207,7 @@ var AcePopup = function(parentNode) { popup.session.$computeWidth = function() { return this.screenWidth = 0; - } + }; // public popup.isOpen = false; @@ -240,6 +241,7 @@ var AcePopup = function(parentNode) { popup.on("changeSelection", function() { if (popup.isOpen) popup.setRow(popup.selection.lead.row); + popup.renderer.scrollCursorIntoView(); }); popup.hide = function() { diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js index a150a76f..c5d34aae 100644 --- a/lib/ace/commands/default_commands.js +++ b/lib/ace/commands/default_commands.js @@ -205,12 +205,14 @@ exports.commands = [{ bindKey: bindKey("Shift-Up", "Shift-Up"), exec: function(editor) { editor.getSelection().selectUp(); }, multiSelectAction: "forEach", + scrollIntoView: "cursor", readOnly: true }, { name: "golineup", bindKey: bindKey("Up", "Up|Ctrl-P"), exec: function(editor, args) { editor.navigateUp(args.times); }, multiSelectAction: "forEach", + scrollIntoView: "cursor", readOnly: true }, { name: "selecttoend", @@ -395,12 +397,21 @@ exports.commands = [{ bindKey: bindKey("Ctrl-P", "Ctrl-P"), exec: function(editor) { editor.jumpToMatching(); }, multiSelectAction: "forEach", + scrollIntoView: "animate", readOnly: true }, { name: "selecttomatching", bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"), exec: function(editor) { editor.jumpToMatching(true); }, multiSelectAction: "forEach", + scrollIntoView: "animate", + readOnly: true +}, { + name: "expandToMatching", + bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"), + exec: function(editor) { editor.jumpToMatching(true, true); }, + multiSelectAction: "forEach", + scrollIntoView: "animate", readOnly: true }, { name: "passKeysToBrowser", @@ -458,11 +469,13 @@ exports.commands = [{ name: "modifyNumberUp", bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), exec: function(editor) { editor.modifyNumber(1); }, + scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "modifyNumberDown", bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"), exec: function(editor) { editor.modifyNumber(-1); }, + scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "replace", @@ -629,7 +642,7 @@ exports.commands = [{ var isBackwards = editor.selection.isBackwards(); var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor(); var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead(); - var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length + var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length; var selectedText = editor.session.doc.getTextRange(editor.selection.getRange()); var selectedCount = selectedText.replace(/\n\s*/, " ").length; var insertLine = editor.session.doc.getLine(selectionStart.row); @@ -640,7 +653,7 @@ exports.commands = [{ curLine = " " + curLine; } insertLine += curLine; - }; + } if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) { // Don't insert a newline at the end of the document diff --git a/lib/ace/commands/multi_select_commands.js b/lib/ace/commands/multi_select_commands.js index 347eb606..ba6392bc 100644 --- a/lib/ace/commands/multi_select_commands.js +++ b/lib/ace/commands/multi_select_commands.js @@ -35,41 +35,49 @@ exports.defaultCommands = [{ name: "addCursorAbove", exec: function(editor) { editor.selectMoreLines(-1); }, bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"}, + scrollIntoView: "cursor", readonly: true }, { name: "addCursorBelow", exec: function(editor) { editor.selectMoreLines(1); }, bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"}, + scrollIntoView: "cursor", readonly: true }, { name: "addCursorAboveSkipCurrent", exec: function(editor) { editor.selectMoreLines(-1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"}, + scrollIntoView: "cursor", readonly: true }, { name: "addCursorBelowSkipCurrent", exec: function(editor) { editor.selectMoreLines(1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"}, + scrollIntoView: "cursor", readonly: true }, { name: "selectMoreBefore", exec: function(editor) { editor.selectMore(-1); }, bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"}, + scrollIntoView: "cursor", readonly: true }, { name: "selectMoreAfter", exec: function(editor) { editor.selectMore(1); }, bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"}, + scrollIntoView: "cursor", readonly: true }, { name: "selectNextBefore", exec: function(editor) { editor.selectMore(-1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"}, + scrollIntoView: "cursor", readonly: true }, { name: "selectNextAfter", exec: function(editor) { editor.selectMore(1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"}, + scrollIntoView: "cursor", readonly: true }, { name: "splitIntoLines", @@ -79,11 +87,13 @@ exports.defaultCommands = [{ }, { name: "alignCursors", exec: function(editor) { editor.alignCursors(); }, - bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"} + bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}, + scrollIntoView: "cursor" }, { name: "findAll", exec: function(editor) { editor.findAll(); }, bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"}, + scrollIntoView: "cursor", readonly: true }]; @@ -92,6 +102,7 @@ exports.multiSelectCommands = [{ name: "singleSelection", bindKey: "esc", exec: function(editor) { editor.exitMultiSelectMode(); }, + scrollIntoView: "cursor", readonly: true, isAvailable: function(editor) {return editor && editor.inMultiSelectMode} }]; diff --git a/lib/ace/config.js b/lib/ace/config.js index f4e4c89a..94e9465f 100644 --- a/lib/ace/config.js +++ b/lib/ace/config.js @@ -80,11 +80,7 @@ exports.moduleUrl = function(name, component) { // todo make this configurable or get rid of '-' var sep = component == "snippets" ? "/" : "-"; - var base = parts[parts.length - 1]; - if (sep == "-") { - var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); - base = base.replace(re, ""); - } + var base = parts[parts.length - 1]; if ((!base || base == component) && parts.length > 1) base = parts[parts.length - 2]; diff --git a/lib/ace/config_test.js b/lib/ace/config_test.js index d09a2801..ac664fae 100644 --- a/lib/ace/config_test.js +++ b/lib/ace/config_test.js @@ -43,7 +43,7 @@ module.exports = { "test: path resolution" : function() { config.set("packaged", "true"); var url = config.moduleUrl("kr_theme", "theme"); - assert.equal(url, "theme-kr.js"); + assert.equal(url, "theme-kr_theme.js"); config.set("basePath", "a/b"); url = config.moduleUrl("m/theme", "theme"); diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index a2b7475e..35cdf57f 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -155,8 +155,8 @@ } .ace_text-input.ace_composition { - background: #f8f8f8; - color: #111; + background: inherit; + color: inherit; z-index: 1000; opacity: 1; text-indent: 0; diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index 9689ea5c..73a184fd 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -268,7 +268,7 @@ var EditSession = function(text, mode) { this.$informUndoManager.schedule(); } - this.bgTokenizer.$updateOnChange(delta); + this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta); this._signal("change", e); }; @@ -276,8 +276,6 @@ var EditSession = function(text, mode) { * Sets the session text. * @param {String} text The new text to place * - * - * **/ this.setValue = function(text) { this.doc.setValue(text); @@ -950,6 +948,9 @@ var EditSession = function(text, mode) { if (!$isPlaceholder) { + // experimental method, used by c9 findiniles + if (mode.attachToSession) + mode.attachToSession(this); this.$options.wrapMethod.set.call(this, this.$wrapMethod); this.$setFolding(mode.foldingRules); this.bgTokenizer.start(0); @@ -957,12 +958,11 @@ var EditSession = function(text, mode) { } }; - this.$stopWorker = function() { - if (this.$worker) + if (this.$worker) { this.$worker.terminate(); - - this.$worker = null; + this.$worker = null; + } }; this.$startWorker = function() { @@ -1731,9 +1731,10 @@ var EditSession = function(text, mode) { // Inside of the foldLine range. Need to split stuff up. if (cmp == 0) { foldLine = foldLine.split(start.row, start.column); - foldLine.shiftRow(len); - foldLine.addRemoveChars( - lastRow, 0, end.column - start.column); + if (foldLine) { + foldLine.shiftRow(len); + foldLine.addRemoveChars(lastRow, 0, end.column - start.column); + } } else // Infront of the foldLine but same row. Need to shift column. if (cmp == -1) { @@ -2400,7 +2401,15 @@ var EditSession = function(text, mode) { */ this.$setFontMetrics = function(fm) { // todo - } + }; + + this.destroy = function() { + if (this.bgTokenizer) { + this.bgTokenizer.setDocument(null); + this.bgTokenizer = null; + } + this.$stopWorker(); + }; // For every keystroke this gets called once per char in the whole doc!! // Wouldn't hurt to make it a bit faster for c >= 0x1100 diff --git a/lib/ace/edit_session/fold_line.js b/lib/ace/edit_session/fold_line.js index 0218195e..9d73154d 100644 --- a/lib/ace/edit_session/fold_line.js +++ b/lib/ace/edit_session/fold_line.js @@ -44,7 +44,7 @@ function FoldLine(foldData, folds) { folds = this.folds = [ folds ]; } - var last = folds[folds.length - 1] + var last = folds[folds.length - 1]; this.range = new Range(folds[0].start.row, folds[0].start.column, last.end.row, last.end.column); this.start = this.range.start; @@ -66,7 +66,7 @@ function FoldLine(foldData, folds) { fold.start.row += shift; fold.end.row += shift; }); - } + }; this.addFold = function(fold) { if (fold.sameRow) { @@ -96,17 +96,17 @@ function FoldLine(foldData, folds) { throw new Error("Trying to add fold to FoldRow that doesn't have a matching row"); } fold.foldLine = this; - } + }; this.containsRow = function(row) { return row >= this.start.row && row <= this.end.row; - } + }; this.walk = function(callback, endRow, endColumn) { var lastEnd = 0, folds = this.folds, fold, - comp, stop, isNewRow = true; + cmp, stop, isNewRow = true; if (endRow == null) { endRow = this.end.row; @@ -116,9 +116,9 @@ function FoldLine(foldData, folds) { for (var i = 0; i < folds.length; i++) { fold = folds[i]; - comp = fold.range.compareStart(endRow, endColumn); + cmp = fold.range.compareStart(endRow, endColumn); // This fold is after the endRow/Column. - if (comp == -1) { + if (cmp == -1) { callback(null, endRow, endColumn, lastEnd, isNewRow); return; } @@ -127,8 +127,8 @@ function FoldLine(foldData, folds) { stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd); // If the user requested to stop the walk or endRow/endColumn is - // inside of this fold (comp == 0), then end here. - if (stop || comp == 0) { + // inside of this fold (cmp == 0), then end here. + if (stop || cmp === 0) { return; } @@ -138,7 +138,7 @@ function FoldLine(foldData, folds) { lastEnd = fold.end.column; } callback(null, endRow, endColumn, lastEnd, isNewRow); - } + }; this.getNextFoldTo = function(row, column) { var fold, cmp; @@ -150,15 +150,15 @@ function FoldLine(foldData, folds) { fold: fold, kind: "after" }; - } else if (cmp == 0) { + } else if (cmp === 0) { return { fold: fold, kind: "inside" - } + }; } } return null; - } + }; this.addRemoveChars = function(row, column, len) { var ret = this.getNextFoldTo(row, column), @@ -175,7 +175,7 @@ function FoldLine(foldData, folds) { } else if (fold.start.row == row) { folds = this.folds; var i = folds.indexOf(fold); - if (i == 0) { + if (i === 0) { this.start.column += len; } for (i; i < folds.length; i++) { @@ -189,16 +189,18 @@ function FoldLine(foldData, folds) { this.end.column += len; } } - } + }; this.split = function(row, column) { - var fold = this.getNextFoldTo(row, column).fold; + var pos = this.getNextFoldTo(row, column); + + if (!pos || pos.kind == "inside") + return null; + + var fold = pos.fold; var folds = this.folds; var foldData = this.foldData; - - if (!fold) - return null; - + var i = folds.indexOf(fold); var foldBefore = folds[i - 1]; this.end.row = foldBefore.end.row; @@ -211,7 +213,7 @@ function FoldLine(foldData, folds) { var newFoldLine = new FoldLine(foldData, folds); foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine); return newFoldLine; - } + }; this.merge = function(foldLineNext) { var folds = foldLineNext.folds; @@ -222,7 +224,7 @@ function FoldLine(foldData, folds) { // it's merged now with foldLineNext. var foldData = this.foldData; foldData.splice(foldData.indexOf(foldLineNext), 1); - } + }; this.toString = function() { var ret = [this.range.toString() + ": [" ]; @@ -230,13 +232,12 @@ function FoldLine(foldData, folds) { this.folds.forEach(function(fold) { ret.push(" " + fold.toString()); }); - ret.push("]") + ret.push("]"); return ret.join("\n"); - } + }; this.idxToPosition = function(idx) { var lastFoldEndColumn = 0; - var fold; for (var i = 0; i < this.folds.length; i++) { var fold = this.folds[i]; @@ -261,7 +262,7 @@ function FoldLine(foldData, folds) { row: this.end.row, column: this.end.column + idx }; - } + }; }).call(FoldLine.prototype); exports.FoldLine = FoldLine; diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 83782f06..b0ad24ed 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -82,7 +82,6 @@ var Editor = function(renderer, session) { this.$mouseHandler = new MouseHandler(this); new FoldHandler(this); - this.$blockScrolling = 0; this.$search = new Search().set({ wrap: true }); @@ -94,7 +93,8 @@ var Editor = function(renderer, session) { this._$emitInputEvent = lang.delayedCall(function() { this._signal("input", {}); - this.session.bgTokenizer && this.session.bgTokenizer.scheduleStart(); + if (this.session && this.session.bgTokenizer) + this.session.bgTokenizer.scheduleStart(); }.bind(this)); this.on("change", function(_, _self) { @@ -183,7 +183,6 @@ var Editor = function(renderer, session) { if (this.curOp) { var command = this.curOp.command; if (command && command.scrollIntoView) { - this.$blockScrolling--; switch (command.scrollIntoView) { case "center": this.renderer.scrollCursorIntoView(null, 0.5); @@ -371,9 +370,7 @@ var Editor = function(renderer, session) { this.onChangeMode(); - this.$blockScrolling += 1; this.onCursorChange(); - this.$blockScrolling -= 1; this.onScrollTopChange(); this.onScrollLeftChange(); @@ -384,6 +381,9 @@ var Editor = function(renderer, session) { this.onChangeAnnotation(); this.session.getUseWrapMode() && this.renderer.adjustWrapLimit(); this.renderer.updateFull(); + } else { + this.selection = null; + this.renderer.setSession(session); } this._signal("changeSession", { @@ -525,25 +525,23 @@ var Editor = function(renderer, session) { this.$highlightPending = true; setTimeout(function() { self.$highlightPending = false; - - var pos = self.session.findMatchingBracket(self.getCursorPosition()); + var session = self.session; + if (!session || !session.bgTokenizer) return; + var pos = session.findMatchingBracket(self.getCursorPosition()); if (pos) { - var range = new Range(pos.row, pos.column, pos.row, pos.column+1); - } else if (self.session.$mode.getMatching) { - var range = self.session.$mode.getMatching(self.session); + var range = new Range(pos.row, pos.column, pos.row, pos.column + 1); + } else if (session.$mode.getMatching) { + var range = session.$mode.getMatching(self.session); } if (range) - self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text"); + session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text"); }, 50); }; // todo: move to mode.getMatching this.$highlightTags = function() { - var session = this.session; - - if (this.$highlightTagPending) { + if (this.$highlightTagPending) return; - } // perform highlight async to not block the browser during navigation var self = this; @@ -551,6 +549,9 @@ var Editor = function(renderer, session) { setTimeout(function() { self.$highlightTagPending = false; + var session = self.session; + if (!session || !session.bgTokenizer) return; + var pos = self.getCursorPosition(); var iterator = new TokenIterator(self.session, pos.row, pos.column); var token = iterator.getCurrentToken(); @@ -572,28 +573,28 @@ var Editor = function(renderer, session) { token = iterator.stepForward(); if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { - if (prevToken.value==='<'){ + if (prevToken.value === '<'){ depth++; - } else if (prevToken.value==='=0); - }else{ + } while (token && depth >= 0); + } else { //find opening tag do { token = prevToken; prevToken = iterator.stepBackward(); - if(token && token.value === tag && token.type.indexOf('tag-name') !== -1) { - if (prevToken.value==='<') { + if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { + if (prevToken.value === '<') { depth++; - } else if( prevToken.value===' ranges.length || lines.length < 2 || !lines[1]) + return this.commands.exec("insertstring", this, text); + + for (var i = ranges.length; i--;) { + var range = ranges[i]; + if (!range.isEmpty()) + this.session.remove(range); + + this.session.insert(range.start, lines[i]); + } + } + this.renderer.scrollCursorIntoView(); }; @@ -1831,7 +1847,6 @@ var Editor = function(renderer, session) { var config = this.renderer.layerConfig; var rows = dir * Math.floor(config.height / config.lineHeight); - this.$blockScrolling++; if (select === true) { this.selection.$moveSelection(function(){ this.moveCursorBy(rows, 0); @@ -1840,7 +1855,6 @@ var Editor = function(renderer, session) { this.selection.moveCursorBy(rows, 0); this.selection.clearSelection(); } - this.$blockScrolling--; var scrollTop = renderer.scrollTop; @@ -1965,9 +1979,7 @@ var Editor = function(renderer, session) { * @related Selection.selectAll **/ this.selectAll = function() { - this.$blockScrolling += 1; this.selection.selectAll(); - this.$blockScrolling -= 1; }; /** @@ -2005,17 +2017,13 @@ var Editor = function(renderer, session) { * Moves the cursor's row and column to the next matching bracket or HTML tag. * **/ - this.jumpToMatching = function(select) { + this.jumpToMatching = function(select, expand) { var cursor = this.getCursorPosition(); var iterator = new TokenIterator(this.session, cursor.row, cursor.column); var prevToken = iterator.getCurrentToken(); - var token = prevToken; + var token = prevToken || iterator.stepForward(); - if (!token) - token = iterator.stepForward(); - - if (!token) - return; + if (!token) return; //get next closing tag or bracket var matchType; @@ -2034,12 +2042,12 @@ var Editor = function(renderer, session) { do { if (token.value.match(/[{}()\[\]]/g)) { - for (; i 1)) - var column = util.getRightNthChar(editor, cursor, param, 2); + column = util.getRightNthChar(editor, cursor, param, 2); if (typeof column === "number") { cursor.column += column + (isSel ? 1 : 0); @@ -444,8 +444,8 @@ module.exports = { var cursor = editor.getCursorPosition(); var column = util.getLeftNthChar(editor, cursor, param, count || 1); - if (isRepeat && column == 0 && !(count > 1)) - var column = util.getLeftNthChar(editor, cursor, param, 2); + if (isRepeat && column === 0 && !(count > 1)) + column = util.getLeftNthChar(editor, cursor, param, 2); if (typeof column === "number") { cursor.column -= column; @@ -558,7 +558,7 @@ module.exports = { content += "\n"; if (content.length) { - editor.navigateLineEnd() + editor.navigateLineEnd(); editor.insert(content); util.insertMode(editor); } @@ -575,7 +575,7 @@ module.exports = { if (content.length) { if(row > 0) { editor.navigateUp(); - editor.navigateLineEnd() + editor.navigateLineEnd(); editor.insert(content); } else { editor.session.insert({row: 0, column: 0}, content); diff --git a/lib/ace/keyboard/vim/maps/operators.js b/lib/ace/keyboard/vim/maps/operators.js index 6df55b0f..b64ede1e 100644 --- a/lib/ace/keyboard/vim/maps/operators.js +++ b/lib/ace/keyboard/vim/maps/operators.js @@ -91,14 +91,12 @@ module.exports = { count = count || 1; switch (param) { case "c": - editor.$blockScrolling++; editor.selection.$moveSelection(function() { editor.selection.moveCursorBy(count - 1, 0); }); var rows = editor.$getSelectedRows(); range = new Range(rows.first, 0, rows.last, Infinity); editor.session.remove(range); - editor.$blockScrolling--; util.insertMode(editor); break; default: diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js index 7b206f61..13ee8a25 100644 --- a/lib/ace/layer/gutter.js +++ b/lib/ace/layer/gutter.js @@ -58,7 +58,8 @@ var Gutter = function(parentEl) { if (this.session) this.session.removeEventListener("change", this.$updateAnnotations); this.session = session; - session.on("change", this.$updateAnnotations); + if (session) + session.on("change", this.$updateAnnotations); }; this.addGutterDecoration = function(row, className){ diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index 748d2231..7c3aa053 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -95,7 +95,8 @@ var Text = function(parentEl) { }; this.setSession = function(session) { this.session = session; - this.$computeTabString(); + if (session) + this.$computeTabString(); }; this.showInvisibles = false; diff --git a/lib/ace/lib/dom.js b/lib/ace/lib/dom.js index b3724009..65f20d7d 100644 --- a/lib/ace/lib/dom.js +++ b/lib/ace/lib/dom.js @@ -49,7 +49,7 @@ exports.createElement = function(tag, ns) { }; exports.hasCssClass = function(el, name) { - var classes = el.className.split(/\s+/g); + var classes = (el.className || "").split(/\s+/g); return classes.indexOf(name) !== -1; }; diff --git a/lib/ace/mode/css/csslint.js b/lib/ace/mode/css/csslint.js index a3a7a9bd..c3c79a80 100644 --- a/lib/ace/mode/css/csslint.js +++ b/lib/ace/mode/css/csslint.js @@ -4,7 +4,7 @@ CSSLint Copyright (c) 2014 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal +of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is @@ -13,7 +13,7 @@ furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER @@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* Build: v0.10.0 31-March-2014 08:16:48 */ +/* Build: v0.10.0 22-July-2014 01:17:52 */ /*! Parser-Lib Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. @@ -46,11 +46,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* Version v0.2.4, Build time: 7-January-2014 07:32:49 */ +/* Version v0.2.5, Build time: 7-May-2014 03:37:38 */ var parserlib = {}; (function(){ - /** * A generic base to inherit from for any object * that needs event handling. @@ -506,7 +505,7 @@ SyntaxUnit.prototype = { * @method valueOf */ valueOf: function(){ - return this.toString(); + return this.text; }, /** @@ -921,8 +920,6 @@ TokenStreamBase.prototype = { }; - - parserlib.util = { StringReader: StringReader, SyntaxError : SyntaxError, @@ -931,8 +928,6 @@ EventTarget : EventTarget, TokenStreamBase : TokenStreamBase }; })(); - - /* Parser-Lib Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. @@ -956,7 +951,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* Version v0.2.4, Build time: 7-January-2014 07:32:49 */ +/* Version v0.2.5, Build time: 7-May-2014 03:37:38 */ (function(){ var EventTarget = parserlib.util.EventTarget, TokenStreamBase = parserlib.util.TokenStreamBase, @@ -964,7 +959,6 @@ StringReader = parserlib.util.StringReader, SyntaxError = parserlib.util.SyntaxError, SyntaxUnit = parserlib.util.SyntaxUnit; - var Colors = { aliceblue :"#f0f8ff", antiquewhite :"#faebd7", @@ -1182,7 +1176,6 @@ function Combinator(text, line, col){ Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; - /*global SyntaxUnit, Parser*/ /** * Represents a media feature, such as max-width:500. @@ -1215,7 +1208,6 @@ function MediaFeature(name, value){ MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; - /*global SyntaxUnit, Parser*/ /** * Represents an individual media query. @@ -1259,7 +1251,6 @@ function MediaQuery(modifier, mediaType, features, line, col){ MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; - /*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit, PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector, PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */ @@ -1521,7 +1512,7 @@ Parser.prototype = function(){ tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); //grab the URI value - uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); this._readWhitespace(); @@ -1626,8 +1617,10 @@ Parser.prototype = function(){ while(true) { if (tokenStream.peek() == Tokens.PAGE_SYM){ this._page(); - } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ + } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ this._font_face(); + } else if (tokenStream.peek() == Tokens.VIEWPORT_SYM){ + this._viewport(); } else if (!this._ruleset()){ break; } @@ -2823,7 +2816,7 @@ Parser.prototype = function(){ value = null, operator = null; - value = this._term(); + value = this._term(inFunction); if (value !== null){ values.push(value); @@ -2840,7 +2833,7 @@ Parser.prototype = function(){ valueParts = []; }*/ - value = this._term(); + value = this._term(inFunction); if (value === null){ break; @@ -2858,7 +2851,7 @@ Parser.prototype = function(){ return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, - _term: function(){ + _term: function(inFunction){ /* * term @@ -2872,6 +2865,7 @@ Parser.prototype = function(){ var tokenStream = this._tokenStream, unary = null, value = null, + endChar = null, token, line, col; @@ -2892,6 +2886,20 @@ Parser.prototype = function(){ col = tokenStream.token().startCol; } + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ + + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + //see if there's a simple match } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, Tokens.ANGLE, Tokens.TIME, @@ -3536,7 +3544,6 @@ nth ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* ; */ - /*global Validation, ValidationTypes, ValidationError*/ var Properties = { @@ -3553,6 +3560,7 @@ var Properties = { "animation-delay" : { multi: "