11 changes: 11 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ Christian Petrov
Christopher Brown
Christopher Mitchell
Christopher Pfohl
Chunliang Lyu
ciaranj
CodeAnimal
coderaiser
Cole R Lawrence
ComFreek
Curtis Gagliardi
dagsta
Expand Down Expand Up @@ -144,6 +146,7 @@ Doug Wikle
Drew Bratcher
Drew Hintz
Drew Khoury
Drini Cami
Dror BG
duralog
eborden
Expand All @@ -152,6 +155,7 @@ ekhaled
Elisée
Enam Mijbah Noor
Eric Allam
Erik Welander
eustas
Fabien O'Carroll
Fabio Zendhi Nagao
Expand Down Expand Up @@ -219,6 +223,7 @@ Jan Jongboom
jankeromnes
Jan Keromnes
Jan Odvarko
Jan Schär
Jan T. Sott
Jared Forsyth
Jason
Expand All @@ -234,7 +239,9 @@ jeffkenton
Jeff Pickhardt
jem (graphite)
Jeremy Parmenter
Jim
JobJob
jochenberger
Jochen Berger
Johan Ask
John Connor
Expand All @@ -258,6 +265,7 @@ ju1ius
Juan Benavides Romero
Jucovschi Constantin
Juho Vuori
Justin Andresen
Justin Hileman
jwallers@gmail.com
kaniga
Expand Down Expand Up @@ -337,6 +345,7 @@ Max Kirsch
Max Schaefer
Max Xiantu
mbarkhau
McBrainy
melpon
Metatheos
Micah Dubinko
Expand Down Expand Up @@ -376,6 +385,7 @@ Nicholas Bollweg
Nicholas Bollweg (Nick)
Nick Kreeger
Nick Small
Nicolò Ribaudo
Niels van Groningen
nightwing
Nikita Beloglazov
Expand Down Expand Up @@ -492,6 +502,7 @@ Tom MacWright
Tony Jian
Travis Heppe
Triangle717
TSUYUSATO Kitsune
twifkak
Vestimir Markov
vf
Expand Down
7 changes: 0 additions & 7 deletions addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,6 @@
setTimeout(function(){cm.focus();}, 20);
});

if (completion.options.completeOnSingleClick)
CodeMirror.on(hints, "mousemove", function(e) {
var elt = getHintElement(hints, e.target || e.srcElement);
if (elt && elt.hintId != null)
widget.changeActive(elt.hintId);
});

CodeMirror.signal(data, "select", completions[0], hints.firstChild);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion addon/mode/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

function ensureState(states, name) {
if (!states.hasOwnProperty(name))
throw new Error("Undefined state " + name + "in simple mode");
throw new Error("Undefined state " + name + " in simple mode");
}

function toRegex(val, caret) {
Expand Down
2 changes: 1 addition & 1 deletion addon/runmode/runmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
var ie = /MSIE \d/.test(navigator.userAgent);
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);

if (callback.nodeType == 1) {
if (callback.appendChild) {
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
var node = callback, col = 0;
node.innerHTML = "";
Expand Down
3 changes: 3 additions & 0 deletions addon/scroll/annotatescrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: "
+ (top + this.buttonHeight) + "px; height: " + height + "px";
elt.className = this.options.className;
if (ann.id) {
elt.setAttribute("annotation-id", ann.id);
}
}
this.div.textContent = "";
this.div.appendChild(frag);
Expand Down
49 changes: 49 additions & 0 deletions addon/search/jump-to-line.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

// Defines jumpToLine command. Uses dialog.js if present.

(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../dialog/dialog"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../dialog/dialog"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";

function dialog(cm, text, shortText, deflt, f) {
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
else f(prompt(shortText, deflt));
}

var jumpDialog =
'Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>';

function interpretLine(cm, string) {
var num = Number(string)
if (/^[-+]/.test(string)) return cm.getCursor().line + num
else return num - 1
}

CodeMirror.commands.jumpToLine = function(cm) {
var cur = cm.getCursor();
dialog(cm, jumpDialog, "Jump to line:", (cur.line + 1) + ":" + cur.ch, function(posStr) {
if (!posStr) return;

var match;
if (match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr)) {
cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))
} else if (match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr)) {
var line = Math.round(cm.lineCount() * Number(match[1]) / 100);
if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
cm.setCursor(line - 1, cur.ch);
} else if (match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr)) {
cm.setCursor(interpretLine(cm, match[1]), cur.ch);
}
});
};

CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";
});
2 changes: 1 addition & 1 deletion demo/runmode.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h2>Mode Runner Demo</h2>

<p>Running a CodeMirror mode outside of the editor.
The <code>CodeMirror.runMode</code> function, defined
in <code><a href="../addon/runmode/runmode.js">lib/runmode.js</a></code> takes the following arguments:</p>
in <code><a href="../addon/runmode/runmode.js">addon/runmode/runmode.js</a></code> takes the following arguments:</p>

<dl>
<dt><code>text (string)</code></dt>
Expand Down
8 changes: 6 additions & 2 deletions demo/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<script src="../addon/search/search.js"></script>
<script src="../addon/scroll/annotatescrollbar.js"></script>
<script src="../addon/search/matchesonscrollbar.js"></script>
<script src="../addon/search/jump-to-line.js"></script>
<style type="text/css">
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
dt {font-family: monospace; color: #666;}
Expand Down Expand Up @@ -84,12 +85,15 @@ <h2>Search/Replace Demo</h2>
<dt>Shift-Ctrl-G / Shift-Cmd-G</dt><dd>Find previous</dd>
<dt>Shift-Ctrl-F / Cmd-Option-F</dt><dd>Replace</dd>
<dt>Shift-Ctrl-R / Shift-Cmd-Option-F</dt><dd>Replace all</dd>
<dt>Alt-F</dt><dd>Persistent search (dialog doesn't autoclose, enter to find next, shift-enter to find previous)</dd>
<dt>Alt-F</dt><dd>Persistent search (dialog doesn't autoclose,
enter to find next, Shift-Enter to find previous)</dd>
<dt>Alt-G</dt><dd>Jump to line</dd>
</dl>
<p>Searching is enabled by
including <a href="../addon/search/search.js">addon/search/search.js</a>
and <a href="../addon/search/searchcursor.js">addon/search/searchcursor.js</a>.
For good-looking input dialogs, you also want to include
Jump to line - including <a href="../addon/search/jumpToLine.js">addon/search/jumpToLine.js</a>.</p>
<p>For good-looking input dialogs, you also want to include
<a href="../addon/dialog/dialog.js">addon/dialog/dialog.js</a>
and <a href="../addon/dialog/dialog.css">addon/dialog/dialog.css</a>.</p>
</article>
4 changes: 4 additions & 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.10.0;f=">5.10</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.9.0;f=">5.9</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.8.0;f=">5.8</option>
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.7.0;f=">5.7</option>
Expand Down Expand Up @@ -122,6 +123,7 @@ <h2>Script compression helper</h2>
<option value="http://codemirror.net/mode/cobol/cobol.js">cobol.js</option>
<option value="http://codemirror.net/mode/coffeescript/coffeescript.js">coffeescript.js</option>
<option value="http://codemirror.net/mode/commonlisp/commonlisp.js">commonlisp.js</option>
<option value="http://codemirror.net/mode/crystal/crystal.js">crystal.js</option>
<option value="http://codemirror.net/mode/css/css.js">css.js</option>
<option value="http://codemirror.net/mode/cypher/cypher.js">cypher.js</option>
<option value="http://codemirror.net/mode/d/d.js">d.js</option>
Expand Down Expand Up @@ -219,6 +221,7 @@ <h2>Script compression helper</h2>
<option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
<option value="http://codemirror.net/mode/xquery/xquery.js">xquery.js</option>
<option value="http://codemirror.net/mode/yaml/yaml.js">yaml.js</option>
<option value="http://codemirror.net/mode/yaml-frontmatter/yaml-frontmatter.js">yaml-frontmatter.js</option>
<option value="http://codemirror.net/mode/z80/z80.js">z80.js</option>
</optgroup>
<optgroup label="Add-ons">
Expand All @@ -243,6 +246,7 @@ <h2>Script compression helper</h2>
<option value="http://codemirror.net/addon/hint/javascript-hint.js">javascript-hint.js</option>
<option value="http://codemirror.net/addon/lint/javascript-lint.js">javascript-lint.js</option>
<option value="http://codemirror.net/addon/lint/json-lint.js">json-lint.js</option>
<option value="http://codemirror.net/addon/search/jump-to-line.js">jump-to-line.js</option>
<option value="http://codemirror.net/addon/lint/lint.js">lint.js</option>
<option value="http://codemirror.net/addon/mode/loadmode.js">loadmode.js</option>
<option value="http://codemirror.net/addon/fold/markdown-fold.js">markdown-fold.js</option>
Expand Down
31 changes: 22 additions & 9 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.9.0</span>
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.10.0</span>
</h2>

<p>CodeMirror is a code-editor component that can be embedded in
Expand Down Expand Up @@ -582,15 +582,17 @@ <h2>Events</h2>
mode's <a href="#option_electricChars">electric</a> patterns,
and this caused the line's indentation to change.</dd>

<dt id="event_beforeSelectionChange"><code><strong>"beforeSelectionChange"</strong> (instance: CodeMirror, obj: {ranges, update})</code></dt>
<dt id="event_beforeSelectionChange"><code><strong>"beforeSelectionChange"</strong> (instance: CodeMirror, obj: {ranges, origin, update})</code></dt>
<dd>This event is fired before the selection is moved. Its
handler may inspect the set of selection ranges, present as an
array of <code>{anchor, head}</code> objects in
the <code>ranges</code> property of the <code>obj</code>
argument, and optionally change them by calling
the <code>update</code> method on this object, passing an array
of ranges in the same format. Handlers for this event have the
same restriction
of ranges in the same format. The object also contains
an <code>origin</code> property holding the origin string passed
to the selection-changing method, if any. Handlers for this
event have the same restriction
as <a href="#event_beforeChange"><code>"beforeChange"</code></a>
handlers — they should not do anything to directly update the
state of the editor.</dd>
Expand Down Expand Up @@ -652,7 +654,7 @@ <h2>Events</h2>

<dt id="event_dom"><code><strong>"mousedown"</strong>,
<strong>"dblclick"</strong>, <strong>"contextmenu"</strong>, <strong>"keydown"</strong>, <strong>"keypress"</strong>,
<strong>"keyup"</strong>, <strong>"dragstart"</strong>, <strong>"dragenter"</strong>,
<strong>"keyup"</strong>, <strong>"paste"</strong>, <strong>"dragstart"</strong>, <strong>"dragenter"</strong>,
<strong>"dragover"</strong>, <strong>"drop"</strong>
(instance: CodeMirror, event: Event)</code></dt>
<dd>Fired when CodeMirror is handling a DOM event of this type.
Expand Down Expand Up @@ -1350,7 +1352,7 @@ <h3 id="api_selection">Cursor and selection methods</h3>
<dd>An equivalent
of <a href="#extendSelection"><code>extendSelection</code></a>
that acts on all selections at once.</dd>
<dt id="extendSelectionsBy"><code><strong>doc.extendSelectionsBy</strong>(f: function(range: {anchor, head}) → {anchor, head}), ?options: object)</code></dt>
<dt id="extendSelectionsBy"><code><strong>doc.extendSelectionsBy</strong>(f: function(range: {anchor, head}) → {line, ch}), ?options: object)</code></dt>
<dd>Applies the given function to all existing selections, and
calls <a href="#extendSelections"><code>extendSelections</code></a>
on the result.</dd>
Expand Down Expand Up @@ -2000,11 +2002,15 @@ <h3 id="api_misc">Miscellaneous methods</h3>
indentation by the given amount of spaces.</dd>
</dl></dd>

<dt id="toggleOverwrite"><code><strong>cm.toggleOverwrite</strong>(?value: bool)</code></dt>
<dt id="toggleOverwrite"><code><strong>cm.toggleOverwrite</strong>(?value: boolean)</code></dt>
<dd>Switches between overwrite and normal insert mode (when not
given an argument), or sets the overwrite mode to a specific
state (when given an argument).</dd>

<dt id="isReadOnly"><code><strong>cm.isReadOnly</strong>() → boolean</code></dt>
<dd>Tells you whether the editor's content can be edited by the
user.</dd>

<dt id="lineSeparator"><code><strong>doc.lineSeparator</strong>()</code></dt>
<dd>Returns the preferred line separator string for this
document, as per the <a href="#option_lineSeparator">option</a>
Expand Down Expand Up @@ -2234,6 +2240,13 @@ <h2 id="addons">Addons</h2>
of <a href="#addon_dialog"><code>openDialog</code></a> when
available to make prompting for search queries less ugly.</dd>

<dt id="addon_jump-to-line"><a href="../addon/search/jump-to-line.js"><code>search/jump-to-line.js</code></a></dt>
<dd>Implements a <code>jumpToLine</code> command and binding <code>Alt-G</code> to it.
Accepts <code>linenumber</code>, <code>+/-linenumber</code>, <code>line:char</code>,
<code>scroll%</code> and <code>:linenumber</code> formats.
This will make use of <a href="#addon_dialog"><code>openDialog</code></a>
when available to make prompting for line number neater.</dd>

<dt id="addon_matchesonscrollbar"><a href="../addon/search/matchesonscrollbar.js"><code>search/matchesonscrollbar.js</code></a></dt>
<dd>Adds a <code>showMatchesOnScrollbar</code> method to editor
instances, which should be given a query (string or regular
Expand Down Expand Up @@ -3240,8 +3253,8 @@ <h2>VIM Mode API</h2>
<p>CodeMirror has a robust VIM mode that attempts to faithfully
emulate VIM's most useful features. It can be enabled by
including <a href="../keymap/vim.js"><code>keymap/vim.js</code>
</a> and setting the <code>keymap</code> option to
<code>vim</code>.</p>
</a> and setting the <code>keyMap</code> option to
<code>"vim"</code>.</p>

<h3 id="vimapi_configuration">Configuration</h3>

Expand Down
21 changes: 17 additions & 4 deletions doc/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,20 @@ <h2>Release notes and version history</h2>

<h2>Version 5.x</h2>

<p class="rel">23-10-2015: <a href="http://codemirror.net/codemirror-5.9.zip">Version 5.9</a>:</p>
<p class="rel">21-12-2015: <a href="http://codemirror.net/codemirror-5.10.zip">Version 5.10</a>:</p>

<ul class="rel-note">
<li>Modify the way <a href="manual.html#mark_atomic">atomic ranges</a> are skipped by selection to try and make it less surprising.</li>
<li>The <a href="../mode/swift/index.html">Swift mode</a> was rewritten.</li>
<li>New addon: <a href="manual.html#addon_jump-to-line">jump-to-line</a>.</li>
<li>New method: <a href="manual.html#isReadOnly"><code>isReadOnly</code></a>.</li>
<li>The <a href="manual.html#addon_show-hint">show-hint addon</a> now defaults to picking completions on single click.</li>
<li>The object passed to <a href="manual.html#event_beforeSelectionChange"><code>&quot;beforeSelectionChange&quot;</code></a> events now has an <code>origin</code> property.</li>
<li>New mode: <a href="../mode/crystal/index.html">Crystal</a>.</li>
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.9.0...5.10.0">list of patches</a></li>
</ul>

<p class="rel">23-11-2015: <a href="http://codemirror.net/codemirror-5.9.zip">Version 5.9</a>:</p>

<ul class="rel-note">
<li>Improve the way overlay (OS X-style) scrollbars are handled</li>
Expand Down Expand Up @@ -59,12 +72,12 @@ <h2>Version 5.x</h2>
<ul class="rel-note">
<li>New modes: <a href="../mode/vue/index.html">Vue</a>, <a href="../mode/oz/index.html">Oz</a>, <a href="../mode/mscgen/index.html">MscGen</a> (and dialects), <a href="../mode/css/gss.html">Closure Stylesheets</a></li>
<li>Implement <a href="http://commonmark.org">CommonMark</a>-style flexible list indent and cross-line code spans in <a href="../mode/markdown/index.html">Markdown</a> mode</li>
<li>Add a replace-all button to the <a href="../doc/manual.html#addon_search">search addon</a>, and make the persistent search dialog transparent when it obscures the match</li>
<li>Add a replace-all button to the <a href="manual.html#addon_search">search addon</a>, and make the persistent search dialog transparent when it obscures the match</li>
<li>Handle <code>acync</code>/<code>await</code> and ocal and binary numbers in <a href="../mode/javascript/index.html">JavaScript mode</a></li>
<li>Fix various issues with the <a href="../mode/haxe/index.html">Haxe mode</a></li>
<li>Make the <a href="../doc/manual.html#addon_closebrackets">closebrackets addon</a> select only the wrapped text when wrapping selection in brackets</li>
<li>Make the <a href="manual.html#addon_closebrackets">closebrackets addon</a> select only the wrapped text when wrapping selection in brackets</li>
<li>Tokenize properties as properties in the <a href="../mode/coffeescript/index.html">CoffeeScript mode</a></li>
<li>The <a href="../doc/manual.html#addon_placeholder">placeholder addon</a> now accepts a DOM node as well as a string placeholder</li>
<li>The <a href="manual.html#addon_placeholder">placeholder addon</a> now accepts a DOM node as well as a string placeholder</li>
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.6.0...5.7.0">list of patches</a></li>
</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.9</a>.<br>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.10</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
Loading