Skip to content

Commit e087b3e

Browse files
committed
Merge remote-tracking branch 'codemirror/master'
2 parents 9f31ef7 + 0374f3f commit e087b3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1837
-249
lines changed

AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Herculano Campos
212212
Hiroyuki Makino
213213
hitsthings
214214
Hocdoc
215+
Hugues Malphettes
215216
Ian Beck
216217
Ian Dickinson
217218
Ian Wehrman
@@ -237,6 +238,7 @@ Jan Keromnes
237238
Jan Odvarko
238239
Jan Schär
239240
Jan T. Sott
241+
Jared Dean
240242
Jared Forsyth
241243
Jason
242244
Jason Barnabe

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 5.13.2 (2016-03-23)
2+
3+
### Bugfixes
4+
5+
Solves a problem where the gutter would sometimes not extend all the way to the end of the document.
6+
17
## 5.13.0 (2016-03-21)
28

39
### New features

addon/comment/comment.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,17 @@
4444
}
4545
});
4646

47+
// Rough heuristic to try and detect lines that are part of multi-line string
48+
function probablyInsideString(cm, pos, line) {
49+
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
50+
}
51+
4752
CodeMirror.defineExtension("lineComment", function(from, to, options) {
4853
if (!options) options = noOptions;
4954
var self = this, mode = self.getModeAt(from);
55+
var firstLine = self.getLine(from.line);
56+
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
57+
5058
var commentString = options.lineComment || mode.lineComment;
5159
if (!commentString) {
5260
if (options.blockCommentStart || mode.blockCommentStart) {
@@ -55,8 +63,7 @@
5563
}
5664
return;
5765
}
58-
var firstLine = self.getLine(from.line);
59-
if (firstLine == null) return;
66+
6067
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
6168
var pad = options.padding == null ? " " : options.padding;
6269
var blankLines = options.commentBlankLines || from.line == to.line;

addon/hint/sql-hint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
}
106106

107107
function nameCompletion(cur, token, result, editor) {
108-
// Try to complete table, colunm names and return start position of completion
108+
// Try to complete table, column names and return start position of completion
109109
var useBacktick = false;
110110
var nameParts = [];
111111
var start = token.start;

addon/search/match-highlighter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// highlighted only if the selected text is a word. showToken, when enabled,
1717
// will cause the current token to be highlighted when nothing is selected.
1818
// delay is used to specify how much time to wait, in milliseconds, before
19-
// highlighting the matches. If annotateScrollbar is enabled, the occurances
19+
// highlighting the matches. If annotateScrollbar is enabled, the occurences
2020
// will be highlighted on the scrollbar via the matchesonscrollbar addon.
2121

2222
(function(mod) {

addon/search/search.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@
121121
persistentDialog(cm, queryDialog, q, function(query, event) {
122122
CodeMirror.e_stop(event);
123123
if (!query) return;
124-
if (query != state.queryText) startSearch(cm, state, query);
124+
if (query != state.queryText) {
125+
startSearch(cm, state, query);
126+
state.posFrom = state.posTo = cm.getCursor();
127+
}
125128
if (hiding) hiding.style.opacity = 1
126129
findNext(cm, event.shiftKey, function(_, to) {
127130
var dialog
@@ -193,7 +196,7 @@
193196
replaceAll(cm, query, text)
194197
} else {
195198
clearSearch(cm);
196-
var cursor = getSearchCursor(cm, query, cm.getCursor());
199+
var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
197200
var advance = function() {
198201
var start = cursor.from(), match;
199202
if (!(match = cursor.findNext())) {

addon/tern/tern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
var data = findDoc(ts, doc);
180180

181181
var argHints = ts.cachedArgHints;
182-
if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) <= 0)
182+
if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0)
183183
ts.cachedArgHints = null;
184184

185185
var changed = data.changed;
@@ -306,7 +306,7 @@
306306
ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) {
307307
if (error || !data.type || !(/^fn\(/).test(data.type)) return;
308308
ts.cachedArgHints = {
309-
start: pos,
309+
start: start,
310310
type: parseFnType(data.type),
311311
name: data.exprName || data.name || "fn",
312312
guess: data.guess,

bin/compress

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// Script files are specified without .js ending. Prefixing them with
1919
// their full (local) path is optional. So you may say lib/codemirror
2020
// or mode/xml/xml to be more precise. In fact, even the .js suffix
21-
// may be speficied, if wanted.
21+
// may be specified, if wanted.
2222

2323
"use strict";
2424

@@ -68,7 +68,7 @@ walk("mode/");
6868
if (!local && !blob) help(false);
6969

7070
if (files.length) {
71-
console.log("Some speficied files were not found: " +
71+
console.log("Some specified files were not found: " +
7272
files.map(function(a){return a.name;}).join(", "));
7373
process.exit(1);
7474
}

doc/compress.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ <h2>Script compression helper</h2>
3636
<input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
3737
<p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px;">
3838
<option value="http://codemirror.net/">HEAD</option>
39+
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.13.2;f=">5.13</option>
3940
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.13.0;f=">5.13</option>
4041
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.12.0;f=">5.12</option>
4142
<option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=5.11.0;f=">5.11</option>
@@ -181,6 +182,7 @@ <h2>Script compression helper</h2>
181182
<option value="http://codemirror.net/mode/perl/perl.js">perl.js</option>
182183
<option value="http://codemirror.net/mode/php/php.js">php.js</option>
183184
<option value="http://codemirror.net/mode/pig/pig.js">pig.js</option>
185+
<option value="http://codemirror.net/mode/powershell/powershell.js">powershell.js</option>
184186
<option value="http://codemirror.net/mode/properties/properties.js">properties.js</option>
185187
<option value="http://codemirror.net/mode/protobuf/protobuf.js">protobuf.js</option>
186188
<option value="http://codemirror.net/mode/python/python.js">python.js</option>
@@ -224,6 +226,7 @@ <h2>Script compression helper</h2>
224226
<option value="http://codemirror.net/mode/verilog/verilog.js">verilog.js</option>
225227
<option value="http://codemirror.net/mode/vhdl/vhdl.js">vhdl.js</option>
226228
<option value="http://codemirror.net/mode/vue/vue.js">vue.js</option>
229+
<option value="http://codemirror.net/mode/webidl/webidl.js">webidl.js</option>
227230
<option value="http://codemirror.net/mode/xml/xml.js">xml.js</option>
228231
<option value="http://codemirror.net/mode/xquery/xquery.js">xquery.js</option>
229232
<option value="http://codemirror.net/mode/yaml/yaml.js">yaml.js</option>

doc/manual.html

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!doctype html>
22

33
<title>CodeMirror: User Manual</title>
44
<meta charset="utf-8"/>
@@ -69,7 +69,7 @@
6969
<section class=first id=overview>
7070
<h2 style="position: relative">
7171
User manual and reference guide
72-
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.13.1</span>
72+
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.13.5</span>
7373
</h2>
7474

7575
<p>CodeMirror is a code-editor component that can be embedded in
@@ -1254,7 +1254,7 @@ <h3 id="api_selection">Cursor and selection methods</h3>
12541254
separator to put between the lines in the output. When multiple
12551255
selections are present, they are concatenated with instances
12561256
of <code>lineSep</code> in between.</dd>
1257-
<dt id="getSelections"><code><strong>doc.getSelections</strong>(?lineSep: string) → string</code></dt>
1257+
<dt id="getSelections"><code><strong>doc.getSelections</strong>(?lineSep: string) → array&lt;string&gt;</code></dt>
12581258
<dd>Returns an array containing a string for each selection,
12591259
representing the content of the selections.</dd>
12601260

@@ -2064,26 +2064,29 @@ <h3 id="api_static">Static properties</h3>
20642064
else (usually one) for dev snapshots.</dd>
20652065

20662066
<dt id="fromTextArea"><code><strong>CodeMirror.fromTextArea</strong>(textArea: TextAreaElement, ?config: object)</code></dt>
2067-
<dd>
2068-
The method provides another way to initialize an editor. It
2069-
takes a textarea DOM node as first argument and an optional
2070-
configuration object as second. It will replace the textarea
2071-
with a CodeMirror instance, and wire up the form of that
2072-
textarea (if any) to make sure the editor contents are put
2073-
into the textarea when the form is submitted. The text in the
2074-
textarea will provide the content for the editor. A CodeMirror
2075-
instance created this way has three additional methods:
2076-
<dl>
2077-
<dt id="save"><code><strong>cm.save</strong>()</code></dt>
2078-
<dd>Copy the content of the editor into the textarea.</dd>
2079-
2080-
<dt id="toTextArea"><code><strong>cm.toTextArea</strong>()</code></dt>
2081-
<dd>Remove the editor, and restore the original textarea (with
2082-
the editor's current content).</dd>
2083-
2084-
<dt id="getTextArea"><code><strong>cm.getTextArea</strong>() → TextAreaElement</code></dt>
2085-
<dd>Returns the textarea that the instance was based on.</dd>
2086-
</dl>
2067+
<dd>This method provides another way to initialize an editor. It
2068+
takes a textarea DOM node as first argument and an optional
2069+
configuration object as second. It will replace the textarea
2070+
with a CodeMirror instance, and wire up the form of that
2071+
textarea (if any) to make sure the editor contents are put into
2072+
the textarea when the form is submitted. The text in the
2073+
textarea will provide the content for the editor. A CodeMirror
2074+
instance created this way has three additional methods:
2075+
<dl>
2076+
<dt id="save"><code><strong>cm.save</strong>()</code></dt>
2077+
<dd>Copy the content of the editor into the textarea.</dd>
2078+
2079+
<dt id="toTextArea"><code><strong>cm.toTextArea</strong>()</code></dt>
2080+
<dd>Remove the editor, and restore the original textarea (with
2081+
the editor's current content). If you dynamically create and
2082+
destroy editors made with `fromTextArea`, without destroying
2083+
the form they are part of, you should make sure to call
2084+
`toTextArea` to remove the editor, or its `"submit"` handler
2085+
on the form will cause a memory leak.</dd>
2086+
2087+
<dt id="getTextArea"><code><strong>cm.getTextArea</strong>() → TextAreaElement</code></dt>
2088+
<dd>Returns the textarea that the instance was based on.</dd>
2089+
</dl>
20872090
</dd>
20882091

20892092
<dt id="defaults"><code><strong>CodeMirror.defaults</strong>: object</code></dt>
@@ -2100,7 +2103,7 @@ <h3 id="api_static">Static properties</h3>
21002103
created from then on.</dd>
21012104

21022105
<dt id="defineDocExtension"><code><strong>CodeMirror.defineDocExtension</strong>(name: string, value: any)</code></dt>
2103-
<dd>Like <a href="#defineExtenstion"><code>defineExtension</code></a>,
2106+
<dd>Like <a href="#defineExtension"><code>defineExtension</code></a>,
21042107
but the method will be added to the interface
21052108
for <a href="#Doc"><code>Doc</code></a> objects instead.</dd>
21062109

0 commit comments

Comments
 (0)