Skip to content

Commit

Permalink
Upgrade to CodeMirror 5.24.2
Browse files Browse the repository at this point in the history
  • Loading branch information
markhillard committed Mar 16, 2017
1 parent 159ddfc commit 4cda5e6
Show file tree
Hide file tree
Showing 71 changed files with 2,611 additions and 1,496 deletions.
7 changes: 7 additions & 0 deletions codemirror/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Apollo Zhu
AQNOUCH Mohammed
areos
Arnab Bose
Arthur Müller
as3boyan
atelierbram
AtomicPages LLC
Expand Down Expand Up @@ -102,6 +103,7 @@ Brett Zamir
Brian Grinstead
Brian Sletten
Bruce Mitchener
Bryan Massoth
Caitlin Potter
Calin Barbat
callodacity
Expand Down Expand Up @@ -180,6 +182,7 @@ Enam Mijbah Noor
Eric Allam
Erik Welander
eustas
Fabien Dubosson
Fabien O'Carroll
Fabio Zendhi Nagao
Faiza Alsaied
Expand All @@ -205,6 +208,7 @@ Gary Sheng
Gautam Mehta
Gavin Douglas
gekkoe
Geordie Hall
geowarin
Gerard Braad
Gergely Hegykozi
Expand Down Expand Up @@ -302,6 +306,7 @@ Jon Malmaud
Jon Sangster
Joost-Wim Boekesteijn
Joseph Pecoraro
Josh Barnes
Josh Cohen
Josh Soref
Joshua Newman
Expand All @@ -324,6 +329,7 @@ Ken Newman
ken restivo
Ken Rockot
Kevin Earls
Kevin Muret
Kevin Sawicki
Kevin Ushey
Klaus Silveira
Expand Down Expand Up @@ -510,6 +516,7 @@ Roberto Abdelkader Martínez Pérez
robertop23
Robert Plummer
Rrandom
Rrrandom
Ruslan Osmanov
Ryan Prior
sabaca
Expand Down
50 changes: 50 additions & 0 deletions codemirror/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
## 5.24.2 (2017-02-22)

### Bug fixes

[javascript mode](http://codemirror.net/mode/javascript/): Support computed class method names.

[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.

## 5.24.0 (2017-02-20)

### Bug fixes

A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.

Visual cursor motion in line-wrapped right-to-left text should be much more correct.

Fix bug in handling of read-only marked text.

[shell mode](http://codemirror.net/mode/shell/): Properly tokenize nested parentheses.

[python mode](http://codemirror.net/mode/python/): Support underscores in number literals.

[sass mode](http://codemirror.net/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.

[css mode](http://codemirror.net/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.

[julia mode](http://codemirror.net/mode/julia/): Properly indent `elseif` lines.

[markdown mode](http://codemirror.net/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.

[scala mode](http://codemirror.net/mode/clike/): Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.

[xml mode](http://codemirror.net/mode/xml/): Allow dashes in HTML tag names.

[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.

[indent-fold addon](http://codemirror.net/demo/folding.html): Ignore comment lines.

### New features

Positions now support a `sticky` property which determines whether they should be associated with the character before (value `"before"`) or after (value `"after"`) them.

[vim bindings](http://codemirror.net/mode/demo/vim.html): Make it possible to remove built-in bindings through the API.

[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.

### Breaking changes

The [sass mode](http://codemirror.net/mode/sass/) now depends on the [css mode](http://codemirror.net/mode/css/).

## 5.23.0 (2017-01-19)

### Bug fixes
Expand Down
2 changes: 2 additions & 0 deletions codemirror/LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MIT License

Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
11 changes: 8 additions & 3 deletions codemirror/addon/comment/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
}

function getMode(cm, pos) {
var mode = cm.getMode()
return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
}

CodeMirror.defineExtension("lineComment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var self = this, mode = getMode(self, from);
var firstLine = self.getLine(from.line);
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;

Expand Down Expand Up @@ -95,7 +100,7 @@

CodeMirror.defineExtension("blockComment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var self = this, mode = getMode(self, from);
var startString = options.blockCommentStart || mode.blockCommentStart;
var endString = options.blockCommentEnd || mode.blockCommentEnd;
if (!startString || !endString) {
Expand Down Expand Up @@ -129,7 +134,7 @@

CodeMirror.defineExtension("uncomment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var self = this, mode = getMode(self, from);
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);

// Try finding line comments
Expand Down
2 changes: 1 addition & 1 deletion codemirror/addon/edit/closebrackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
function enteringString(cm, pos, ch) {
var line = cm.getLine(pos.line);
var token = cm.getTokenAt(pos);
if (/\bstring2?\b/.test(token.type)) return false;
if (/\bstring2?\b/.test(token.type) || stringStartsAfter(cm, pos)) return false;
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
stream.pos = stream.start = token.start;
for (;;) {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/addon/edit/continuelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return;
}
if (emptyListRE.test(line)) {
cm.replaceRange("", {
if (!/>\s*$/.test(line)) cm.replaceRange("", {
line: pos.line, ch: 0
}, {
line: pos.line, ch: pos.ch + 1
Expand Down
34 changes: 19 additions & 15 deletions codemirror/addon/fold/indent-fold.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,36 @@
})(function(CodeMirror) {
"use strict";

function lineIndent(cm, lineNo) {
var text = cm.getLine(lineNo)
var spaceTo = text.search(/\S/)
if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1))))
return -1
return CodeMirror.countColumn(text, null, cm.getOption("tabSize"))
}
!
CodeMirror.registerHelper("fold", "indent", function(cm, start) {
var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
if (!/\S/.test(firstLine)) return;
var getIndent = function(line) {
return CodeMirror.countColumn(line, null, tabSize);
};
var myIndent = getIndent(firstLine);
var lastLineInFold = null;
var myIndent = lineIndent(cm, start.line)
if (myIndent < 0) return
var lastLineInFold = null

// Go through lines until we find a line that definitely doesn't belong in
// the block we're folding, or to the end.
for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
var curLine = cm.getLine(i);
var curIndent = getIndent(curLine);
if (curIndent > myIndent) {
var indent = lineIndent(cm, i)
if (indent == -1) {
} else if (indent > myIndent) {
// Lines with a greater indent are considered part of the block.
lastLineInFold = i;
} else if (!/\S/.test(curLine)) {
// Empty lines might be breaks within the block we're trying to fold.
} else {
// A non-empty line at an indent equal to or less than ours marks the
// start of another block.
// If this line has non-space, non-comment content, and is
// indented less or equal to the start line, it is the start of
// another block.
break;
}
}
if (lastLineInFold) return {
from: CodeMirror.Pos(start.line, firstLine.length),
from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
};
});
Expand Down
Loading

0 comments on commit 4cda5e6

Please sign in to comment.