1,473 changes: 1,025 additions & 448 deletions lib/codemirror.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codemirror",
"version":"4.13.0",
"version":"5.0.0",
"main": "lib/codemirror.js",
"description": "In-browser code editing made bearable",
"licenses": [{"type": "MIT",
Expand Down
7 changes: 5 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ testCM("selectAllNoScroll", function(cm) {
});

testCM("selectionPos", function(cm) {
if (phantom) return;
if (phantom || cm.getOption("inputStyle") != "textarea") return;
cm.setSize(100, 100);
addDoc(cm, 200, 100);
cm.setSelection(Pos(1, 100), Pos(98, 100));
Expand Down Expand Up @@ -811,6 +811,7 @@ testCM("collapsedRangeCoordsChar", function(cm) {
}, {value: "123456\nabcdef\nghijkl\nmnopqr\n"});

testCM("collapsedRangeBetweenLinesSelected", function(cm) {
if (cm.getOption("inputStyle") != "textarea") return;
var widget = document.createElement("span");
widget.textContent = "\u2194";
cm.markText(Pos(0, 3), Pos(1, 0), {replacedWith: widget});
Expand Down Expand Up @@ -1091,6 +1092,7 @@ testCM("measureEndOfLine", function(cm) {
}, {mode: "text/html", value: "<!-- foo barrr -->", lineWrapping: true}, ie_lt8 || opera_lt10);

testCM("scrollVerticallyAndHorizontally", function(cm) {
if (cm.getOption("inputStyle") != "textarea") return;
cm.setSize(100, 100);
addDoc(cm, 40, 40);
cm.setCursor(39);
Expand Down Expand Up @@ -1319,6 +1321,7 @@ testCM("verticalMovementCommandsWrapping", function(cm) {
lineWrapping: true});

testCM("rtlMovement", function(cm) {
if (cm.getOption("inputStyle") != "textarea") return;
forEach(["خحج", "خحabcخحج", "abخحخحجcd", "abخde", "abخح2342خ1حج", "خ1ح2خح3حxج",
"خحcd", "1خحcd", "abcdeح1ج", "خمرحبها مها!", "foobarر", "خ ة ق",
"<img src=\"/בדיקה3.jpg\">"], function(line) {
Expand Down Expand Up @@ -1388,7 +1391,7 @@ testCM("lineChangeEvents", function(cm) {
});

testCM("scrollEntirelyToRight", function(cm) {
if (phantom) return;
if (phantom || cm.getOption("inputStyle") != "textarea") return;
addDoc(cm, 500, 2);
cm.setCursor(Pos(0, 500));
var wrap = cm.getWrapperElement(), cur = byClassName(wrap, "CodeMirror-cursor")[0];
Expand Down
2 changes: 2 additions & 0 deletions theme/3024-day.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;}
.cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;}
.cm-s-3024-day.CodeMirror ::selection { background: #d6d5d4; }
.cm-s-3024-day.CodeMirror ::-moz-selection { background: #d9d9d9; }

.cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;}
.cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; }
Expand Down
2 changes: 2 additions & 0 deletions theme/3024-night.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;}
.cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;}
.cm-s-3024-night.CodeMirror ::selection { background: rgba(58, 52, 50, .99); }
.cm-s-3024-night.CodeMirror ::-moz-selection { background: rgba(58, 52, 50, .99); }
.cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;}
.cm-s-3024-night .CodeMirror-guttermarker { color: #db2d20; }
.cm-s-3024-night .CodeMirror-guttermarker-subtle { color: #5c5855; }
Expand Down
10 changes: 4 additions & 6 deletions theme/ambiance.css
2 changes: 2 additions & 0 deletions theme/base16-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;}
.cm-s-base16-dark div.CodeMirror-selected {background: #303030 !important;}
.cm-s-base16-dark.CodeMirror ::selection { background: rgba(48, 48, 48, .99); }
.cm-s-base16-dark.CodeMirror ::-moz-selection { background: rgba(48, 48, 48, .99); }
.cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;}
.cm-s-base16-dark .CodeMirror-guttermarker { color: #ac4142; }
.cm-s-base16-dark .CodeMirror-guttermarker-subtle { color: #505050; }
Expand Down
2 changes: 2 additions & 0 deletions theme/base16-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;}
.cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;}
.cm-s-base16-light.CodeMirror ::selection { background: #e0e0e0; }
.cm-s-base16-light.CodeMirror ::-moz-selection { background: #e0e0e0; }
.cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;}
.cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; }
.cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; }
Expand Down
2 changes: 2 additions & 0 deletions theme/blackboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
.cm-s-blackboard.CodeMirror ::selection { background: rgba(37, 59, 118, .99); }
.cm-s-blackboard.CodeMirror ::-moz-selection { background: rgba(37, 59, 118, .99); }
.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; }
.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; }
Expand Down
2 changes: 2 additions & 0 deletions theme/cobalt.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.cm-s-cobalt.CodeMirror { background: #002240; color: white; }
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
.cm-s-cobalt.CodeMirror ::selection { background: rgba(179, 101, 57, .99); }
.cm-s-cobalt.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); }
.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-cobalt .CodeMirror-guttermarker { color: #ffee80; }
.cm-s-cobalt .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
Expand Down
2 changes: 2 additions & 0 deletions theme/erlang-dark.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
.cm-s-erlang-dark.CodeMirror ::selection { background: rgba(179, 101, 57, .99); }
.cm-s-erlang-dark.CodeMirror ::-moz-selection { background: rgba(179, 101, 57, .99); }
.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-erlang-dark .CodeMirror-guttermarker { color: white; }
.cm-s-erlang-dark .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
Expand Down
2 changes: 2 additions & 0 deletions theme/lesser-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Ported to CodeMirror by Peter Kroon
}
.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
.cm-s-lesser-dark.CodeMirror ::selection { background: rgba(69, 68, 59, .99); }
.cm-s-lesser-dark.CodeMirror ::-moz-selection { background: rgba(69, 68, 59, .99); }
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/

Expand Down
2 changes: 2 additions & 0 deletions theme/mbo.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

.cm-s-mbo.CodeMirror {background: #2c2c2c; color: #ffffec;}
.cm-s-mbo div.CodeMirror-selected {background: #716C62 !important;}
.cm-s-mbo.CodeMirror ::selection { background: rgba(113, 108, 98, .99); }
.cm-s-mbo.CodeMirror ::-moz-selection { background: rgba(113, 108, 98, .99); }
.cm-s-mbo .CodeMirror-gutters {background: #4e4e4e; border-right: 0px;}
.cm-s-mbo .CodeMirror-guttermarker { color: white; }
.cm-s-mbo .CodeMirror-guttermarker-subtle { color: grey; }
Expand Down
2 changes: 2 additions & 0 deletions theme/mdn-like.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
.cm-s-mdn-like.CodeMirror { color: #999; background-color: #fff; }
.cm-s-mdn-like .CodeMirror-selected { background: #cfc !important; }
.cm-s-mdn-like.CodeMirror ::selection { background: #cfc; }
.cm-s-mdn-like.CodeMirror ::-moz-selection { background: #cfc; }

.cm-s-mdn-like .CodeMirror-gutters { background: #f8f8f8; border-left: 6px solid rgba(0,83,159,0.65); color: #333; }
.cm-s-mdn-like .CodeMirror-linenumber { color: #aaa; margin-left: 3px; }
Expand Down
2 changes: 2 additions & 0 deletions theme/midnight.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
.cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}

.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;}
.cm-s-midnight.CodeMirror ::selection { background: rgba(49, 77, 103, .99); }
.cm-s-midnight.CodeMirror ::-moz-selection { background: rgba(49, 77, 103, .99); }
.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;}
.cm-s-midnight .CodeMirror-guttermarker { color: white; }
.cm-s-midnight .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
Expand Down
2 changes: 2 additions & 0 deletions theme/monokai.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
.cm-s-monokai.CodeMirror ::selection { background: rgba(73, 72, 62, .99); }
.cm-s-monokai.CodeMirror ::-moz-selection { background: rgba(73, 72, 62, .99); }
.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
.cm-s-monokai .CodeMirror-guttermarker { color: white; }
.cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
Expand Down
2 changes: 2 additions & 0 deletions theme/night.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
.cm-s-night div.CodeMirror-selected { background: #447 !important; }
.cm-s-night.CodeMirror ::selection { background: rgba(68, 68, 119, .99); }
.cm-s-night.CodeMirror ::-moz-selection { background: rgba(68, 68, 119, .99); }
.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-night .CodeMirror-guttermarker { color: white; }
.cm-s-night .CodeMirror-guttermarker-subtle { color: #bbb; }
Expand Down
2 changes: 2 additions & 0 deletions theme/paraiso-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-paraiso-dark.CodeMirror {background: #2f1e2e; color: #b9b6b0;}
.cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f !important;}
.cm-s-paraiso-dark.CodeMirror ::selection { background: rgba(65, 50, 63, .99); }
.cm-s-paraiso-dark.CodeMirror ::-moz-selection { background: rgba(65, 50, 63, .99); }
.cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e; border-right: 0px;}
.cm-s-paraiso-dark .CodeMirror-guttermarker { color: #ef6155; }
.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle { color: #776e71; }
Expand Down
2 changes: 2 additions & 0 deletions theme/paraiso-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-paraiso-light.CodeMirror {background: #e7e9db; color: #41323f;}
.cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0 !important;}
.cm-s-paraiso-light.CodeMirror ::selection { background: #b9b6b0; }
.cm-s-paraiso-light.CodeMirror ::-moz-selection { background: #b9b6b0; }
.cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db; border-right: 0px;}
.cm-s-paraiso-light .CodeMirror-guttermarker { color: black; }
.cm-s-paraiso-light .CodeMirror-guttermarker-subtle { color: #8d8687; }
Expand Down
3 changes: 3 additions & 0 deletions theme/pastel-on-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
font-size: 14px;
}
.cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2) !important; }
.cm-s-pastel-on-dark.CodeMirror ::selection { background: rgba(221,240,255,0.2); }
.cm-s-pastel-on-dark.CodeMirror ::-moz-selection { background: rgba(221,240,255,0.2); }

.cm-s-pastel-on-dark .CodeMirror-gutters {
background: #34302f;
border-right: 0px;
Expand Down
2 changes: 2 additions & 0 deletions theme/rubyblue.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
.cm-s-rubyblue.CodeMirror ::selection { background: rgba(56, 86, 111, 0.99); }
.cm-s-rubyblue.CodeMirror ::-moz-selection { background: rgba(56, 86, 111, 0.99); }
.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
.cm-s-rubyblue .CodeMirror-guttermarker { color: white; }
.cm-s-rubyblue .CodeMirror-guttermarker-subtle { color: #3E7087; }
Expand Down
12 changes: 6 additions & 6 deletions theme/solarized.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
border-bottom: 1px dotted #dc322f;
}

.cm-s-solarized.cm-s-dark .CodeMirror-selected {
background: #073642;
}
.cm-s-solarized.cm-s-dark .CodeMirror-selected { background: #073642; }
.cm-s-solarized.cm-s-dark.CodeMirror ::selection { background: rgba(7, 54, 66, 0.99); }
.cm-s-solarized.cm-s-dark.CodeMirror ::-moz-selection { background: rgba(7, 54, 66, 0.99); }

.cm-s-solarized.cm-s-light .CodeMirror-selected {
background: #eee8d5;
}
.cm-s-solarized.cm-s-light .CodeMirror-selected { background: #eee8d5; }
.cm-s-solarized.cm-s-light.CodeMirror ::selection { background: #eee8d5; }
.cm-s-solarized.cm-s-lightCodeMirror ::-moz-selection { background: #eee8d5; }

/* Editor styling */

Expand Down
2 changes: 2 additions & 0 deletions theme/the-matrix.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; }
.cm-s-the-matrix div.CodeMirror-selected { background: #2D2D2D !important; }
.cm-s-the-matrix.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); }
.cm-s-the-matrix.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); }
.cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; }
.cm-s-the-matrix .CodeMirror-guttermarker { color: #0f0; }
.cm-s-the-matrix .CodeMirror-guttermarker-subtle { color: white; }
Expand Down
2 changes: 2 additions & 0 deletions theme/tomorrow-night-eighties.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

.cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;}
.cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;}
.cm-s-tomorrow-night-eighties.CodeMirror ::selection { background: rgba(45, 45, 45, 0.99); }
.cm-s-tomorrow-night-eighties.CodeMirror ::-moz-selection { background: rgba(45, 45, 45, 0.99); }
.cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;}
.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker { color: #f2777a; }
.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle { color: #777; }
Expand Down
2 changes: 2 additions & 0 deletions theme/twilight.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
.cm-s-twilight.CodeMirror ::selection { background: rgba(50, 50, 50, 0.99); }
.cm-s-twilight.CodeMirror ::-moz-selection { background: rgba(50, 50, 50, 0.99); }

.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
.cm-s-twilight .CodeMirror-guttermarker { color: white; }
Expand Down
2 changes: 2 additions & 0 deletions theme/vibrant-ink.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

.cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
.cm-s-vibrant-ink.CodeMirror ::selection { background: rgba(53, 73, 60, 0.99); }
.cm-s-vibrant-ink.CodeMirror ::-moz-selection { background: rgba(53, 73, 60, 0.99); }

.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
.cm-s-vibrant-ink .CodeMirror-guttermarker { color: white; }
Expand Down
2 changes: 2 additions & 0 deletions theme/xq-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ THE SOFTWARE.
*/
.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
.cm-s-xq-dark .CodeMirror-selected { background: #27007A !important; }
.cm-s-xq-dark.CodeMirror ::selection { background: rgba(39, 0, 122, 0.99); }
.cm-s-xq-dark.CodeMirror ::-moz-selection { background: rgba(39, 0, 122, 0.99); }
.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
.cm-s-xq-dark .CodeMirror-guttermarker { color: #FFBD40; }
.cm-s-xq-dark .CodeMirror-guttermarker-subtle { color: #f8f8f8; }
Expand Down