erp_app 3.0.12 → 3.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/lib/erp_app/version.rb +1 -1
  2. data/public/javascripts/erp_app/codemirror/doc/compress.html +27 -25
  3. data/public/javascripts/erp_app/codemirror/doc/manual.html +8 -1
  4. data/public/javascripts/erp_app/codemirror/doc/oldrelease.html +51 -0
  5. data/public/javascripts/erp_app/codemirror/doc/realworld.html +72 -0
  6. data/public/javascripts/erp_app/codemirror/keymap/vim.js +9 -10
  7. data/public/javascripts/erp_app/codemirror/lib/codemirror.css +1 -0
  8. data/public/javascripts/erp_app/codemirror/lib/codemirror.js +53 -31
  9. data/public/javascripts/erp_app/codemirror/lib/util/overlay.js +6 -1
  10. data/public/javascripts/erp_app/codemirror/lib/util/runmode.js +1 -1
  11. data/public/javascripts/erp_app/codemirror/lib/util/searchcursor.js +3 -3
  12. data/public/javascripts/erp_app/codemirror/lib/util/simple-hint.js +9 -4
  13. data/public/javascripts/erp_app/codemirror/mode/clike/clike.js +1 -0
  14. data/public/javascripts/erp_app/codemirror/mode/css/css.js +1 -1
  15. data/public/javascripts/erp_app/codemirror/mode/css/test.js +2 -2
  16. data/public/javascripts/erp_app/codemirror/mode/gfm/gfm.js +83 -139
  17. data/public/javascripts/erp_app/codemirror/mode/gfm/index.html +27 -4
  18. data/public/javascripts/erp_app/codemirror/mode/gfm/test.js +225 -0
  19. data/public/javascripts/erp_app/codemirror/mode/htmlembedded/htmlembedded.js +1 -0
  20. data/public/javascripts/erp_app/codemirror/mode/javascript/index.html +11 -4
  21. data/public/javascripts/erp_app/codemirror/mode/javascript/javascript.js +63 -15
  22. data/public/javascripts/erp_app/codemirror/mode/javascript/typescript.html +48 -0
  23. data/public/javascripts/erp_app/codemirror/mode/lua/lua.js +1 -1
  24. data/public/javascripts/erp_app/codemirror/mode/markdown/markdown.js +122 -23
  25. data/public/javascripts/erp_app/codemirror/mode/markdown/test.js +183 -1
  26. data/public/javascripts/erp_app/codemirror/package.json +1 -1
  27. data/public/javascripts/erp_app/codemirror/test/index.html +3 -0
  28. data/public/javascripts/erp_app/codemirror/test/test.js +11 -6
  29. metadata +15 -32
@@ -2,7 +2,7 @@ module ErpApp
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 12
5
+ TINY = 13
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
@@ -30,30 +30,32 @@
30
30
  <input type="hidden" id="download" name="download" value="codemirror-compressed.js"/>
31
31
  <p>Version: <select id="version" onchange="setVersion(this);" style="padding: 1px">
32
32
  <option value="http://codemirror.net/">HEAD</option>
33
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v3.0beta1;f=">3.0beta1</option>
34
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.34;f=">2.34</option>
35
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.33;f=">2.33</option>
36
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.32;f=">2.32</option>
37
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.31;f=">2.31</option>
38
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.3;f=">2.3</option>
39
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.25;f=">2.25</option>
40
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.24;f=">2.24</option>
41
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.23;f=">2.23</option>
42
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.22;f=">2.22</option>
43
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.21;f=">2.21</option>
44
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.2;f=">2.2</option>
45
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.18;f=">2.18</option>
46
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.16;f=">2.16</option>
47
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.15;f=">2.15</option>
48
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.13;f=">2.13</option>
49
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.12;f=">2.12</option>
50
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.11;f=">2.11</option>
51
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.1;f=">2.1</option>
52
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.02;f=">2.02</option>
53
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.01;f=">2.01</option>
54
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=v2.0;f=">2.0</option>
55
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta2;f=">beta2</option>
56
- <option value="http://marijnhaverbeke.nl/git/codemirror2?a=blob_plain;hb=beta1;f=">beta1</option>
33
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v3.0beta2;f=">3.0beta2</option>
34
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.35;f=">2.35</option>
35
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v3.0beta1;f=">3.0beta1</option>
36
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.34;f=">2.34</option>
37
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.33;f=">2.33</option>
38
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.32;f=">2.32</option>
39
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.31;f=">2.31</option>
40
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.3;f=">2.3</option>
41
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.25;f=">2.25</option>
42
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.24;f=">2.24</option>
43
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.23;f=">2.23</option>
44
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.22;f=">2.22</option>
45
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.21;f=">2.21</option>
46
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.2;f=">2.2</option>
47
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.18;f=">2.18</option>
48
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.16;f=">2.16</option>
49
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.15;f=">2.15</option>
50
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.13;f=">2.13</option>
51
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.12;f=">2.12</option>
52
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.11;f=">2.11</option>
53
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.1;f=">2.1</option>
54
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.02;f=">2.02</option>
55
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.01;f=">2.01</option>
56
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=v2.0;f=">2.0</option>
57
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=beta2;f=">beta2</option>
58
+ <option value="http://marijnhaverbeke.nl/git/codemirror?a=blob_plain;hb=beta1;f=">beta1</option>
57
59
  </select></p>
58
60
 
59
61
  <select multiple="multiple" size="20" name="code_url" style="width: 40em;" class="field" id="files">
@@ -153,7 +155,7 @@
153
155
  continue;
154
156
  else if (m = opt.value.match(/^http:\/\/codemirror.net\/(.*)$/))
155
157
  opt.value = urlprefix + m[1];
156
- else if (m = opt.value.match(/http:\/\/marijnhaverbeke.nl\/git\/codemirror2\?a=blob_plain;hb=[^;]+;f=(.*)$/))
158
+ else if (m = opt.value.match(/http:\/\/marijnhaverbeke.nl\/git\/codemirror\?a=blob_plain;hb=[^;]+;f=(.*)$/))
157
159
  opt.value = urlprefix + m[1];
158
160
  }
159
161
  }
@@ -838,6 +838,13 @@
838
838
  will cause the given value (usually a method) to be added to all
839
839
  CodeMirror instances created from then on.</p>
840
840
 
841
+ <p id="defineInitHook">If your extention just needs to run some
842
+ code whenever a CodeMirror instance is initialized,
843
+ use <code>CodeMirror.defineInitHook</code>. Give it a function as
844
+ its only argument, and from then on, that function will be called
845
+ (with the instance as argument) whenever a new CodeMirror instance
846
+ is initialized.</p>
847
+
841
848
  <h2 id="addons">Add-ons</h2>
842
849
 
843
850
  <p>The <code>lib/util</code> directory in the distribution
@@ -1120,7 +1127,7 @@
1120
1127
  state.</p>
1121
1128
 
1122
1129
  <p id="indent">If you want your mode to provide smart indentation
1123
- (though the <a href="#indentLine"><code>indentLine</code></a>
1130
+ (through the <a href="#indentLine"><code>indentLine</code></a>
1124
1131
  method and the <code>indentAuto</code>
1125
1132
  and <code>newlineAndIndent</code> commands, which keys can be
1126
1133
  <a href="#option_extraKeys">bound</a> to), you must define
@@ -19,6 +19,57 @@
19
19
  </pre>
20
20
  </div>
21
21
 
22
+ <p class="rel">27-02-2012: <a href="http://codemirror.net/codemirror-2.22.zip">Version 2.22</a>:</p>
23
+
24
+ <ul class="rel-note">
25
+ <li>Allow <a href="manual.html#keymaps">key handlers</a> to pass up events, allow binding characters.</li>
26
+ <li>Add <a href="manual.html#option_autoClearEmptyLines"><code>autoClearEmptyLines</code></a> option.</li>
27
+ <li>Properly use tab stops when rendering tabs.</li>
28
+ <li>Make PHP mode more robust.</li>
29
+ <li>Support indentation blocks in <a href="manual.html#util_foldcode">code folder</a>.</li>
30
+ <li>Add a script for <a href="manual.html#util_match-highlighter">highlighting instances of the selection</a>.</li>
31
+ <li>New <a href="../mode/properties/index.html">.properties</a> mode.</li>
32
+ <li>Fix many bugs.</li>
33
+ </ul>
34
+
35
+ <p class="rel">27-01-2012: <a href="http://codemirror.net/codemirror-2.21.zip">Version 2.21</a>:</p>
36
+
37
+ <ul class="rel-note">
38
+ <li>Added <a href="../mode/less/index.html">LESS</a>, <a href="../mode/mysql/index.html">MySQL</a>,
39
+ <a href="../mode/go/index.html">Go</a>, and <a href="../mode/verilog/index.html">Verilog</a> modes.</li>
40
+ <li>Add <a href="manual.html#option_smartIndent"><code>smartIndent</code></a>
41
+ option.</li>
42
+ <li>Support a cursor in <a href="manual.html#option_readOnly"><code>readOnly</code></a>-mode.</li>
43
+ <li>Support assigning multiple styles to a token.</li>
44
+ <li>Use a new approach to drawing the selection.</li>
45
+ <li>Add <a href="manual.html#scrollTo"><code>scrollTo</code></a> method.</li>
46
+ <li>Allow undo/redo events to span non-adjacent lines.</li>
47
+ <li>Lots and lots of bugfixes.</li>
48
+ </ul>
49
+
50
+ <p class="rel">20-12-2011: <a href="http://codemirror.net/codemirror-2.2.zip">Version 2.2</a>:</p>
51
+
52
+ <ul class="rel-note">
53
+ <li>Slightly incompatible API changes. Read <a href="upgrade_v2.2.html">this</a>.</li>
54
+ <li>New approach
55
+ to <a href="manual.html#option_extraKeys">binding</a> keys,
56
+ support for <a href="manual.html#option_keyMap">custom
57
+ bindings</a>.</li>
58
+ <li>Support for overwrite (insert).</li>
59
+ <li><a href="manual.html#option_tabSize">Custom-width</a>
60
+ and <a href="../demo/visibletabs.html">stylable</a> tabs.</li>
61
+ <li>Moved more code into <a href="manual.html#addons">add-on scripts</a>.</li>
62
+ <li>Support for sane vertical cursor movement in wrapped lines.</li>
63
+ <li>More reliable handling of
64
+ editing <a href="manual.html#markText">marked text</a>.</li>
65
+ <li>Add minimal <a href="../demo/emacs.html">emacs</a>
66
+ and <a href="../demo/vim.html">vim</a> bindings.</li>
67
+ <li>Rename <code>coordsFromIndex</code>
68
+ to <a href="manual.html#posFromIndex"><code>posFromIndex</code></a>,
69
+ add <a href="manual.html#indexFromPos"><code>indexFromPos</code></a>
70
+ method.</li>
71
+ </ul>
72
+
22
73
  <p class="rel">21-11-2011: <a href="http://codemirror.net/codemirror-2.18.zip">Version 2.18</a>:</p>
23
74
  <p class="rel-note">Fixes <code>TextMarker.clear</code>, which is broken in 2.17.</p>
24
75
 
@@ -0,0 +1,72 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>CodeMirror: Real-world uses</title>
6
+ <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Droid+Sans|Droid+Sans:bold"/>
7
+ <link rel="stylesheet" type="text/css" href="docs.css"/>
8
+ </head>
9
+ <body>
10
+
11
+ <h1><span class="logo-braces">{ }</span> <a href="http://codemirror.net/">CodeMirror</a></h1>
12
+
13
+ <div class="grey">
14
+ <img src="baboon.png" class="logo" alt="logo"/>
15
+ <pre>
16
+ /* Real world uses,
17
+ full list */
18
+ </pre>
19
+ </div>
20
+
21
+ <p><a href="mailto:marijnh@gmail.com">Contact me</a> if you'd like
22
+ your project to be added to this list.</p>
23
+
24
+ <ul>
25
+ <li><a href="http://brackets.io">Adobe Brackets</a> (code editor)</li>
26
+ <li><a href="http://bluegriffon.org/">BlueGriffon</a> (HTML editor)</li>
27
+ <li><a href="http://cargocollective.com/">Cargo Collective</a> (creative publishing platform)</li>
28
+ <li><a href="http://www.codebugapp.com/">Codebug</a> (PHP Xdebug front-end)</li>
29
+ <li><a href="http://code.google.com/p/codemirror2-gwt/">CodeMirror2-GWT</a> (Google Web Toolkit wrapper)</li>
30
+ <li><a href="http://codev.it/">Codev</a> (collaborative IDE)</li>
31
+ <li><a href="http://ot.substance.io/demo/">Collaborative CodeMirror demo</a> (CodeMirror + operational transforms)</li>
32
+ <li><a href="http://www.ckwnc.com/">CKWNC</a> (UML editor)</li>
33
+ <li><a href="http://cssdeck.com/">CSSDeck</a> (CSS showcase)</li>
34
+ <li><a href="http://ireneros.com/deck/deck.js-codemirror/introduction/#textarea-code">Deck.js integration</a> (slides with editors)</li>
35
+ <li><a href="http://www.dbninja.com">DbNinja</a> (MySQL access interface)</li>
36
+ <li><a href="http://elm-lang.org/Examples.elm">Elm language examples</a></li>
37
+ <li><a href="http://eloquentjavascript.net/chapter1.html">Eloquent JavaScript</a> (book)</li>
38
+ <li><a href="http://www.fastfig.com/">Fastfig</a> (online computation/math tool)</li>
39
+ <li><a href="http://blog.pamelafox.org/2012/02/interactive-html5-slides-with-fathomjs.html">FathomJS integration</a> (slides with editors, again)</li>
40
+ <li><a href="http://tour.golang.org">Go language tour</a></li>
41
+ <li><a href="https://github.com/github/android">GitHub's Android app</a></li>
42
+ <li><a href="https://script.google.com/">Google Apps Script</a></li>
43
+ <li><a href="http://try.haxe.org">Haxe</a> (Haxe Playground) </li>
44
+ <li><a href="http://megafonweblab.github.com/histone-javascript/">Histone template engine playground</a></li>
45
+ <li><a href="http://icecoder.net">ICEcoder</a> (web IDE)</li>
46
+ <li><a href="http://extensions.joomla.org/extensions/edition/editors/8723">Joomla plugin</a></li>
47
+ <li><a href="http://jsbin.com">jsbin.com</a> (JS playground)</li>
48
+ <li><a href="http://www.jshint.com/">JSHint</a> (JS linter)</li>
49
+ <li><a href="http://kl1p.com/cmtest/1">kl1p</a> (paste service)</li>
50
+ <li><a href="http://www.chris-granger.com/2012/04/12/light-table---a-new-ide-concept/">Light Table</a> (experimental IDE)</li>
51
+ <li><a href="http://www.mergely.com/">Mergely</a> (interactive diffing)</li>
52
+ <li><a href="https://notex.ch">NoTex</a> (rST authoring)</li>
53
+ <li><a href="https://github.com/mamacdon/orion-codemirror">Orion-CodeMirror integration</a> (running CodeMirror modes in Orion)</li>
54
+ <li><a href="http://paperjs.org/">Paper.js</a> (graphics scripting)</li>
55
+ <li><a href="http://prose.io/">Prose.io</a> (github content editor)</li>
56
+ <li><a href="http://ql.io/">ql.io</a> (http API query helper)</li>
57
+ <li><a href="http://qyapp.com">QiYun web app platform</a></li>
58
+ <li><a href="http://ariya.ofilabs.com/2011/09/hybrid-webnative-desktop-codemirror.html">Qt+Webkit integration</a> (building a desktop CodeMirror app)</li>
59
+ <li><a href="http://www.sketchpatch.net/labs/livecodelabIntro.html">sketchPatch Livecodelab</a></li>
60
+ <li><a href="http://www.skulpt.org/">Skulpt</a> (in-browser Python environment)</li.
61
+ <li><a href="http://www.solidshops.com/">SolidShops</a> (hosted e-commerce platform)</li>
62
+ <li><a href="http://sqlfiddle.com">SQLFiddle</a> (SQL playground)</li>
63
+ <li><a href="https://thefiletree.com">The File Tree</a> (collab editor)</li>
64
+ <li><a href="http://enjalot.com/tributary/2636296/sinwaves.js">Tributary</a> (augmented editing)</li>
65
+ <li><a href="http://webglplayground.net/">WebGL playground</a></li>
66
+ <li><a href="http://www.wescheme.org/">WeScheme</a> (learning tool)</li>
67
+ <li><a href="http://wordpress.org/extend/plugins/codemirror-for-codeeditor/">WordPress plugin</a></li>
68
+ <li><a href="http://media.chikuyonok.ru/codemirror2/">Zen Coding</a> (fast XML editing)</li>
69
+ </ul>
70
+
71
+ </body>
72
+ </html>
@@ -318,13 +318,12 @@
318
318
  };
319
319
 
320
320
  // standard mode switching
321
- iterList(["d", "t", "T", "f", "F", "c", "r"],
322
- function (ch) {
323
- CodeMirror.keyMap.vim[toCombo(ch)] = function (cm) {
324
- cm.setOption("keyMap", "vim-prefix-" + ch);
325
- emptyBuffer();
326
- };
327
- });
321
+ iterList(["d", "t", "T", "f", "F", "c", "r"], function (ch) {
322
+ CodeMirror.keyMap.vim[toCombo(ch)] = function (cm) {
323
+ cm.setOption("keyMap", "vim-prefix-" + ch);
324
+ emptyBuffer();
325
+ };
326
+ });
328
327
 
329
328
  function addCountBindings(keyMap) {
330
329
  // Add bindings for number keys
@@ -645,7 +644,7 @@
645
644
  };
646
645
 
647
646
  // Map our movement actions each operator and non-operational movement
648
- motionList.forEach(function(key, index, array) {
647
+ iterList(motionList, function(key, index, array) {
649
648
  CodeMirror.keyMap['vim-prefix-d'][key] = function(cm) {
650
649
  // Get our selected range
651
650
  var start = cm.getCursor();
@@ -695,7 +694,7 @@
695
694
  });
696
695
 
697
696
  var nums = [1,2,3,4,5,6,7,8,9];
698
- nums.forEach(function(key, index, array) {
697
+ iterList(nums, function(key, index, array) {
699
698
  CodeMirror.keyMap['vim'][key] = function (cm) {
700
699
  reptTimes = (reptTimes * 10) + key;
701
700
  };
@@ -713,7 +712,7 @@
713
712
  // Create our keymaps for each operator and make xa and xi where x is an operator
714
713
  // change to the corrosponding keymap
715
714
  var operators = ['d', 'y', 'c'];
716
- operators.forEach(function(key, index, array) {
715
+ iterList(operators, function(key, index, array) {
717
716
  CodeMirror.keyMap['vim-prefix-'+key+'a'] = {
718
717
  auto: 'vim', nofallthrough: true, style: "fat-cursor"
719
718
  };
@@ -80,6 +80,7 @@
80
80
  word-wrap: normal;
81
81
  line-height: inherit;
82
82
  color: inherit;
83
+ overflow: visible;
83
84
  }
84
85
 
85
86
  .CodeMirror-wrap pre {
@@ -1,5 +1,5 @@
1
- // CodeMirror version 2.34
2
-
1
+ // CodeMirror version 2.35
2
+ //
3
3
  // All functions that need access to the editor's state live inside
4
4
  // the CodeMirror function. Below that, at the bottom of the file,
5
5
  // some utilities are defined.
@@ -77,7 +77,7 @@ window.CodeMirror = (function() {
77
77
  // Selection-related flags. shiftSelecting obviously tracks
78
78
  // whether the user is holding shift.
79
79
  var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, draggingText,
80
- overwrite = false, suppressEdits = false;
80
+ overwrite = false, suppressEdits = false, pasteIncoming = false;
81
81
  // Variables used by startOperation/endOperation to track what
82
82
  // happened during the operation.
83
83
  var updateInput, userSelChange, changes, textChanged, selectionChanged,
@@ -130,7 +130,7 @@ window.CodeMirror = (function() {
130
130
  connect(scroller, "drop", operation(onDrop));
131
131
  }
132
132
  connect(scroller, "paste", function(){focusInput(); fastPoll();});
133
- connect(input, "paste", fastPoll);
133
+ connect(input, "paste", function(){pasteIncoming = true; fastPoll();});
134
134
  connect(input, "cut", operation(function(){
135
135
  if (!options.readOnly) replaceSelection("");
136
136
  }));
@@ -169,6 +169,7 @@ window.CodeMirror = (function() {
169
169
  else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
170
170
  else if (option == "tabSize") updateDisplay(true);
171
171
  else if (option == "keyMap") keyMapChanged();
172
+ else if (option == "tabindex") input.tabIndex = value;
172
173
  if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" ||
173
174
  option == "theme" || option == "lineNumberFormatter") {
174
175
  gutterChanged();
@@ -956,12 +957,13 @@ window.CodeMirror = (function() {
956
957
  while (same < l && prevInput[same] == text[same]) ++same;
957
958
  if (same < prevInput.length)
958
959
  sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};
959
- else if (overwrite && posEq(sel.from, sel.to))
960
+ else if (overwrite && posEq(sel.from, sel.to) && !pasteIncoming)
960
961
  sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
961
962
  replaceSelection(text.slice(same), "end");
962
963
  if (text.length > 1000) { input.value = prevInput = ""; }
963
964
  else prevInput = text;
964
965
  if (!nestedOperation) endOperation();
966
+ pasteIncoming = false;
965
967
  return true;
966
968
  }
967
969
  function resetInput(user) {
@@ -1418,7 +1420,7 @@ window.CodeMirror = (function() {
1418
1420
  var startChar = line.charAt(start);
1419
1421
  var check = isWordChar(startChar) ? isWordChar :
1420
1422
  /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
1421
- function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
1423
+ function(ch) {return !/\s/.test(ch) && isWordChar(ch);};
1422
1424
  while (start > 0 && check(line.charAt(start - 1))) --start;
1423
1425
  while (end < line.length && check(line.charAt(end))) ++end;
1424
1426
  }
@@ -1462,6 +1464,7 @@ window.CodeMirror = (function() {
1462
1464
 
1463
1465
  if (indentString != curSpaceString)
1464
1466
  replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
1467
+ line.stateAfter = null;
1465
1468
  }
1466
1469
 
1467
1470
  function loadMode() {
@@ -1507,18 +1510,17 @@ window.CodeMirror = (function() {
1507
1510
 
1508
1511
  function TextMarker(type, style) { this.lines = []; this.type = type; if (style) this.style = style; }
1509
1512
  TextMarker.prototype.clear = operation(function() {
1510
- var min = Infinity, max = -Infinity;
1513
+ var min, max;
1511
1514
  for (var i = 0; i < this.lines.length; ++i) {
1512
1515
  var line = this.lines[i];
1513
- var span = getMarkedSpanFor(line.markedSpans, this, true);
1514
- if (span.from != null || span.to != null) {
1515
- var lineN = lineNo(line);
1516
- min = Math.min(min, lineN); max = Math.max(max, lineN);
1517
- }
1516
+ var span = getMarkedSpanFor(line.markedSpans, this);
1517
+ if (span.from != null) min = lineNo(line);
1518
+ if (span.to != null) max = lineNo(line);
1519
+ line.markedSpans = removeMarkedSpan(line.markedSpans, span);
1518
1520
  }
1519
- if (min != Infinity)
1520
- changes.push({from: min, to: max + 1});
1521
+ if (min != null) changes.push({from: min, to: max + 1});
1521
1522
  this.lines.length = 0;
1523
+ this.explicitlyCleared = true;
1522
1524
  });
1523
1525
  TextMarker.prototype.find = function() {
1524
1526
  var from, to;
@@ -1545,7 +1547,7 @@ window.CodeMirror = (function() {
1545
1547
  var span = {from: curLine == from.line ? from.ch : null,
1546
1548
  to: curLine == to.line ? to.ch : null,
1547
1549
  marker: marker};
1548
- (line.markedSpans || (line.markedSpans = [])).push(span);
1550
+ line.markedSpans = (line.markedSpans || []).concat([span]);
1549
1551
  marker.lines.push(line);
1550
1552
  ++curLine;
1551
1553
  });
@@ -1556,8 +1558,9 @@ window.CodeMirror = (function() {
1556
1558
  function setBookmark(pos) {
1557
1559
  pos = clipPos(pos);
1558
1560
  var marker = new TextMarker("bookmark"), line = getLine(pos.line);
1561
+ history.addChange(pos.line, 1, [newHL(line.text, line.markedSpans)], true);
1559
1562
  var span = {from: pos.ch, to: pos.ch, marker: marker};
1560
- (line.markedSpans || (line.markedSpans = [])).push(span);
1563
+ line.markedSpans = (line.markedSpans || []).concat([span]);
1561
1564
  marker.lines.push(line);
1562
1565
  return marker;
1563
1566
  }
@@ -1646,8 +1649,6 @@ window.CodeMirror = (function() {
1646
1649
 
1647
1650
  function measureLine(line, ch) {
1648
1651
  if (ch == 0) return {top: 0, left: 0};
1649
- var wbr = options.lineWrapping && ch < line.text.length &&
1650
- spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));
1651
1652
  var pre = lineContent(line, ch);
1652
1653
  removeChildrenAndAdd(measure, pre);
1653
1654
  var anchor = pre.anchor;
@@ -1980,6 +1981,7 @@ window.CodeMirror = (function() {
1980
1981
  if (extensions.propertyIsEnumerable(ext) &&
1981
1982
  !instance.propertyIsEnumerable(ext))
1982
1983
  instance[ext] = extensions[ext];
1984
+ for (var i = 0; i < initHooks.length; ++i) initHooks[i](instance);
1983
1985
  return instance;
1984
1986
  } // (end of function CodeMirror)
1985
1987
 
@@ -2077,6 +2079,9 @@ window.CodeMirror = (function() {
2077
2079
  extensions[name] = func;
2078
2080
  };
2079
2081
 
2082
+ var initHooks = [];
2083
+ CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
2084
+
2080
2085
  var modeExtensions = CodeMirror.modeExtensions = {};
2081
2086
  CodeMirror.extendMode = function(mode, properties) {
2082
2087
  var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
@@ -2206,6 +2211,7 @@ window.CodeMirror = (function() {
2206
2211
  var name = keyNames[e_prop(event, "keyCode")];
2207
2212
  return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
2208
2213
  }
2214
+ CodeMirror.isModifierKey = isModifierKey;
2209
2215
 
2210
2216
  CodeMirror.fromTextArea = function(textarea, options) {
2211
2217
  if (!options) options = {};
@@ -2355,16 +2361,20 @@ window.CodeMirror = (function() {
2355
2361
  this.from = from; this.to = to; this.marker = marker;
2356
2362
  }
2357
2363
 
2358
- function getMarkedSpanFor(spans, marker, del) {
2364
+ function getMarkedSpanFor(spans, marker) {
2359
2365
  if (spans) for (var i = 0; i < spans.length; ++i) {
2360
2366
  var span = spans[i];
2361
- if (span.marker == marker) {
2362
- if (del) spans.splice(i, 1);
2363
- return span;
2364
- }
2367
+ if (span.marker == marker) return span;
2365
2368
  }
2366
2369
  }
2367
2370
 
2371
+ function removeMarkedSpan(spans, span) {
2372
+ var r;
2373
+ for (var i = 0; i < spans.length; ++i)
2374
+ if (spans[i] != span) (r || (r = [])).push(spans[i]);
2375
+ return r;
2376
+ }
2377
+
2368
2378
  function markedSpansBefore(old, startCh, endCh) {
2369
2379
  if (old) for (var i = 0, nw; i < old.length; ++i) {
2370
2380
  var span = old[i], marker = span.marker;
@@ -2448,7 +2458,15 @@ window.CodeMirror = (function() {
2448
2458
  // hl stands for history-line, a data structure that can be either a
2449
2459
  // string (line without markers) or a {text, markedSpans} object.
2450
2460
  function hlText(val) { return typeof val == "string" ? val : val.text; }
2451
- function hlSpans(val) { return typeof val == "string" ? null : val.markedSpans; }
2461
+ function hlSpans(val) {
2462
+ if (typeof val == "string") return null;
2463
+ var spans = val.markedSpans, out = null;
2464
+ for (var i = 0; i < spans.length; ++i) {
2465
+ if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
2466
+ else if (out) out.push(spans[i]);
2467
+ }
2468
+ return !out ? spans : out.length ? out : null;
2469
+ }
2452
2470
  function newHL(text, spans) { return spans ? {text: text, markedSpans: spans} : text; }
2453
2471
 
2454
2472
  function detachMarkedSpans(line) {
@@ -2584,13 +2602,17 @@ window.CodeMirror = (function() {
2584
2602
  span = function(html, text, style) {
2585
2603
  var l = text.length;
2586
2604
  if (wrapAt >= outPos && wrapAt < outPos + l) {
2587
- if (wrapAt > outPos) {
2588
- span_(html, text.slice(0, wrapAt - outPos), style);
2605
+ var cut = wrapAt - outPos;
2606
+ if (cut) {
2607
+ span_(html, text.slice(0, cut), style);
2589
2608
  // See comment at the definition of spanAffectsWrapping
2590
- if (compensateForWrapping) html.appendChild(elt("wbr"));
2609
+ if (compensateForWrapping) {
2610
+ var view = text.slice(cut - 1, cut + 1);
2611
+ if (spanAffectsWrapping.test(view)) html.appendChild(elt("wbr"));
2612
+ else if (!ie_lt8 && /\w\w/.test(view)) html.appendChild(document.createTextNode("\u200d"));
2613
+ }
2591
2614
  }
2592
2615
  html.appendChild(anchor);
2593
- var cut = wrapAt - outPos;
2594
2616
  span_(anchor, opera ? text.slice(cut, cut + 1) : text.slice(cut), style);
2595
2617
  if (opera) span_(html, text.slice(cut + 1), style);
2596
2618
  wrapAt--;
@@ -2874,7 +2896,7 @@ window.CodeMirror = (function() {
2874
2896
  var time = +new Date, cur = lst(this.done), last = cur && lst(cur);
2875
2897
  var dtime = time - this.time;
2876
2898
 
2877
- if (this.compound && cur && !this.closed) {
2899
+ if (cur && !this.closed && this.compound) {
2878
2900
  cur.push({start: start, added: added, old: old});
2879
2901
  } else if (dtime > 400 || !last || this.closed ||
2880
2902
  last.start > start + old.length || last.start + last.added < start) {
@@ -3081,7 +3103,7 @@ window.CodeMirror = (function() {
3081
3103
  return -1;
3082
3104
  }
3083
3105
  function isWordChar(ch) {
3084
- return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase();
3106
+ return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase() || /[\u4E00-\u9FA5]/.test(ch);
3085
3107
  }
3086
3108
 
3087
3109
  // See if "".split is the broken IE version, if so, provide an
@@ -3137,7 +3159,7 @@ window.CodeMirror = (function() {
3137
3159
  for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
3138
3160
  })();
3139
3161
 
3140
- CodeMirror.version = "2.34";
3162
+ CodeMirror.version = "2.35";
3141
3163
 
3142
3164
  return CodeMirror;
3143
3165
  })();
@@ -49,6 +49,11 @@ CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, comb
49
49
  },
50
50
  electricChars: base.electricChars,
51
51
 
52
- innerMode: function(state) { return {state: state.base, mode: base}; }
52
+ innerMode: function(state) { return {state: state.base, mode: base}; },
53
+
54
+ blankLine: function(state) {
55
+ if (base.blankLine) base.blankLine(state.base);
56
+ if (overlay.blankLine) overlay.blankLine(state.overlay);
57
+ }
53
58
  };
54
59
  };
@@ -1,6 +1,6 @@
1
1
  CodeMirror.runMode = function(string, modespec, callback, options) {
2
2
  function esc(str) {
3
- return str.replace(/[<&]/, function(ch) { return ch == "<" ? "&lt;" : "&amp;"; });
3
+ return str.replace(/[<&]/g, function(ch) { return ch == "<" ? "&lt;" : "&amp;"; });
4
4
  }
5
5
 
6
6
  var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
@@ -17,14 +17,14 @@
17
17
  query.lastIndex = 0;
18
18
  var line = cm.getLine(pos.line).slice(0, pos.ch), match = query.exec(line), start = 0;
19
19
  while (match) {
20
- start += match.index;
21
- line = line.slice(match.index);
20
+ start += match.index + 1;
21
+ line = line.slice(start);
22
22
  query.lastIndex = 0;
23
23
  var newmatch = query.exec(line);
24
24
  if (newmatch) match = newmatch;
25
25
  else break;
26
- start++;
27
26
  }
27
+ start--;
28
28
  } else {
29
29
  query.lastIndex = pos.ch;
30
30
  var line = cm.getLine(pos.line), match = query.exec(line),
@@ -25,7 +25,10 @@
25
25
  editor.replaceRange(str, result.from, result.to);
26
26
  }
27
27
  // When there is only one completion, use it directly.
28
- if (completions.length == 1) {insert(completions[0]); return true;}
28
+ if (options.completeSingle && completions.length == 1) {
29
+ insert(completions[0]);
30
+ return true;
31
+ }
29
32
 
30
33
  // Build the select widget
31
34
  var complete = document.createElement("div");
@@ -41,7 +44,7 @@
41
44
  }
42
45
  sel.firstChild.selected = true;
43
46
  sel.size = Math.min(10, completions.length);
44
- var pos = editor.cursorCoords();
47
+ var pos = options.alignWithWord ? editor.charCoords(result.from) : editor.cursorCoords();
45
48
  complete.style.left = pos.x + "px";
46
49
  complete.style.top = pos.yBot + "px";
47
50
  document.body.appendChild(complete);
@@ -71,7 +74,7 @@
71
74
  if (code == 13) {CodeMirror.e_stop(event); pick();}
72
75
  // Escape
73
76
  else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
74
- else if (code != 38 && code != 40 && code != 33 && code != 34) {
77
+ else if (code != 38 && code != 40 && code != 33 && code != 34 && !CodeMirror.isModifierKey(event)) {
75
78
  close(); editor.focus();
76
79
  // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
77
80
  editor.triggerOnKeyDown(event);
@@ -92,6 +95,8 @@
92
95
  };
93
96
  CodeMirror.simpleHint.defaults = {
94
97
  closeOnBackspace: true,
95
- closeOnTokenChange: false
98
+ closeOnTokenChange: false,
99
+ completeSingle: true,
100
+ alignWithWord: true
96
101
  };
97
102
  })();
@@ -140,6 +140,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
140
140
  },
141
141
 
142
142
  indent: function(state, textAfter) {
143
+ if (state.tokenize == tokenComment) return CodeMirror.Pass;
143
144
  if (state.tokenize != tokenBase && state.tokenize != null) return 0;
144
145
  var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
145
146
  if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
@@ -228,7 +228,7 @@ CodeMirror.defineMode("css", function(config) {
228
228
  else if (/[,+>*\/]/.test(ch)) {
229
229
  return ret(null, "select-op");
230
230
  }
231
- else if (ch == "." && stream.match(/^\w+/)) {
231
+ else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
232
232
  return ret("qualifier", type);
233
233
  }
234
234
  else if (ch == ":") {