diff --git a/codemirror/AUTHORS b/codemirror/AUTHORS index 280dea2..1264357 100644 --- a/codemirror/AUTHORS +++ b/codemirror/AUTHORS @@ -68,6 +68,7 @@ Anthony Grimes Anton Kovalyov Apollo Zhu AQNOUCH Mohammed +Aram Shatakhtsyan areos Arnab Bose Arsène von Wyss @@ -155,6 +156,7 @@ Daniel Kesler Daniel KJ Daniel Neel Daniel Parnell +Daniel Thwaites Danila Malyutin Danny Yoo darealshinji @@ -213,7 +215,9 @@ ForbesLindesay Forbes Lindesay Ford_Lawnmower Forrest Oliphant +Franco Catena Frank Wiegand +Fredrik Borg Gabriel Gheorghian Gabriel Horner Gabriel Nahmias @@ -255,6 +259,7 @@ hitsthings Hocdoc Hugues Malphettes Ian Beck +Ian Davies Ian Dickinson Ian Wehrman Ian Wetherbee @@ -376,6 +381,7 @@ LloydMilligan LM lochel Lorenzo Stoakes +Louis Mauchet Luca Fabbri Luciano Longo Lu Fangjian @@ -660,6 +666,7 @@ Weiyan Shao wenli Wes Cossick Wesley Wiser +Weston Ruter Will Binns-Smith Will Dean William Jamieson diff --git a/codemirror/CHANGELOG.md b/codemirror/CHANGELOG.md index 6cc7ed7..ff7d6e2 100644 --- a/codemirror/CHANGELOG.md +++ b/codemirror/CHANGELOG.md @@ -1,3 +1,27 @@ +## 5.30.0 (2017-09-20) + +### Bug fixes + +Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text. + +[search addon](http://codemirror.net/demo/search/): Fix crash when restarting search after doing empty search. + +[mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug. + +[tern addon](http://codemirror.net/demo/tern.html): Fix bad request made when editing at the bottom of a large document. + +[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing in a number of corner cases. + +[markdown mode](http://codemirror.net/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists. + +[gfm mode](http://codemirror.net/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives. + +[soy mode](http://codemirror.net/mode/soy/): Support injected data and `@param` in comments. + +### New features + +[simple mode addon](http://codemirror.net/demo/simplemode.html): Allow groups in regexps when `token` isn't an array. + ## 5.29.0 (2017-08-24) ### Bug fixes @@ -54,7 +78,7 @@ Fix crash when using mode lookahead. ### Bug fixes -Fix crash in the [simple mode](http://codemirror.net/demo/simplemode.html) addon. +Fix crash in the [simple mode](http://codemirror.net/demo/simplemode.html)< addon. ## 5.27.0 (2017-06-22) diff --git a/codemirror/README.md b/codemirror/README.md index 3328e3b..a3a351b 100644 --- a/codemirror/README.md +++ b/codemirror/README.md @@ -7,7 +7,8 @@ CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with over 100 language modes and various addons that implement more advanced -editing functionality. +editing functionality. Every language comes with fully-featured code +and syntax highlighting to help with reading and editing complex code. A rich programming API and a CSS theming system are available for customizing CodeMirror to fit your application, and extending it with diff --git a/codemirror/addon/edit/closebrackets.js b/codemirror/addon/edit/closebrackets.js index 01fdd96..36aec0d 100644 --- a/codemirror/addon/edit/closebrackets.js +++ b/codemirror/addon/edit/closebrackets.js @@ -23,6 +23,7 @@ cm.state.closeBrackets = null; } if (val) { + ensureBound(getOption(val, "pairs")) cm.state.closeBrackets = val; cm.addKeyMap(keyMap); } @@ -34,10 +35,14 @@ return defaults[name]; } - var bind = defaults.pairs + "`"; var keyMap = {Backspace: handleBackspace, Enter: handleEnter}; - for (var i = 0; i < bind.length; i++) - keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i)); + function ensureBound(chars) { + for (var i = 0; i < chars.length; i++) { + var ch = chars.charAt(i), key = "'" + ch + "'" + if (!keyMap[key]) keyMap[key] = handler(ch) + } + } + ensureBound(defaults.pairs + "`") function handler(ch) { return function(cm) { return handleChar(cm, ch); }; diff --git a/codemirror/addon/hint/show-hint.js b/codemirror/addon/hint/show-hint.js index 604bd3b..f72a0a9 100644 --- a/codemirror/addon/hint/show-hint.js +++ b/codemirror/addon/hint/show-hint.js @@ -302,7 +302,7 @@ setTimeout(function(){cm.focus();}, 20); }); - CodeMirror.signal(data, "select", completions[0], hints.firstChild); + CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]); return true; } diff --git a/codemirror/addon/lint/css-lint.js b/codemirror/addon/lint/css-lint.js index b7e1a4f..135d031 100644 --- a/codemirror/addon/lint/css-lint.js +++ b/codemirror/addon/lint/css-lint.js @@ -15,7 +15,7 @@ })(function(CodeMirror) { "use strict"; -CodeMirror.registerHelper("lint", "css", function(text) { +CodeMirror.registerHelper("lint", "css", function(text, options) { var found = []; if (!window.CSSLint) { if (window.console) { @@ -23,7 +23,7 @@ CodeMirror.registerHelper("lint", "css", function(text) { } return found; } - var results = CSSLint.verify(text), messages = results.messages, message = null; + var results = CSSLint.verify(text, options), messages = results.messages, message = null; for ( var i = 0; i < messages.length; i++) { message = messages[i]; var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; diff --git a/codemirror/addon/lint/lint.js b/codemirror/addon/lint/lint.js index 825065e..a9eb8fa 100644 --- a/codemirror/addon/lint/lint.js +++ b/codemirror/addon/lint/lint.js @@ -138,7 +138,11 @@ function startLinting(cm) { var state = cm.state.lint, options = state.options; - var passOptions = options.options || options; // Support deprecated passing of `options` property in options + /* + * Passing rules in `options` property prevents JSHint (and other linters) from complaining + * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. + */ + var passOptions = options.options || options; var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); if (!getAnnotations) return; if (options.async || getAnnotations.async) { diff --git a/codemirror/addon/mode/simple.js b/codemirror/addon/mode/simple.js index 15cc215..c0f8010 100644 --- a/codemirror/addon/mode/simple.js +++ b/codemirror/addon/mode/simple.js @@ -136,7 +136,7 @@ state.indent.pop(); var token = rule.token if (token && token.apply) token = token(matches) - if (matches.length > 2) { + if (matches.length > 2 && rule.token && typeof rule.token != "string") { state.pending = []; for (var j = 2; j < matches.length; j++) if (matches[j]) diff --git a/codemirror/addon/search/search.js b/codemirror/addon/search/search.js index 82938b9..4059ccd 100644 --- a/codemirror/addon/search/search.js +++ b/codemirror/addon/search/search.js @@ -117,6 +117,7 @@ var state = getSearchState(cm); if (state.query) return findNext(cm, rev); var q = cm.getSelection() || state.lastQuery; + if (q instanceof RegExp && q.source == "x^") q = null if (persistent && cm.openDialog) { var hiding = null var searchNext = function(query, event) { diff --git a/codemirror/addon/selection/mark-selection.js b/codemirror/addon/selection/mark-selection.js index 6cceeae..1602acc 100644 --- a/codemirror/addon/selection/mark-selection.js +++ b/codemirror/addon/selection/mark-selection.js @@ -86,7 +86,7 @@ if (!array.length) return coverRange(cm, from, to); var coverStart = array[0].find(), coverEnd = array[array.length - 1].find(); - if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE || + if (!coverStart || !coverEnd || to.line - from.line <= CHUNK_SIZE || cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0) return reset(cm); diff --git a/codemirror/addon/tern/tern.js b/codemirror/addon/tern/tern.js index 644e495..a80dc7e 100644 --- a/codemirror/addon/tern/tern.js +++ b/codemirror/addon/tern/tern.js @@ -571,7 +571,7 @@ return {type: "part", name: data.name, offsetLines: from.line, - text: doc.getRange(from, Pos(endLine, 0))}; + text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))}; } // Generic utilities diff --git a/codemirror/demo/simplemode.html b/codemirror/demo/simplemode.html index d719b63..04c194a 100644 --- a/codemirror/demo/simplemode.html +++ b/codemirror/demo/simplemode.html @@ -65,15 +65,14 @@

Simple Mode Demo

The regular expression that matches the token. May be a string or a regex object. When a regex, the ignoreCase flag will be taken into account when matching the token. This regex - should only capture groups when the token property is - an array.
-
token: string | null
+ has to capture groups when the token property is + an array. If it captures groups, it must capture all of the string + (since JS provides no way to find out where a group matched). +
token: string | array<string> | null
An optional token style. Multiple styles can be specified by - separating them with dots or spaces. When the regex for - this rule captures groups, it must capture all of the - string (since JS provides no way to find out where a group matched), - and this property must hold an array of token styles that has one - style for each matched group.
+ separating them with dots or spaces. When this property holds an array of token styles, + the regex for this rule must capture a group for each array item. +
sol: boolean
When true, this token will only match at the start of the line. (The ^ regexp marker doesn't work as you'd expect in diff --git a/codemirror/doc/manual.html b/codemirror/doc/manual.html index 866367a..67d5e42 100644 --- a/codemirror/doc/manual.html +++ b/codemirror/doc/manual.html @@ -69,7 +69,7 @@

User manual and reference guide - version 5.29.0 + version 5.30.0

CodeMirror is a code-editor component that can be embedded in @@ -2229,6 +2229,9 @@

Static properties

various event handlers). The returned position will be the end of the changed range, after the change is applied.
+ +
CodeMirror.countColumn(line: string, index: number, tabSize: number) → number
+
Find the column position at a given string index using a given tabsize.
diff --git a/codemirror/doc/realworld.html b/codemirror/doc/realworld.html index 7c5231b..f0a75ab 100644 --- a/codemirror/doc/realworld.html +++ b/codemirror/doc/realworld.html @@ -45,6 +45,7 @@

CodeMirror real-world uses

  • Code per Node (Drupal module)
  • CodeBitt (Code snippet sharing)
  • Codebug (PHP Xdebug front-end)
  • +
  • CodeFights (practice programming)
  • CodeMirror Eclipse (embed CM in Eclipse)
  • CodeMirror movie (scripted editing demos)
  • CodeMirror2-GWT (Google Web Toolkit wrapper)
  • diff --git a/codemirror/doc/releases.html b/codemirror/doc/releases.html index 586e211..e16ab6d 100644 --- a/codemirror/doc/releases.html +++ b/codemirror/doc/releases.html @@ -30,6 +30,20 @@

    Release notes and version history

    Version 5.x

    +

    20-09-2017: Version 5.30.0:

    + + +

    24-08-2017: Version 5.29.0: