diff --git a/build b/build index c2f3abb2..6149ca6b 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit c2f3abb2ecd3287f90225d804132f0fd26cfb639 +Subproject commit 6149ca6b148e878d4c1341d4675ca3597d78dbdd diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index 1b63ee16..c3a7fc8e 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -242,6 +242,8 @@ -webkit-box-sizing: border-box; box-sizing: border-box; cursor: default; + white-space: pre-line; + word-wrap: break-word; } .ace_folding-enabled > .ace_gutter-cell { diff --git a/lib/ace/edit_session/folding.js b/lib/ace/edit_session/folding.js index db97cce7..7676150c 100644 --- a/lib/ace/edit_session/folding.js +++ b/lib/ace/edit_session/folding.js @@ -683,6 +683,7 @@ function Folding() { }; this.onFoldWidgetClick = function(row, e) { + e = e.domEvent; var type = this.getFoldWidget(row); var line = this.getLine(row); var onlySubfolds = e.shiftKey; diff --git a/lib/ace/keyboard/vim/commands.js b/lib/ace/keyboard/vim/commands.js index d802cdda..78dc4fa7 100644 --- a/lib/ace/keyboard/vim/commands.js +++ b/lib/ace/keyboard/vim/commands.js @@ -304,76 +304,76 @@ var inputBuffer = exports.inputBuffer = { lastInsertCommands: [], - push: function(editor, char, keyId) { + push: function(editor, ch, keyId) { this.idle = false; var wObj = this.waitingForParam; if (wObj) { - this.exec(editor, wObj, char); + this.exec(editor, wObj, ch); } // If input is a number (that doesn't start with 0) - else if (!(char === "0" && !this.currentCount.length) && - (char.match(/^\d+$/) && this.isAccepting(NUMBER))) { - // Assuming that char is always of type String, and not Number - this.currentCount += char; + else if (!(ch === "0" && !this.currentCount.length) && + (ch.match(/^\d+$/) && this.isAccepting(NUMBER))) { + // Assuming that ch is always of type String, and not Number + this.currentCount += ch; this.currentCmd = NUMBER; this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; } - else if (!this.operator && this.isAccepting(OPERATOR) && operators[char]) { + else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) { this.operator = { - char: char, + ch: ch, count: this.getCount() }; this.currentCmd = OPERATOR; this.accepting = [NUMBER, MOTION, ACTION]; this.exec(editor, { operator: this.operator }); } - else if (motions[char] && this.isAccepting(MOTION)) { + else if (motions[ch] && this.isAccepting(MOTION)) { this.currentCmd = MOTION; var ctx = { operator: this.operator, motion: { - char: char, + ch: ch, count: this.getCount() } }; - if (motions[char].param) + if (motions[ch].param) this.waitForParam(ctx); else this.exec(editor, ctx); } - else if (alias[char] && this.isAccepting(MOTION)) { - alias[char].operator.count = this.getCount(); - this.exec(editor, alias[char]); + else if (alias[ch] && this.isAccepting(MOTION)) { + alias[ch].operator.count = this.getCount(); + this.exec(editor, alias[ch]); } - else if (actions[char] && this.isAccepting(ACTION)) { + else if (actions[ch] && this.isAccepting(ACTION)) { var actionObj = { action: { - fn: actions[char].fn, + fn: actions[ch].fn, count: this.getCount() } }; - if (actions[char].param) { + if (actions[ch].param) { this.waitForParam(actionObj); } else { this.exec(editor, actionObj); } - if (actions[char].acceptsMotion) + if (actions[ch].acceptsMotion) this.idle = false; } else if (this.operator) { - this.exec(editor, { operator: this.operator }, char); + this.exec(editor, { operator: this.operator }, ch); } else { this.reset(); } if (this.waitingForParam || this.motion || this.operator) { - this.status += char; + this.status += ch; } else if (this.currentCount) { this.status = this.currentCount; } else if (this.status) { @@ -410,18 +410,18 @@ var inputBuffer = exports.inputBuffer = { } if (o && !editor.selection.isEmpty()) { - if (operators[o.char].selFn) { - operators[o.char].selFn(editor, editor.getSelectionRange(), o.count, param); + if (operators[o.ch].selFn) { + operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param); this.reset(); } return; } // There is an operator, but no motion or action. We try to pass the - // current char to the operator to see if it responds to it (an example + // current ch to the operator to see if it responds to it (an example // of this is the 'dd' operator). else if (!m && !a && o && param) { - operators[o.char].fn(editor, null, o.count, param); + operators[o.ch].fn(editor, null, o.count, param); this.reset(); } else if (m) { @@ -434,7 +434,7 @@ var inputBuffer = exports.inputBuffer = { } }; - var motionObj = motions[m.char]; + var motionObj = motions[m.ch]; var selectable = motionObj.sel; if (!o) { @@ -446,7 +446,7 @@ var inputBuffer = exports.inputBuffer = { else if (selectable) { repeat(function() { run(motionObj.sel); - operators[o.char].fn(editor, editor.getSelectionRange(), o.count, param); + operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param); }, o.count || 1); } this.reset(); diff --git a/lib/ace/keyboard/vim/maps/aliases.js b/lib/ace/keyboard/vim/maps/aliases.js index ea5dbe0d..1a5f32f7 100644 --- a/lib/ace/keyboard/vim/maps/aliases.js +++ b/lib/ace/keyboard/vim/maps/aliases.js @@ -34,57 +34,57 @@ define(function(require, exports, module) { module.exports = { "x": { operator: { - char: "d", + ch: "d", count: 1 }, motion: { - char: "l", + ch: "l", count: 1 } }, "X": { operator: { - char: "d", + ch: "d", count: 1 }, motion: { - char: "h", + ch: "h", count: 1 } }, "D": { operator: { - char: "d", + ch: "d", count: 1 }, motion: { - char: "$", + ch: "$", count: 1 } }, "C": { operator: { - char: "c", + ch: "c", count: 1 }, motion: { - char: "$", + ch: "$", count: 1 } }, "s": { operator: { - char: "c", + ch: "c", count: 1 }, motion: { - char: "l", + ch: "l", count: 1 } }, "S": { operator: { - char: "c", + ch: "c", count: 1 }, param: "c" diff --git a/lib/ace/keyboard/vim/maps/motions.js b/lib/ace/keyboard/vim/maps/motions.js index 227862b9..49b68d86 100644 --- a/lib/ace/keyboard/vim/maps/motions.js +++ b/lib/ace/keyboard/vim/maps/motions.js @@ -580,7 +580,7 @@ module.exports = { sel: function(editor, range, count, param) { keepScrollPosition(editor, editor.selectPageUp); } - }, + } }; module.exports.backspace = module.exports.left = module.exports.h; diff --git a/lib/ace/keyboard/vim/maps/util.js b/lib/ace/keyboard/vim/maps/util.js index 1d5a7639..af0e07c7 100644 --- a/lib/ace/keyboard/vim/maps/util.js +++ b/lib/ace/keyboard/vim/maps/util.js @@ -99,24 +99,24 @@ module.exports = { this.onVisualLineMode = false; } }, - getRightNthChar: function(editor, cursor, char, n) { + getRightNthChar: function(editor, cursor, ch, n) { var line = editor.getSession().getLine(cursor.row); - var matches = line.substr(cursor.column + 1).split(char); + var matches = line.substr(cursor.column + 1).split(ch); - return n < matches.length ? matches.slice(0, n).join(char).length : null; + return n < matches.length ? matches.slice(0, n).join(ch).length : null; }, - getLeftNthChar: function(editor, cursor, char, n) { + getLeftNthChar: function(editor, cursor, ch, n) { var line = editor.getSession().getLine(cursor.row); - var matches = line.substr(0, cursor.column).split(char); + var matches = line.substr(0, cursor.column).split(ch); - return n < matches.length ? matches.slice(-1 * n).join(char).length : null; + return n < matches.length ? matches.slice(-1 * n).join(ch).length : null; }, - toRealChar: function(char) { - if (char.length === 1) - return char; + toRealChar: function(ch) { + if (ch.length === 1) + return ch; - if (/^shift-./.test(char)) - return char[char.length - 1].toUpperCase(); + if (/^shift-./.test(ch)) + return ch[ch.length - 1].toUpperCase(); else return ""; }, diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js index 558cd026..99fec7b6 100644 --- a/lib/ace/layer/gutter.js +++ b/lib/ace/layer/gutter.js @@ -33,6 +33,7 @@ define(function(require, exports, module) { var dom = require("../lib/dom"); var oop = require("../lib/oop"); +var lang = require("../lib/lang"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var Gutter = function(parentEl) { @@ -78,12 +79,15 @@ var Gutter = function(parentEl) { var annotation = annotations[i]; var row = annotation.row; var rowInfo = this.$annotations[row]; - if (!rowInfo) { + if (!rowInfo) rowInfo = this.$annotations[row] = {text: []}; - } - var annoText = annotation.text.replace(/"/g, """).replace(/'/g, "’").replace(/" }, { token : "meta.tag", - regex : "<(?=\s*script\\b)", + regex : "<(?=script\\b)", next : "script" }, { token : "meta.tag", - regex : "<(?=\s*style\\b)", + regex : "<(?=style\\b)", next : "style" }, { token : "meta.tag", // opening tag diff --git a/lib/ace/mode/jade_highlight_rules.js b/lib/ace/mode/jade_highlight_rules.js index 41042038..4f75b77f 100644 --- a/lib/ace/mode/jade_highlight_rules.js +++ b/lib/ace/mode/jade_highlight_rules.js @@ -82,7 +82,7 @@ var JadeHighlightRules = function() { }, { "token" : "punctuation.section.comment", - "regex" : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)", + "regex" : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)" }, { "token" : function(space, text) { diff --git a/lib/ace/mode/java_highlight_rules.js b/lib/ace/mode/java_highlight_rules.js index a37f9586..ab05fbde 100644 --- a/lib/ace/mode/java_highlight_rules.js +++ b/lib/ace/mode/java_highlight_rules.js @@ -55,8 +55,7 @@ var JavaHighlightRules = function() { "variable.language": "this", "keyword": keywords, "constant.language": buildinConstants, - "support.function": langClasses, - + "support.function": langClasses }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js index 3d35c075..bd6f020c 100644 --- a/lib/ace/mode/javascript_highlight_rules.js +++ b/lib/ace/mode/javascript_highlight_rules.js @@ -52,7 +52,7 @@ var JavaScriptHighlightRules = function() { "invalid.deprecated": "__parent__|__count__|escape|unescape|with|__proto__", "keyword": - "const|yield|import|get|set" + + "const|yield|import|get|set|" + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger", "storage.type": @@ -286,7 +286,7 @@ var JavaScriptHighlightRules = function() { merge: true }, { token: "constant.language.escape", - regex: "-", + regex: "-" }, { token: "string.regexp.charachterclass", regex: /[^\]\-\\]+/, diff --git a/lib/ace/mode/javascript_worker.js b/lib/ace/mode/javascript_worker.js index 7e101281..27baa09f 100644 --- a/lib/ace/mode/javascript_worker.js +++ b/lib/ace/mode/javascript_worker.js @@ -143,6 +143,8 @@ oop.inherits(JavaScriptWorker, Mirror); if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) { error.reason = 'Missing ";" before statement'; type = "error"; + } else { + type = "info"; } } else if (disabledWarningsRe.test(raw)) { diff --git a/lib/ace/mode/latex_highlight_rules.js b/lib/ace/mode/latex_highlight_rules.js index e07024cb..3057c0de 100644 --- a/lib/ace/mode/latex_highlight_rules.js +++ b/lib/ace/mode/latex_highlight_rules.js @@ -9,7 +9,7 @@ var LatexHighlightRules = function() { "start" : [{ // A tex command e.g. \foo token : "keyword", - regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)", + regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)" }, { // Curly and square braces token : "lparen", diff --git a/lib/ace/mode/lua.js b/lib/ace/mode/lua.js index a8aefdba..efb3ffd1 100644 --- a/lib/ace/mode/lua.js +++ b/lib/ace/mode/lua.js @@ -51,7 +51,7 @@ oop.inherits(Mode, TextMode); "elseif": 1, "repeat": 1, "end": -1, - "until": -1, + "until": -1 }; var outdentKeywords = [ "else", diff --git a/lib/ace/mode/pgsql_highlight_rules.js b/lib/ace/mode/pgsql_highlight_rules.js index 5d167d93..c0a37cc2 100755 --- a/lib/ace/mode/pgsql_highlight_rules.js +++ b/lib/ace/mode/pgsql_highlight_rules.js @@ -404,7 +404,7 @@ var PgsqlHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, - "keyword": keywords, + "keyword": keywords }, "identifier", true); diff --git a/lib/ace/mode/php.js b/lib/ace/mode/php.js index 4ad75de4..aeea09c6 100644 --- a/lib/ace/mode/php.js +++ b/lib/ace/mode/php.js @@ -39,6 +39,7 @@ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutd var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; +var unicode = require("../unicode"); var Mode = function() { this.$tokenizer = new Tokenizer(new PhpHighlightRules().getRules()); @@ -50,6 +51,20 @@ oop.inherits(Mode, TextMode); (function() { + this.tokenRe = new RegExp("^[" + + unicode.packages.L + + unicode.packages.Mn + unicode.packages.Mc + + unicode.packages.Nd + + unicode.packages.Pc + "\_]+", "g" + ); + + this.nonTokenRe = new RegExp("^(?:[^" + + unicode.packages.L + + unicode.packages.Mn + unicode.packages.Mc + + unicode.packages.Nd + + unicode.packages.Pc + "\_]|\s])+", "g" + ); + this.toggleCommentLines = function(state, doc, startRow, endRow) { var outdent = true; var re = /^(\s*)#/; diff --git a/lib/ace/mode/ruby_highlight_rules.js b/lib/ace/mode/ruby_highlight_rules.js index 168657ac..d7a531f8 100644 --- a/lib/ace/mode/ruby_highlight_rules.js +++ b/lib/ace/mode/ruby_highlight_rules.js @@ -122,11 +122,11 @@ var RubyHighlightRules = function() { token : "text", // namespaces aren't symbols regex : "::" }, { - token : "variable.instancce", // instance variable - regex : "@{1,2}(?:[a-zA-Z_]|\d)+" + token : "variable.instance", // instance variable + regex : "@{1,2}[a-zA-Z_\\d]+" }, { token : "variable.class", // class name - regex : "[A-Z](?:[a-zA-Z_]|\d)+" + regex : "[A-Z][a-zA-Z_\\d]+" }, { token : "string", // symbol regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?" diff --git a/lib/ace/mode/scad_highlight_rules.js b/lib/ace/mode/scad_highlight_rules.js index 3bf4bf3a..6b98b283 100644 --- a/lib/ace/mode/scad_highlight_rules.js +++ b/lib/ace/mode/scad_highlight_rules.js @@ -40,7 +40,7 @@ var scadHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": "module|if|else|for", - "constant.language": "NULL", + "constant.language": "NULL" }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. diff --git a/lib/ace/mode/scala_highlight_rules.js b/lib/ace/mode/scala_highlight_rules.js index 2b905256..1277209f 100644 --- a/lib/ace/mode/scala_highlight_rules.js +++ b/lib/ace/mode/scala_highlight_rules.js @@ -126,7 +126,7 @@ var ScalaHighlightRules = function() { "string" : [ { token : "escape", - regex : '\\\\"', + regex : '\\\\"' }, { token : "string", merge : true, diff --git a/lib/ace/mode/sh_highlight_rules.js b/lib/ace/mode/sh_highlight_rules.js index d7e3185d..ebb9631a 100644 --- a/lib/ace/mode/sh_highlight_rules.js +++ b/lib/ace/mode/sh_highlight_rules.js @@ -92,7 +92,7 @@ var ShHighlightRules = function() { regex : variable }, { token : "support.function", - regex : func, + regex : func }, { token : "support.function", regex : fileDescriptor diff --git a/lib/ace/mode/svg_highlight_rules.js b/lib/ace/mode/svg_highlight_rules.js index 3d6d4161..ff03a8d3 100644 --- a/lib/ace/mode/svg_highlight_rules.js +++ b/lib/ace/mode/svg_highlight_rules.js @@ -41,7 +41,7 @@ var SvgHighlightRules = function() { this.$rules.start.splice(3, 0, { token : "meta.tag", - regex : "<(?=\s*script)", + regex : "<(?=script)", next : "script" }); diff --git a/lib/ace/mode/tcl_highlight_rules.js b/lib/ace/mode/tcl_highlight_rules.js index 5eda35be..25d72f2b 100644 --- a/lib/ace/mode/tcl_highlight_rules.js +++ b/lib/ace/mode/tcl_highlight_rules.js @@ -150,16 +150,16 @@ var TclHighlightRules = function() { }], "variable" : [ { - token : "variable.instancce", // variable xotcl with braces - regex : "(?:[:][:])?(?:[a-zA-Z_]|\d)+(?:(?:[:][:])?(?:[a-zA-Z_]|\d)+)?(?:[(](?:[a-zA-Z_]|\d)+[)])?", + token : "variable.instance", // variable xotcl with braces + regex : "(?:[:][:])?[a-zA-Z_\\d]+(?:(?:[:][:])?[a-zA-Z_\\d]+)?(?:[(][a-zA-Z_\\d]+[)])?", next : "start" }, { - token : "variable.instancce", // variable tcl - regex : "(?:[a-zA-Z_]|\d)+(?:[(](?:[a-zA-Z_]|\d)+[)])?", + token : "variable.instance", // variable tcl + regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?", next : "start" }, { - token : "variable.instancce", // variable tcl with braces - regex : "{?(?:[a-zA-Z_]|\d)+}?", + token : "variable.instance", // variable tcl with braces + regex : "{?[a-zA-Z_\\d]+}?", next : "start" }], "qqstring" : [ { diff --git a/lib/ace/search_test.js b/lib/ace/search_test.js index 942c1ec6..73d5e258 100644 --- a/lib/ace/search_test.js +++ b/lib/ace/search_test.js @@ -43,7 +43,7 @@ module.exports = { "test: configure the search object" : function() { var search = new Search(); search.set({ - needle: "juhu", + needle: "juhu" }); }, @@ -397,7 +397,7 @@ module.exports = { var search = new Search().set({ needle: "[ ]+$", regExp: true, - wrap: true, + wrap: true }); session.getSelection().moveCursorTo(1, 2); @@ -414,7 +414,7 @@ module.exports = { var search = new Search().set({ needle: "foo", wrap: true, - wholeWord: true, + wholeWord: true }); session.getSelection().moveCursorTo(0, 4); @@ -437,7 +437,7 @@ module.exports = { needle: "foo", wrap: true, wholeWord: true, - backwards: true, + backwards: true }); session.getSelection().moveCursorTo(0, 13); diff --git a/lib/ace/token_iterator_test.js b/lib/ace/token_iterator_test.js index 1b8a3b99..c7202e84 100644 --- a/lib/ace/token_iterator_test.js +++ b/lib/ace/token_iterator_test.js @@ -202,7 +202,7 @@ module.exports = { assert.equal(iterator.getCurrentToken().value, "for"); assert.equal(iterator.getCurrentTokenRow(), 1); assert.equal(iterator.getCurrentTokenColumn(), 4); - }, + } }; }); diff --git a/lib/ace/tokenizer_dev.js b/lib/ace/tokenizer_dev.js index 1972890f..53d6ea57 100644 --- a/lib/ace/tokenizer_dev.js +++ b/lib/ace/tokenizer_dev.js @@ -103,7 +103,7 @@ var Tokenizer = function(rules, flag) { var token = { type: null, value: "", - state: currentState, + state: currentState }; initState(); diff --git a/lib/ace/worker/worker.js b/lib/ace/worker/worker.js index 0e7270a3..faf5624e 100644 --- a/lib/ace/worker/worker.js +++ b/lib/ace/worker/worker.js @@ -1,8 +1,13 @@ "no use strict"; var console = { - log: function(msgs) { - postMessage({type: "log", data: arguments.join(" ")}); + log: function() { + var msgs = Array.prototype.slice.call(arguments, 0); + postMessage({type: "log", data: msgs}); + }, + error: function() { + var msgs = Array.prototype.slice.call(arguments, 0); + postMessage({type: "log", data: msgs}); } }; var window = { diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js index 79169ea4..d3b9c3c8 100644 --- a/lib/ace/worker/worker_client.js +++ b/lib/ace/worker/worker_client.js @@ -84,7 +84,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname) { var msg = e.data; switch(msg.type) { case "log": - window.console && console.log && console.log(msg.data); + window.console && console.log && console.log.apply(console, msg.data); break; case "event":