Skip to content

Commit a733d33

Browse files
committed
Merge remote-tracking branch 'codemirror/master'
2 parents d68742a + feed440 commit a733d33

File tree

11 files changed

+62
-27
lines changed

11 files changed

+62
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 5.12.0 (2015-02-19)
1+
## 5.12.0 (2016-02-19)
22

33
### New features
44

addon/display/placeholder.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
if (val && !prev) {
1515
cm.on("blur", onBlur);
1616
cm.on("change", onChange);
17+
cm.on("swapDoc", onChange);
1718
onChange(cm);
1819
} else if (!val && prev) {
1920
cm.off("blur", onBlur);
2021
cm.off("change", onChange);
22+
cm.off("swapDoc", onChange);
2123
clearPlaceholder(cm);
2224
var wrapper = cm.getWrapperElement();
2325
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");

addon/scroll/simplescrollbars.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,20 @@
5959
CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
6060
}
6161

62-
Bar.prototype.moveTo = function(pos, update) {
62+
Bar.prototype.setPos = function(pos) {
6363
if (pos < 0) pos = 0;
6464
if (pos > this.total - this.screen) pos = this.total - this.screen;
65-
if (pos == this.pos) return;
65+
if (pos == this.pos) return false;
6666
this.pos = pos;
6767
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
6868
(pos * (this.size / this.total)) + "px";
69-
if (update !== false) this.scroll(pos, this.orientation);
69+
return true
7070
};
7171

72+
Bar.prototype.moveTo = function(pos) {
73+
if (this.setPos(pos)) this.scroll(pos, this.orientation);
74+
}
75+
7276
var minButtonSize = 10;
7377

7478
Bar.prototype.update = function(scrollSize, clientSize, barSize) {
@@ -83,8 +87,7 @@
8387
}
8488
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
8589
buttonSize + "px";
86-
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
87-
this.pos * (this.size / this.total) + "px";
90+
this.setPos(this.pos);
8891
};
8992

9093
function SimpleScrollbars(cls, place, scroll) {
@@ -111,7 +114,6 @@
111114
if (needsV) {
112115
this.vert.update(measure.scrollHeight, measure.clientHeight,
113116
measure.viewHeight - (needsH ? width : 0));
114-
this.vert.node.style.display = "block";
115117
this.vert.node.style.bottom = needsH ? width + "px" : "0";
116118
}
117119
if (needsH) {
@@ -125,11 +127,11 @@
125127
};
126128

127129
SimpleScrollbars.prototype.setScrollTop = function(pos) {
128-
this.vert.moveTo(pos, false);
130+
this.vert.setPos(pos);
129131
};
130132

131133
SimpleScrollbars.prototype.setScrollLeft = function(pos) {
132-
this.horiz.moveTo(pos, false);
134+
this.horiz.setPos(pos);
133135
};
134136

135137
SimpleScrollbars.prototype.clear = function() {

doc/manual.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,8 @@ <h2>Events</h2>
657657
<strong>"keydown"</strong>, <strong>"keypress"</strong>,
658658
<strong>"keyup"</strong>, <strong>"cut"</strong>, <strong>"copy"</strong>, <strong>"paste"</strong>,
659659
<strong>"dragstart"</strong>, <strong>"dragenter"</strong>,
660-
<strong>"dragover"</strong>, <strong>"drop"</strong>
660+
<strong>"dragover"</strong>, <strong>"dragleave"</strong>,
661+
<strong>"drop"</strong>
661662
(instance: CodeMirror, event: Event)</code></dt>
662663
<dd>Fired when CodeMirror is handling a DOM event of this type.
663664
You can <code>preventDefault</code> the event, or give it a

keymap/vim.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,11 +1696,12 @@
16961696
var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;
16971697
var first = cm.firstLine();
16981698
var last = cm.lastLine();
1699-
// Vim cancels linewise motions that start on an edge and move beyond
1700-
// that edge. It does not cancel motions that do not start on an edge.
1701-
if ((line < first && cur.line == first) ||
1702-
(line > last && cur.line == last)) {
1703-
return;
1699+
// Vim go to line begin or line end when cursor at first/last line and
1700+
// move to previous/next line is triggered.
1701+
if (line < first && cur.line == first){
1702+
return this.moveToStartOfLine(cm, head, motionArgs, vim);
1703+
}else if (line > last && cur.line == last){
1704+
return this.moveToEol(cm, head, motionArgs, vim);
17041705
}
17051706
if (motionArgs.toFirstChar){
17061707
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));

lib/codemirror.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3495,7 +3495,7 @@
34953495
over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
34963496
start: function(e){onDragStart(cm, e);},
34973497
drop: operation(cm, onDrop),
3498-
leave: function() {clearDragCursor(cm);}
3498+
leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
34993499
};
35003500

35013501
var inp = d.input.getField();

mode/dart/dart.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
return null;
7373
}
7474
return false;
75+
},
76+
77+
"/": function(stream, state) {
78+
if (!stream.eat("*")) return false
79+
state.tokenize = tokenNestedComment(1)
80+
return state.tokenize(stream, state)
7581
}
7682
}
7783
});
@@ -121,6 +127,27 @@
121127
return "variable";
122128
}
123129

130+
function tokenNestedComment(depth) {
131+
return function (stream, state) {
132+
var ch
133+
while (ch = stream.next()) {
134+
if (ch == "*" && stream.eat("/")) {
135+
if (depth == 1) {
136+
state.tokenize = null
137+
break
138+
} else {
139+
state.tokenize = tokenNestedComment(depth - 1)
140+
return state.tokenize(stream, state)
141+
}
142+
} else if (ch == "/" && stream.eat("*")) {
143+
state.tokenize = tokenNestedComment(depth + 1)
144+
return state.tokenize(stream, state)
145+
}
146+
}
147+
return "comment"
148+
}
149+
}
150+
124151
CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins));
125152

126153
// This is needed to make loading through meta.js work.

mode/jsx/jsx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
context.prev && copyContext(context.prev))
2626
}
2727

28-
CodeMirror.defineMode("jsx", function(config) {
28+
CodeMirror.defineMode("jsx", function(config, modeConfig) {
2929
var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
30-
var jsMode = CodeMirror.getMode(config, "javascript")
30+
var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
3131

3232
function flatXMLIndent(state) {
3333
var tagName = state.tagName

mode/velocity/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ <h2>Velocity mode</h2>
7777

7878
$someObject("This plus $something in the middle").method(7567).property
7979

80+
#set($something = "Parseable string with '$quotes'!")
81+
8082
#macro( tablerows $color $somelist )
8183
#foreach( $something in $somelist )
8284
<tr><td bgcolor=$color>$something</td></tr>

mode/velocity/velocity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CodeMirror.defineMode("velocity", function() {
3434
state.beforeParams = false;
3535
var ch = stream.next();
3636
// start of unparsed string?
37-
if ((ch == "'") && state.inParams) {
37+
if ((ch == "'") && !state.inString && state.inParams) {
3838
state.lastTokenWasBuiltin = false;
3939
return chain(stream, state, tokenString(ch));
4040
}

0 commit comments

Comments
 (0)