Skip to content

Commit

Permalink
Merge pull request antimatter15#1 from codemirror/master
Browse files Browse the repository at this point in the history
updating to latest
  • Loading branch information
antimatter15 committed Feb 27, 2016
2 parents bf6ec7e + aae30f7 commit 3238df7
Show file tree
Hide file tree
Showing 22 changed files with 798 additions and 32 deletions.
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Daniel, Dao Quang Minh
Daniele Di Sarli
Daniel Faust
Daniel Huigens
Daniel Kesler
Daniel KJ
Daniel Neel
Daniel Parnell
Expand Down Expand Up @@ -186,6 +187,7 @@ gekkoe
Gerard Braad
Gergely Hegykozi
Giovanni Calò
Glebov Boris
Glenn Jorde
Glenn Ruehle
Golevka
Expand Down Expand Up @@ -255,6 +257,7 @@ John Engler
John Lees-Miller
John Snelson
John Van Der Loo
Jon Ander Peñalba
Jonas Döbertin
Jonathan Malmaud
jongalloway
Expand Down Expand Up @@ -414,6 +417,7 @@ Patrick Stoica
Patrick Strawderman
Paul Garvin
Paul Ivanov
Pavel
Pavel Feldman
Pavel Strashkin
Paweł Bartkiewicz
Expand Down Expand Up @@ -481,7 +485,9 @@ Stanislav Oaserele
Stas Kobzar
Stefan Borsje
Steffen Beyer
Steffen Bruchmann
Stephen Lavelle
Steve Champagne
Steve O'Hara
stoskov
Stu Kennedy
Expand Down Expand Up @@ -534,6 +540,7 @@ Yassin N. Hassan
YNH Webdev
Yunchi Luo
Yuvi Panda
Zac Anger
Zachary Dremann
Zhang Hao
zziuni
Expand Down
684 changes: 684 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions addon/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

var inp = dialog.getElementsByTagName("input")[0], button;
if (inp) {
inp.focus();

if (options.value) {
inp.value = options.value;
if (options.selectValueOnOpen !== false) {
Expand All @@ -79,8 +81,6 @@
});

if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);

inp.focus();
} else if (button = dialog.getElementsByTagName("button")[0]) {
CodeMirror.on(button, "click", function() {
close();
Expand Down
8 changes: 8 additions & 0 deletions demo/vim.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@

<article>
<h2>Vim bindings demo</h2>

<p><strong style="color: #c33; text-decoration: none">Note:</strong> The CodeMirror vim bindings do not have an
active maintainer. That means that if you report bugs in it, they are
likely to go unanswered. It also means that if you want to help, you
are very welcome to look
at <a href="https://github.com/codemirror/codemirror/issues?q=is%3Aissue+is%3Aopen+label%3Avim">the
open issues</a> and see which ones you can solve.</p>

<form><textarea id="code" name="code">
#include "syscalls.h"
/* getchar: simple buffered version */
Expand Down
1 change: 1 addition & 0 deletions doc/compress.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h2>Script compression helper</h2>
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px;">
<option value="http://codemirror.net/">HEAD</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.12.0;f=">5.12</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.11.0;f=">5.11</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.10.0;f=">5.10</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.9.0;f=">5.9</option>
Expand Down
8 changes: 4 additions & 4 deletions doc/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<section class=first id=overview>
<h2 style="position: relative">
User manual and reference guide
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.11.1</span>
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.12.1</span>
</h2>

<p>CodeMirror is a code-editor component that can be embedded in
Expand Down Expand Up @@ -1540,7 +1540,7 @@ <h3 id="api_history">History-related methods</h3>
<dt id="clearHistory"><code><strong>doc.clearHistory</strong>()</code></dt>
<dd>Clears the editor's undo history.</dd>
<dt id="getHistory"><code><strong>doc.getHistory</strong>() → object</code></dt>
<dd>Get a (JSON-serializeable) representation of the undo history.</dd>
<dd>Get a (JSON-serializable) representation of the undo history.</dd>
<dt id="setHistory"><code><strong>doc.setHistory</strong>(history: object)</code></dt>
<dd>Replace the editor's undo history with the one provided,
which must be a value as returned
Expand Down Expand Up @@ -2322,7 +2322,7 @@ <h2 id="addons">Addons</h2>
<dt id="addon_continuelist"><a href="../addon/edit/continuelist.js"><code>edit/continuelist.js</code></a></dt>
<dd>Markdown specific. Defines
a <code>"newlineAndIndentContinueMarkdownList"</code> <a href="#commands">command</a>
command that can be bound to <code>enter</code> to automatically
that can be bound to <code>enter</code> to automatically
insert the leading characters for continuing a list. See
the <a href="../mode/markdown/index.html">Markdown mode
demo</a>.</dd>
Expand Down Expand Up @@ -3068,7 +3068,7 @@ <h2>Writing CodeMirror Modes</h2>

<dt><code><strong>peek</strong>() → string</code></dt>
<dd>Returns the next character in the stream without advancing
it. Will return an <code>null</code> at the end of the
it. Will return a <code>null</code> at the end of the
line.</dd>
<dt><code><strong>next</strong>() → string</code></dt>
<dd>Returns the next character in the stream and advances it.
Expand Down
1 change: 1 addition & 0 deletions doc/realworld.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ <h2>CodeMirror real-world uses</h2>
<li><a href="http://clrhome.org/asm/">ORG</a> (z80 assembly IDE)</li>
<li><a href="https://github.com/mamacdon/orion-codemirror">Orion-CodeMirror integration</a> (running CodeMirror modes in Orion)</li>
<li><a href="http://paperjs.org/">Paper.js</a> (graphics scripting)</li>
<li><a href="http://pharaoh.js.org/">Pharaoh</a> (browser &amp; desktop editor for the classroom)</li>
<li><a href="http://prinbit.com/">PrinBit</a> (collaborative coding tool)</li>
<li><a href="http://prose.io/">Prose.io</a> (github content editor)</li>
<li><a href="https://pypi.python.org/pypi/PubliForge/">PubliForge</a> (online publishing system)</li>
Expand Down
23 changes: 23 additions & 0 deletions doc/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ <h2>Release notes and version history</h2>

<h2>Version 5.x</h2>

<p class="rel">19-02-2016: <a href="http://codemirror.net/codemirror-5.12.zip">Version 5.12</a>:</p>

<ul>
<li><a href="http://codemirror.net/demo/vim.html">Vim bindings</a>: Ctrl-Q is now an alias for Ctrl-V.</li>
<li><a href="http://codemirror.net/demo/vim.html">Vim bindings</a>: The Vim API now exposes an <code>unmap</code> method to unmap bindings.</li>
<li><a href="http://codemirror.net/demo/activeline.html">active-line addon</a>: This addon can now style the active line's gutter.</li>
<li><a href="http://codemirror.net/mode/fcl/">FCL mode</a>: Newly added.</li>
<li><a href="http://codemirror.net/mode/sql/">SQL mode</a>: Now has a Postgresql dialect.</li>
<li>Fix <a href="https://github.com/codemirror/CodeMirror/issues/3781">issue</a> where trying to scroll to a horizontal position outside of the document's width could cause the gutter to be positioned incorrectly.</li>
<li>Use absolute, rather than fixed positioning in the context-menu intercept hack, to work around a <a href="https://github.com/codemirror/CodeMirror/issues/3238">problem</a> when the editor is inside a transformed parent container.</li>
<li>Solve a <a href="https://github.com/codemirror/CodeMirror/issues/3821">problem</a> where the horizontal scrollbar could hide text in Firefox.</li>
<li>Fix a <a href="https://github.com/codemirror/CodeMirror/issues/3834">bug</a> that caused phantom scroll space under the text in some situations.</li>
<li><a href="http://codemirror.net/demo/sublime.html">Sublime Text bindings</a>: Bind delete-line to Shift-Ctrl-K on OS X.</li>
<li><a href="http://codemirror.net/mode/markdown/">Markdown mode</a>: Fix <a href="https://github.com/codemirror/CodeMirror/issues/3787">issue</a> where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.</li>
<li><a href="http://codemirror.net/mode/markdown/">Markdown mode</a>: Ignore backslashes in code fragments.</li>
<li><a href="http://codemirror.net/mode/markdown/">Markdown mode</a>: Use whichever mode is registered as <code>text/html</code> to parse HTML.</li>
<li><a href="http://codemirror.net/mode/clike/">Clike mode</a>: Improve indentation of Scala <code>=&gt;</code> functions.</li>
<li><a href="http://codemirror.net/mode/python/">Python mode</a>: Improve indentation of bracketed code.</li>
<li><a href="http://codemirror.net/mode/htmlmixed/">HTMLMixed mode</a>: Support multi-line opening tags for sub-languages (<code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, etc).</li>
<li><a href="http://codemirror.net/mode/spreadsheet/">Spreadsheet mode</a>: Fix bug where the mode did not advance the stream when finding a backslash.</li>
<li><a href="http://codemirror.net/mode/xml/">XML mode</a>: The mode now takes a <code>matchClosing</code> option to configure whether mismatched closing tags should be highlighted as errors.</li>
</ul>

<p class="rel">20-01-2016: <a href="http://codemirror.net/codemirror-5.11.zip">Version 5.11</a>:</p>

<ul>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2>This is CodeMirror</h2>
</div>
</div>
<div class=actionsleft>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.11</a>.<br>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.12</a>.<br>
You can see the <a href="https://github.com/codemirror/codemirror" title="Github repository">code</a> or<br>
read the <a href="doc/releases.html">release notes</a>.<br>
There is a <a href="doc/compress.html">minification helper</a>.
Expand Down
3 changes: 3 additions & 0 deletions keymap/vim.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@
// Add user defined key bindings.
exCommandDispatcher.map(lhs, rhs, ctx);
},
unmap: function(lhs, ctx) {
exCommandDispatcher.unmap(lhs, ctx);
},
// TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
// them, or somehow make them work with the existing CodeMirror setOption/getOption API.
setOption: setOption,
Expand Down
1 change: 1 addition & 0 deletions lib/codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
/* Hack to make IE7 behave */
*zoom:1;
Expand Down
15 changes: 8 additions & 7 deletions lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@

d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"

if (sizes.right && sizes.bottom) {
d.scrollbarFiller.style.display = "block";
Expand Down Expand Up @@ -787,9 +788,9 @@

function setDocumentHeight(cm, measure) {
cm.display.sizer.style.minHeight = measure.docHeight + "px";
var total = measure.docHeight + cm.display.barHeight;
cm.display.heightForcer.style.top = total + "px";
cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px";
cm.display.heightForcer.style.top = measure.docHeight + "px";
cm.display.gutters.style.height = Math.max(measure.docHeight + cm.display.barHeight + scrollGap(cm),
measure.clientHeight) + "px";
}

// Read the actual heights of the rendered lines, and update their
Expand Down Expand Up @@ -7622,9 +7623,9 @@
var spans = line.markedSpans;
if (spans) for (var i = 0; i < spans.length; i++) {
var span = spans[i];
if (!(lineNo == from.line && from.ch > span.to ||
span.from == null && lineNo != from.line||
lineNo == to.line && span.from > to.ch) &&
if (!(span.to != null && lineNo == from.line && from.ch > span.to ||
span.from == null && lineNo != from.line ||
span.from != null && lineNo == to.line && span.from > to.ch) &&
(!filter || filter(span.marker)))
found.push(span.marker.parent || span.marker);
}
Expand Down Expand Up @@ -8886,7 +8887,7 @@

// THE END

CodeMirror.version = "5.11.1";
CodeMirror.version = "5.12.1";

return CodeMirror;
});
21 changes: 12 additions & 9 deletions mode/markdown/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {

var htmlFound = CodeMirror.modes.hasOwnProperty("xml");
var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain");
var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
var htmlModeMissing = htmlMode.name == "null"

function getMode(name) {
if (CodeMirror.findModeByName) {
Expand Down Expand Up @@ -119,7 +119,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.quote = 0;
// Reset state.indentedCode
state.indentedCode = false;
if (!htmlFound && state.f == htmlBlock) {
if (htmlModeMissing && state.f == htmlBlock) {
state.f = inlineNormal;
state.block = blockNormal;
}
Expand Down Expand Up @@ -222,12 +222,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {

function htmlBlock(stream, state) {
var style = htmlMode.token(stream, state.htmlState);
if ((htmlFound && state.htmlState.tagStart === null &&
(!state.htmlState.context && state.htmlState.tokenize.isInText)) ||
(state.md_inside && stream.current().indexOf(">") > -1)) {
state.f = inlineNormal;
state.block = blockNormal;
state.htmlState = null;
if (!htmlModeMissing) {
var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
(!inner.state.context && inner.state.tokenize.isInText)) ||
(state.md_inside && stream.current().indexOf(">") > -1)) {
state.f = inlineNormal;
state.block = blockNormal;
state.htmlState = null;
}
}
return style;
}
Expand Down
5 changes: 2 additions & 3 deletions mode/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i},
{name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
{name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]},
{name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"]},
{name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
{name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
{name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]},
Expand Down Expand Up @@ -84,7 +84,7 @@
{name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
{name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]},
{name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
{name: "MUMPS", mime: "text/x-mumps", mode: "mumps"},
{name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
{name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
{name: "MySQL", mime: "text/x-mysql", mode: "sql"},
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i},
Expand Down Expand Up @@ -127,7 +127,6 @@
{name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
{name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
{name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
{name: "MariaDB", mime: "text/x-mariadb", mode: "sql"},
{name: "sTeX", mime: "text/x-stex", mode: "stex"},
{name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]},
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]},
Expand Down
5 changes: 4 additions & 1 deletion mode/spreadsheet/spreadsheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@
return "operator";
case "\\":
if (stream.match(/\\[a-z]+/)) return "string-2";
else return null;
else {
stream.next();
return "atom";
}
case ".":
case ",":
case ";":
Expand Down
1 change: 1 addition & 0 deletions mode/sql/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ <h2>SQL Mode for CodeMirror</h2>
<code><a href="?mime=text/x-plsql">text/x-plsql</a></code>,
<code><a href="?mime=text/x-mssql">text/x-mssql</a></code>,
<code><a href="?mime=text/x-hive">text/x-hive</a></code>.
<code><a href="?mime=text/x-pgsql">text/x-pgsql</a></code>.
</p>
<script>
window.onload = function() {
Expand Down
Loading

0 comments on commit 3238df7

Please sign in to comment.