Skip to content
Browse files

Remove remaining uses of tabMode and enterMode in demos

  • Loading branch information...
1 parent 0141579 commit b538a4ed74367cc66bc1d3067826ee60887e8d29 @marijnh marijnh committed Jan 28, 2014
View
3 demo/changemode.html
@@ -41,8 +41,7 @@
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "scheme",
- lineNumbers: true,
- tabMode: "indent"
+ lineNumbers: true
});
var pending;
editor.on("change", function() {
View
105 demo/fullscreen.html
@@ -27,85 +27,38 @@
<article>
<h2>Full Screen Editing</h2>
<form><textarea id="code" name="code" rows="5">
- <dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
- <dd>Whether, when indenting, the first N*8 spaces should be
- replaced by N tabs. Default is false.</dd>
+<dl>
+ <dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
+ <dd>Whether, when indenting, the first N*<code>tabSize</code>
+ spaces should be replaced by N tabs. Default is false.</dd>
- <dt id="option_tabMode"><code>tabMode (string)</code></dt>
- <dd>Determines what happens when the user presses the tab key.
- Must be one of the following:
- <dl>
- <dt><code>"classic" (the default)</code></dt>
- <dd>When nothing is selected, insert a tab. Otherwise,
- behave like the <code>"shift"</code> mode. (When shift is
- held, this behaves like the <code>"indent"</code> mode.)</dd>
- <dt><code>"shift"</code></dt>
- <dd>Indent all selected lines by
- one <a href="#option_indentUnit"><code>indentUnit</code></a>.
- If shift was held while pressing tab, un-indent all selected
- lines one unit.</dd>
- <dt><code>"indent"</code></dt>
- <dd>Indent the line the 'correctly', based on its syntactic
- context. Only works if the
- mode <a href="#indent">supports</a> it.</dd>
- <dt><code>"default"</code></dt>
- <dd>Do not capture tab presses, let the browser apply its
- default behaviour (which usually means it skips to the next
- control).</dd>
- </dl></dd>
+ <dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
+ <dd>Configures whether the editor should re-indent the current
+ line when a character is typed that might change its proper
+ indentation (only works if the mode supports indentation).
+ Default is true.</dd>
- <dt id="option_enterMode"><code>enterMode (string)</code></dt>
- <dd>Determines whether and how new lines are indented when the
- enter key is pressed. The following modes are supported:
- <dl>
- <dt><code>"indent" (the default)</code></dt>
- <dd>Use the mode's indentation rules to give the new line
- the correct indentation.</dd>
- <dt><code>"keep"</code></dt>
- <dd>Indent the line the same as the previous line.</dd>
- <dt><code>"flat"</code></dt>
- <dd>Do not indent the new line.</dd>
- </dl></dd>
-
- <dt id="option_enterMode"><code>enterMode (string)</code></dt>
- <dd>Determines whether and how new lines are indented when the
- enter key is pressed. The following modes are supported:
- <dl>
- <dt><code>"indent" (the default)</code></dt>
- <dd>Use the mode's indentation rules to give the new line
- the correct indentation.</dd>
- <dt><code>"keep"</code></dt>
- <dd>Indent the line the same as the previous line.</dd>
- <dt><code>"flat"</code></dt>
- <dd>Do not indent the new line.</dd>
- </dl></dd>
-
- <dt id="option_enterMode"><code>enterMode (string)</code></dt>
- <dd>Determines whether and how new lines are indented when the
- enter key is pressed. The following modes are supported:
- <dl>
- <dt><code>"indent" (the default)</code></dt>
- <dd>Use the mode's indentation rules to give the new line
- the correct indentation.</dd>
- <dt><code>"keep"</code></dt>
- <dd>Indent the line the same as the previous line.</dd>
- <dt><code>"flat"</code></dt>
- <dd>Do not indent the new line.</dd>
- </dl></dd>
-
- <dt id="option_enterMode"><code>enterMode (string)</code></dt>
- <dd>Determines whether and how new lines are indented when the
- enter key is pressed. The following modes are supported:
- <dl>
- <dt><code>"indent" (the default)</code></dt>
- <dd>Use the mode's indentation rules to give the new line
- the correct indentation.</dd>
- <dt><code>"keep"</code></dt>
- <dd>Indent the line the same as the previous line.</dd>
- <dt><code>"flat"</code></dt>
- <dd>Do not indent the new line.</dd>
- </dl></dd>
+ <dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
+ <dd>A regular expression used to determine which characters
+ should be replaced by a
+ special <a href="#option_specialCharPlaceholder">placeholder</a>.
+ Mostly useful for non-printing special characters. The default
+ is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
+ <dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
+ <dd>A function that, given a special character identified by
+ the <a href="#option_specialChars"><code>specialChars</code></a>
+ option, produces a DOM node that is used to represent the
+ character. By default, a red dot (<span style="color: red">•</span>)
+ is shown, with a title tooltip to indicate the character code.</dd>
+ <dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
+ <dd>Determines whether horizontal cursor movement through
+ right-to-left (Arabic, Hebrew) text is visual (pressing the left
+ arrow moves the cursor left) or logical (pressing the left arrow
+ moves to the next lower index in the string, which is visually
+ right in right-to-left text). The default is <code>false</code>
+ on Windows, and <code>true</code> on other platforms.</dd>
+</dl>
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
View
3 demo/preview.html
@@ -68,8 +68,7 @@
var delay;
// Initialize CodeMirror editor with a nice html5 canvas demo.
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
- mode: 'text/html',
- tabMode: 'indent'
+ mode: 'text/html'
});
editor.on("change", function() {
clearTimeout(delay);
View
67 demo/search.html
@@ -31,45 +31,38 @@
<article>
<h2>Search/Replace Demo</h2>
<form><textarea id="code" name="code">
- <dt id="option_indentWithTabs"><code>indentWithTabs (boolean)</code></dt>
- <dd>Whether, when indenting, the first N*8 spaces should be
- replaced by N tabs. Default is false.</dd>
+<dl>
+ <dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
+ <dd>Whether, when indenting, the first N*<code>tabSize</code>
+ spaces should be replaced by N tabs. Default is false.</dd>
- <dt id="option_tabMode"><code>tabMode (string)</code></dt>
- <dd>Determines what happens when the user presses the tab key.
- Must be one of the following:
- <dl>
- <dt><code>"classic" (the default)</code></dt>
- <dd>When nothing is selected, insert a tab. Otherwise,
- behave like the <code>"shift"</code> mode. (When shift is
- held, this behaves like the <code>"indent"</code> mode.)</dd>
- <dt><code>"shift"</code></dt>
- <dd>Indent all selected lines by
- one <a href="#option_indentUnit"><code>indentUnit</code></a>.
- If shift was held while pressing tab, un-indent all selected
- lines one unit.</dd>
- <dt><code>"indent"</code></dt>
- <dd>Indent the line the 'correctly', based on its syntactic
- context. Only works if the
- mode <a href="#indent">supports</a> it.</dd>
- <dt><code>"default"</code></dt>
- <dd>Do not capture tab presses, let the browser apply its
- default behaviour (which usually means it skips to the next
- control).</dd>
- </dl></dd>
+ <dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
+ <dd>Configures whether the editor should re-indent the current
+ line when a character is typed that might change its proper
+ indentation (only works if the mode supports indentation).
+ Default is true.</dd>
- <dt id="option_enterMode"><code>enterMode (string)</code></dt>
- <dd>Determines whether and how new lines are indented when the
- enter key is pressed. The following modes are supported:
- <dl>
- <dt><code>"indent" (the default)</code></dt>
- <dd>Use the mode's indentation rules to give the new line
- the correct indentation.</dd>
- <dt><code>"keep"</code></dt>
- <dd>Indent the line the same as the previous line.</dd>
- <dt><code>"flat"</code></dt>
- <dd>Do not indent the new line.</dd>
- </dl></dd>
+ <dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
+ <dd>A regular expression used to determine which characters
+ should be replaced by a
+ special <a href="#option_specialCharPlaceholder">placeholder</a>.
+ Mostly useful for non-printing special characters. The default
+ is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
+ <dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
+ <dd>A function that, given a special character identified by
+ the <a href="#option_specialChars"><code>specialChars</code></a>
+ option, produces a DOM node that is used to represent the
+ character. By default, a red dot (<span style="color: red">•</span>)
+ is shown, with a title tooltip to indicate the character code.</dd>
+
+ <dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
+ <dd>Determines whether horizontal cursor movement through
+ right-to-left (Arabic, Hebrew) text is visual (pressing the left
+ arrow moves the cursor left) or logical (pressing the left arrow
+ moves to the next lower index in the string, which is visually
+ right in right-to-left text). The default is <code>false</code>
+ on Windows, and <code>true</code> on other platforms.</dd>
+</dl>
</textarea></form>
<script>
View
1 mode/eiffel/index.html
@@ -417,7 +417,6 @@
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-eiffel",
- tabMode: "indent",
indentUnit: 4,
lineNumbers: true,
theme: "neat"
View
4 mode/htmlembedded/index.html
@@ -46,9 +46,7 @@
lineNumbers: true,
mode: "application/x-ejs",
indentUnit: 4,
- indentWithTabs: true,
- enterMode: "keep",
- tabMode: "shift"
+ indentWithTabs: true
});
</script>
View
2 mode/htmlmixed/index.html
@@ -62,7 +62,7 @@
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: mixedMode, tabMode: "indent"});
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: mixedMode});
</script>
<p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
View
1 mode/julia/index.html
@@ -178,7 +178,6 @@
},
lineNumbers: true,
indentUnit: 4,
- tabMode: "shift",
matchBrackets: true
});
</script>
View
1 mode/lua/index.html
@@ -69,7 +69,6 @@
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- tabMode: "indent",
matchBrackets: true,
theme: "neat"
});
View
5 mode/mirc/index.html
@@ -147,10 +147,9 @@
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- tabMode: "indent",
- theme: "twilight",
+ theme: "twilight",
lineNumbers: true,
- matchBrackets: true,
+ matchBrackets: true,
indentUnit: 4,
mode: "text/mirc"
});
View
1 mode/octave/index.html
@@ -86,7 +86,6 @@
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
- tabMode: "shift",
matchBrackets: true
});
</script>
View
4 mode/php/index.html
@@ -48,9 +48,7 @@
matchBrackets: true,
mode: "application/x-httpd-php",
indentUnit: 4,
- indentWithTabs: true,
- enterMode: "keep",
- tabMode: "shift"
+ indentWithTabs: true
});
</script>
View
2 mode/python/index.html
@@ -150,7 +150,6 @@
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
- tabMode: "shift",
matchBrackets: true
});
@@ -160,7 +159,6 @@
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 4,
- tabMode: "shift",
matchBrackets: true
});
</script>
View
3 mode/rpm/changes/index.html
@@ -58,8 +58,7 @@
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: {name: "changes"},
lineNumbers: true,
- indentUnit: 4,
- tabMode: "shift"
+ indentUnit: 4
});
</script>
View
1 mode/ruby/index.html
@@ -170,7 +170,6 @@
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-ruby",
- tabMode: "indent",
matchBrackets: true,
indentUnit: 4
});
View
3 mode/rust/index.html
@@ -52,8 +52,7 @@
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- lineNumbers: true,
- tabMode: "indent"
+ lineNumbers: true
});
</script>
View
1 mode/sparql/index.html
@@ -44,7 +44,6 @@
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "application/x-sparql-query",
- tabMode: "indent",
matchBrackets: true
});
</script>
View
15 mode/tcl/index.html
@@ -77,13 +77,13 @@
proc whois::311 {from key text} {
if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
- $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
+ $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
}
}
proc whois::multi {from key text} {
if {[regexp {\:(.*)$} $text match $key]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
- return 1
+ return 1
}
}
proc whois::312 {from key text} {
@@ -98,7 +98,7 @@
proc whois::317 {from key text} {
if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
- [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
+ [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
}
}
proc whois::301 {from key text} {
@@ -108,7 +108,7 @@
}
proc whois::318 {from key text} {
namespace eval whois {
- variable channel ""
+ variable channel ""
}
variable whois::channel ""
}
@@ -118,8 +118,8 @@
proc whois::list {nick host hand chan text} {
if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
namespace eval whois {
- variable channel ""
- }
+ variable channel ""
+ }
variable whois::channel $chan
putserv "WHOIS $text"
}
@@ -129,8 +129,7 @@
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- tabMode: "indent",
- theme: "night",
+ theme: "night",
lineNumbers: true,
indentUnit: 2,
scrollPastEnd: true,
View
1 mode/tiddlywiki/index.html
@@ -144,7 +144,6 @@
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: 'tiddlywiki',
lineNumbers: true,
- enterMode: 'keep',
matchBrackets: true
});
</script>
View
1 mode/turtle/index.html
@@ -41,7 +41,6 @@
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/turtle",
- tabMode: "indent",
matchBrackets: true
});
</script>
View
3 mode/vb/index.html
@@ -81,8 +81,7 @@
editor = CodeMirror.fromTextArea(document.getElementById("solution"), {
lineNumbers: true,
mode: "text/x-vb",
- readOnly: false,
- tabMode: "shift"
+ readOnly: false
});
runTest();
}
View
1 mode/velocity/index.html
@@ -106,7 +106,6 @@
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- tabMode: "indent",
theme: "night",
lineNumbers: true,
indentUnit: 4,
View
4 test/test.js
@@ -172,15 +172,15 @@ test("core_defaults", function() {
for (var opt in defs) defsCopy[opt] = defs[opt];
defs.indentUnit = 5;
defs.value = "uu";
- defs.enterMode = "keep";
+ defs.indentWithTabs = true;
defs.tabindex = 55;
var place = document.getElementById("testground"), cm = CodeMirror(place);
try {
eq(cm.getOption("indentUnit"), 5);
cm.setOption("indentUnit", 10);
eq(defs.indentUnit, 5);
eq(cm.getValue(), "uu");
- eq(cm.getOption("enterMode"), "keep");
+ eq(cm.getOption("indentWithTabs"), true);
eq(cm.getInputField().tabIndex, 55);
}
finally {

0 comments on commit b538a4e

Please sign in to comment.
Something went wrong with that request. Please try again.