Skip to content

Commit

Permalink
Merge commit 'f936d89e4a2aa68eee964f57d14f875ee1d71ff4'
Browse files Browse the repository at this point in the history
  • Loading branch information
a60814billy committed Nov 21, 2017
2 parents 58ca50c + f936d89 commit a0a90f5
Show file tree
Hide file tree
Showing 58 changed files with 901 additions and 278 deletions.
17 changes: 16 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Andreas Reischuck
Andres Taylor
Andre von Houck
Andrew Cheng
Andrew Dassonville
Andrey Fedorov
Andrey Klyuchnikov
Andrey Lushnikov
Expand All @@ -68,6 +69,7 @@ Anthony Grimes
Anton Kovalyov
Apollo Zhu
AQNOUCH Mohammed
Aram Shatakhtsyan
areos
Arnab Bose
Arsène von Wyss
Expand Down Expand Up @@ -155,6 +157,7 @@ Daniel Kesler
Daniel KJ
Daniel Neel
Daniel Parnell
Daniel Thwaites
Danila Malyutin
Danny Yoo
darealshinji
Expand Down Expand Up @@ -213,7 +216,9 @@ ForbesLindesay
Forbes Lindesay
Ford_Lawnmower
Forrest Oliphant
Franco Catena
Frank Wiegand
Fredrik Borg
Gabriel Gheorghian
Gabriel Horner
Gabriel Nahmias
Expand All @@ -238,6 +243,7 @@ Grant Skinner
greengiant
Gregory Koberger
Grzegorz Mazur
Guan Gui
Guillaume Massé
Guillaume Massé
guraga
Expand All @@ -249,12 +255,14 @@ Harshvardhan Gupta
Hasan Karahan
Hector Oswaldo Caballero
Hendrik Wallbaum
Henrik Haugbølle
Herculano Campos
Hiroyuki Makino
hitsthings
Hocdoc
Hugues Malphettes
Ian Beck
Ian Davies
Ian Dickinson
Ian Wehrman
Ian Wetherbee
Expand Down Expand Up @@ -303,6 +311,7 @@ jem (graphite)
Jeremy Parmenter
Jim
Jim Avery
jkaplon
JobJob
jochenberger
Jochen Berger
Expand Down Expand Up @@ -336,6 +345,7 @@ ju1ius
Juan Benavides Romero
Jucovschi Constantin
Juho Vuori
Julien CROUZET
Julien Rebetez
Justin Andresen
Justin Hileman
Expand Down Expand Up @@ -376,6 +386,7 @@ LloydMilligan
LM
lochel
Lorenzo Stoakes
Louis Mauchet
Luca Fabbri
Luciano Longo
Lu Fangjian
Expand Down Expand Up @@ -405,6 +416,7 @@ Mark Lentczner
Marko Bonaci
Mark Peace
Markus Bordihn
Markus Olsson
Martin Balek
Martín Gaitán
Martin Hasoň
Expand Down Expand Up @@ -522,8 +534,8 @@ peterkroon
Peter Kroon
Philipp A
Philip Stadermann
Pi Delport
Pierre Gerold
Piët Delport
Pieter Ouwerkerk
Pontus Melke
prasanthj
Expand Down Expand Up @@ -627,6 +639,7 @@ thanasis
TheHowl
themrmax
think
Thomas Brouard
Thomas Dvornik
Thomas Kluyver
Thomas Schmid
Expand Down Expand Up @@ -656,10 +669,12 @@ vf
Victor Bocharsky
Vincent Woo
Volker Mische
vtripolitakis
Weiyan Shao
wenli
Wes Cossick
Wesley Wiser
Weston Ruter
Will Binns-Smith
Will Dean
William Jamieson
Expand Down
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## 5.31.0 (2017-10-20)

### Bug fixes

Further improve selection drawing and cursor motion in right-to-left documents.

[vim bindings](http://codemirror.net/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](http://codemirror.net/doc/manual.html#option_contentEditable).

[continuecomment addon](http://codemirror.net/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.

[markdown mode](http://codemirror.net/mode/markdown/): Fix issue with leaving indented fenced code blocks.

[javascript mode](http://codemirror.net/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.

### New features

Modes added with [`addOverlay`](http://codemirror.net/doc/manual.html#addOverlay) now have access to a [`baseToken`](http://codemirror.net/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.

## 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
Expand Down Expand Up @@ -54,7 +96,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)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions addon/comment/continuecomment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
var modes = ["clike", "css", "javascript"];

for (var i = 0; i < modes.length; ++i)
CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});

function continueComment(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), mode, inserts = [];
Expand All @@ -27,10 +22,10 @@
var insert = null;
if (mode.blockCommentStart && mode.blockCommentContinue) {
var line = cm.getLine(pos.line).slice(0, pos.ch)
var end = line.indexOf(mode.blockCommentEnd), found
var end = line.lastIndexOf(mode.blockCommentEnd), found
if (end != -1 && end == pos.ch - mode.blockCommentEnd.length) {
// Comment ended, don't continue it
} else if ((found = line.indexOf(mode.blockCommentStart)) > -1) {
} else if ((found = line.lastIndexOf(mode.blockCommentStart)) > -1 && found > end) {
insert = line.slice(0, found)
if (/\S/.test(insert)) {
insert = ""
Expand Down
14 changes: 10 additions & 4 deletions addon/edit/closebrackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
cm.state.closeBrackets = null;
}
if (val) {
ensureBound(getOption(val, "pairs"))
cm.state.closeBrackets = val;
cm.addKeyMap(keyMap);
}
Expand All @@ -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); };
Expand Down Expand Up @@ -79,7 +84,8 @@
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
}
cm.operation(function() {
cm.replaceSelection("\n\n", null);
var linesep = cm.lineSeparator() || "\n";
cm.replaceSelection(linesep + linesep, null);
cm.execCommand("goCharLeft");
ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
var inQuote = eolState.quote !== 0;

var line = cm.getLine(pos.line), match = listRE.exec(line);
if (!ranges[i].empty() || (!inList && !inQuote) || !match) {
var cursorBeforeBullet = /^\s*$/.test(line.slice(0, pos.ch));
if (!ranges[i].empty() || (!inList && !inQuote) || !match || cursorBeforeBullet) {
cm.execCommand("newlineAndIndent");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions addon/lint/css-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
})(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) {
window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run.");
}
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;
Expand Down
6 changes: 5 additions & 1 deletion addon/lint/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion addon/mode/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
12 changes: 12 additions & 0 deletions addon/runmode/runmode.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ exports.getMode = function(options, spec) {

return modeObj;
};

exports.innerMode = function(mode, state) {
var info;
while (mode.innerMode) {
info = mode.innerMode(state);
if (!info || info.mode == mode) break;
state = info.state;
mode = info.mode;
}
return info || {mode: mode, state: state};
}

exports.registerHelper = exports.registerGlobalHelper = Math.min;

exports.runMode = function(string, modespec, callback, options) {
Expand Down
1 change: 1 addition & 0 deletions addon/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion addon/selection/mark-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion addon/tern/tern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/authors.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Combine existing list of authors with everyone known in git, sort, add header.
tail --lines=+3 AUTHORS > AUTHORS.tmp
git log --format='%aN' >> AUTHORS.tmp
git log --format='%aN' | grep -v "Piët Delport" >> AUTHORS.tmp
echo -e "List of CodeMirror contributors. Updated before every release.\n" > AUTHORS
sort -u AUTHORS.tmp >> AUTHORS
rm -f AUTHORS.tmp
15 changes: 7 additions & 8 deletions demo/simplemode.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ <h2>Simple Mode Demo</h2>
<dd>The regular expression that matches the token. May be a string
or a regex object. When a regex, the <code>ignoreCase</code> flag
will be taken into account when matching the token. This regex
should only capture groups when the <code>token</code> property is
an array.</dd>
<dt><code><strong>token</strong></code>: string | null</dt>
has to capture groups when the <code>token</code> property is
an array. If it captures groups, it must capture <em>all</em> of the string
(since JS provides no way to find out where a group matched).</dd>
<dt><code><strong>token</strong></code>: string | array&lt;string&gt; | null</dt>
<dd>An optional token style. Multiple styles can be specified by
separating them with dots or spaces. When the <code>regex</code> for
this rule captures groups, it must capture <em>all</em> 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.</dd>
separating them with dots or spaces. When this property holds an array of token styles,
the <code>regex</code> for this rule must capture a group for each array item.
</dd>
<dt><code><strong>sol</strong></code>: boolean</dt>
<dd>When true, this token will only match at the start of the line.
(The <code>^</code> regexp marker doesn't work as you'd expect in
Expand Down
3 changes: 2 additions & 1 deletion demo/vim.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ <h2>Vim bindings demo</h2>
mode: "text/x-csrc",
keyMap: "vim",
matchBrackets: true,
showCursorWhenSelecting: true
showCursorWhenSelecting: true,
inputStyle: "contenteditable"
});
var commandDisplay = document.getElementById('command-display');
var keys = '';
Expand Down
Loading

0 comments on commit a0a90f5

Please sign in to comment.