ace-rails-ap 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +403 -326
  4. data/vendor/assets/javascripts/ace/ext-language_tools.js +56 -40
  5. data/vendor/assets/javascripts/ace/ext-modelist.js +7 -3
  6. data/vendor/assets/javascripts/ace/ext-settings_menu.js +8 -4
  7. data/vendor/assets/javascripts/ace/ext-static_highlight.js +12 -5
  8. data/vendor/assets/javascripts/ace/keybinding-vim.js +5234 -1558
  9. data/vendor/assets/javascripts/ace/mode-abap.js +1 -1
  10. data/vendor/assets/javascripts/ace/mode-abc.js +261 -0
  11. data/vendor/assets/javascripts/ace/mode-actionscript.js +47 -1
  12. data/vendor/assets/javascripts/ace/mode-apache_conf.js +47 -1
  13. data/vendor/assets/javascripts/ace/mode-applescript.js +47 -1
  14. data/vendor/assets/javascripts/ace/mode-autohotkey.js +47 -1
  15. data/vendor/assets/javascripts/ace/mode-batchfile.js +47 -1
  16. data/vendor/assets/javascripts/ace/mode-c_cpp.js +101 -56
  17. data/vendor/assets/javascripts/ace/mode-coffee.js +3 -3
  18. data/vendor/assets/javascripts/ace/mode-coldfusion.js +114 -63
  19. data/vendor/assets/javascripts/ace/mode-csharp.js +99 -55
  20. data/vendor/assets/javascripts/ace/mode-css.js +98 -53
  21. data/vendor/assets/javascripts/ace/mode-curly.js +114 -63
  22. data/vendor/assets/javascripts/ace/mode-d.js +47 -1
  23. data/vendor/assets/javascripts/ace/mode-dart.js +103 -58
  24. data/vendor/assets/javascripts/ace/mode-diff.js +85 -85
  25. data/vendor/assets/javascripts/ace/mode-django.js +114 -63
  26. data/vendor/assets/javascripts/ace/mode-dockerfile.js +97 -52
  27. data/vendor/assets/javascripts/ace/mode-dot.js +47 -1
  28. data/vendor/assets/javascripts/ace/mode-eiffel.js +30 -37
  29. data/vendor/assets/javascripts/ace/mode-ejs.js +117 -63
  30. data/vendor/assets/javascripts/ace/mode-elm.js +47 -1
  31. data/vendor/assets/javascripts/ace/mode-erlang.js +47 -1
  32. data/vendor/assets/javascripts/ace/mode-forth.js +47 -1
  33. data/vendor/assets/javascripts/ace/mode-ftl.js +10 -7
  34. data/vendor/assets/javascripts/ace/mode-glsl.js +101 -56
  35. data/vendor/assets/javascripts/ace/mode-golang.js +96 -51
  36. data/vendor/assets/javascripts/ace/mode-groovy.js +98 -53
  37. data/vendor/assets/javascripts/ace/mode-haml.js +3 -0
  38. data/vendor/assets/javascripts/ace/mode-handlebars.js +114 -63
  39. data/vendor/assets/javascripts/ace/mode-haskell.js +49 -3
  40. data/vendor/assets/javascripts/ace/mode-haxe.js +96 -51
  41. data/vendor/assets/javascripts/ace/mode-html.js +114 -63
  42. data/vendor/assets/javascripts/ace/mode-html_ruby.js +117 -63
  43. data/vendor/assets/javascripts/ace/mode-io.js +47 -1
  44. data/vendor/assets/javascripts/ace/mode-jack.js +96 -51
  45. data/vendor/assets/javascripts/ace/mode-jade.js +10 -7
  46. data/vendor/assets/javascripts/ace/mode-java.js +98 -53
  47. data/vendor/assets/javascripts/ace/mode-javascript.js +98 -53
  48. data/vendor/assets/javascripts/ace/mode-json.js +99 -54
  49. data/vendor/assets/javascripts/ace/mode-jsoniq.js +98 -51
  50. data/vendor/assets/javascripts/ace/mode-jsp.js +106 -58
  51. data/vendor/assets/javascripts/ace/mode-jsx.js +96 -51
  52. data/vendor/assets/javascripts/ace/mode-julia.js +47 -1
  53. data/vendor/assets/javascripts/ace/mode-latex.js +1 -1
  54. data/vendor/assets/javascripts/ace/mode-lean.js +281 -0
  55. data/vendor/assets/javascripts/ace/mode-less.js +96 -51
  56. data/vendor/assets/javascripts/ace/mode-liquid.js +10 -7
  57. data/vendor/assets/javascripts/ace/mode-live_script.js +481 -0
  58. data/vendor/assets/javascripts/ace/mode-livescript.js +5 -8
  59. data/vendor/assets/javascripts/ace/mode-logiql.js +49 -50
  60. data/vendor/assets/javascripts/ace/mode-lsl.js +96 -51
  61. data/vendor/assets/javascripts/ace/mode-lua.js +3 -3
  62. data/vendor/assets/javascripts/ace/mode-luapage.js +117 -66
  63. data/vendor/assets/javascripts/ace/mode-makefile.js +1 -1
  64. data/vendor/assets/javascripts/ace/mode-markdown.js +134 -67
  65. data/vendor/assets/javascripts/ace/mode-mask.js +1985 -0
  66. data/vendor/assets/javascripts/ace/mode-mel.js +96 -51
  67. data/vendor/assets/javascripts/ace/mode-mips_assembler.js +235 -0
  68. data/vendor/assets/javascripts/ace/mode-mipsassembler.js +196 -0
  69. data/vendor/assets/javascripts/ace/mode-nix.js +101 -56
  70. data/vendor/assets/javascripts/ace/mode-objectivec.js +52 -6
  71. data/vendor/assets/javascripts/ace/mode-perl.js +47 -1
  72. data/vendor/assets/javascripts/ace/mode-pgsql.js +1 -1
  73. data/vendor/assets/javascripts/ace/mode-php.js +139 -85
  74. data/vendor/assets/javascripts/ace/mode-powershell.js +96 -51
  75. data/vendor/assets/javascripts/ace/mode-praat.js +47 -1
  76. data/vendor/assets/javascripts/ace/mode-prolog.js +47 -1
  77. data/vendor/assets/javascripts/ace/mode-protobuf.js +101 -56
  78. data/vendor/assets/javascripts/ace/mode-rdoc.js +1 -1
  79. data/vendor/assets/javascripts/ace/mode-rhtml.js +114 -63
  80. data/vendor/assets/javascripts/ace/mode-ruby.js +52 -50
  81. data/vendor/assets/javascripts/ace/mode-rust.js +57 -18
  82. data/vendor/assets/javascripts/ace/mode-scad.js +96 -51
  83. data/vendor/assets/javascripts/ace/mode-scala.js +98 -53
  84. data/vendor/assets/javascripts/ace/mode-scss.js +96 -51
  85. data/vendor/assets/javascripts/ace/mode-sh.js +97 -52
  86. data/vendor/assets/javascripts/ace/mode-sjs.js +98 -53
  87. data/vendor/assets/javascripts/ace/mode-smarty.js +114 -63
  88. data/vendor/assets/javascripts/ace/mode-soy_template.js +114 -63
  89. data/vendor/assets/javascripts/ace/mode-stylus.js +1 -1
  90. data/vendor/assets/javascripts/ace/mode-svg.js +132 -65
  91. data/vendor/assets/javascripts/ace/mode-tcl.js +47 -1
  92. data/vendor/assets/javascripts/ace/mode-twig.js +114 -63
  93. data/vendor/assets/javascripts/ace/mode-typescript.js +98 -53
  94. data/vendor/assets/javascripts/ace/mode-vala.js +96 -51
  95. data/vendor/assets/javascripts/ace/mode-velocity.js +114 -63
  96. data/vendor/assets/javascripts/ace/mode-vhdl.js +21 -21
  97. data/vendor/assets/javascripts/ace/mode-xml.js +34 -12
  98. data/vendor/assets/javascripts/ace/mode-xquery.js +98 -51
  99. data/vendor/assets/javascripts/ace/snippets/abc.js +38 -0
  100. data/vendor/assets/javascripts/ace/snippets/elixir.js +7 -0
  101. data/vendor/assets/javascripts/ace/snippets/elm.js +7 -0
  102. data/vendor/assets/javascripts/ace/snippets/lean.js +7 -0
  103. data/vendor/assets/javascripts/ace/snippets/live_script.js +7 -0
  104. data/vendor/assets/javascripts/ace/snippets/mask.js +7 -0
  105. data/vendor/assets/javascripts/ace/snippets/mips_assembler.js +7 -0
  106. data/vendor/assets/javascripts/ace/snippets/mipsassembler.js +7 -0
  107. data/vendor/assets/javascripts/ace/snippets/r.js +1 -1
  108. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -1
  109. data/vendor/assets/javascripts/ace/theme-github.js +7 -1
  110. data/vendor/assets/javascripts/ace/theme-katzenmilch.js +3 -0
  111. data/vendor/assets/javascripts/ace/theme-kuroir.js +3 -0
  112. data/vendor/assets/javascripts/ace/worker-coffee.js +6 -7
  113. data/vendor/assets/javascripts/ace/worker-css.js +5 -5
  114. data/vendor/assets/javascripts/ace/worker-html.js +4354 -4354
  115. data/vendor/assets/javascripts/ace/worker-javascript.js +2435 -1397
  116. data/vendor/assets/javascripts/ace/worker-json.js +6 -7
  117. data/vendor/assets/javascripts/ace/worker-lua.js +11 -11
  118. data/vendor/assets/javascripts/ace/worker-php.js +4 -8
  119. data/vendor/assets/javascripts/ace/worker-xml.js +3809 -0
  120. data/vendor/assets/javascripts/ace/worker-xquery.js +38 -47
  121. metadata +18 -9
  122. data/vendor/assets/javascripts/ace/ext-options.js +0 -252
  123. data/vendor/assets/javascripts/ace/mode-html_completions.js +0 -309
  124. data/vendor/assets/javascripts/ace/mode-luahtml.js +0 -2415
  125. data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +0 -569
  126. data/vendor/assets/javascripts/ace/mode-tmsnippet.js +0 -200
  127. data/vendor/assets/javascripts/ace/theme-kr.js +0 -105
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cc5d57286310940b01bf444c90157de22458f80
4
- data.tar.gz: 35372099cf669dbf6639d6f5a69b45f9a30c4274
3
+ metadata.gz: 1a146f781a512a5ab622bfb8a3fad21a59142249
4
+ data.tar.gz: a049cebb1545b3dc069e7fc5af514c6cc90596f3
5
5
  SHA512:
6
- metadata.gz: 4b12bead68c4eb9d30d6bac6c7b17ef2a7aa481ee759e4ec090fd382f5321c919cb8f18711f60e9672be7831b5353eafafb2459d2a06367fd1e16a4e1e32b4fe
7
- data.tar.gz: 05c2bc884dd715f97fbd697d0c65db8db7aeab519da54b0eadb674f5ebff823f0437297be1a30b86c04134be9439f97f705e52109d0611deac546578c9036be7
6
+ metadata.gz: 2da45a8b12d4fdbd99e9e4e9a7f053af094f7ba00d676f9167043333bdbd92d7c938a6840d162ba1a86ba908de3bfaae9f4fe9fcf12e208e9867e03af4952f26
7
+ data.tar.gz: 4cb3ebb3ceb77f4177ec3a8e53190bc7fbeade35b4afd8ab554f5a432863a57a8da1d32707937066aa123585ab98b7ed3d6a3513851e9bc99bbff5baf44771f4
@@ -1,5 +1,5 @@
1
1
  module Ace
2
2
  module Rails
3
- VERSION = "3.0.2"
3
+ VERSION = "3.0.3"
4
4
  end
5
5
  end
@@ -38,69 +38,62 @@
38
38
 
39
39
  var ACE_NAMESPACE = "";
40
40
 
41
- var global = (function() {
42
- return this;
43
- })();
41
+ var global = (function() { return this; })();
42
+ if (!global && typeof window != "undefined") global = window; // strict mode
44
43
 
45
44
 
46
45
  if (!ACE_NAMESPACE && typeof requirejs !== "undefined")
47
46
  return;
48
47
 
49
48
 
50
- var _define = function(module, deps, payload) {
51
- if (typeof module !== 'string') {
52
- if (_define.original)
53
- _define.original.apply(window, arguments);
49
+ var define = function(module, deps, payload) {
50
+ if (typeof module !== "string") {
51
+ if (define.original)
52
+ define.original.apply(this, arguments);
54
53
  else {
55
- console.error('dropping module because define wasn\'t a string.');
54
+ console.error("dropping module because define wasn\'t a string.");
56
55
  console.trace();
57
56
  }
58
57
  return;
59
58
  }
60
-
61
59
  if (arguments.length == 2)
62
60
  payload = deps;
63
-
64
- if (!_define.modules) {
65
- _define.modules = {};
66
- _define.payloads = {};
61
+ if (!define.modules[module]) {
62
+ define.payloads[module] = payload;
63
+ define.modules[module] = null;
67
64
  }
68
-
69
- _define.payloads[module] = payload;
70
- _define.modules[module] = null;
71
65
  };
72
66
 
67
+ define.modules = {};
68
+ define.payloads = {};
69
+
73
70
  /**
74
71
  * Get at functionality define()ed using the function above
75
72
  */
76
73
  var _require = function(parentId, module, callback) {
77
- if (Object.prototype.toString.call(module) === "[object Array]") {
74
+ if (typeof module === "string") {
75
+ var payload = lookup(parentId, module);
76
+ if (payload != undefined) {
77
+ callback && callback();
78
+ return payload;
79
+ }
80
+ } else if (Object.prototype.toString.call(module) === "[object Array]") {
78
81
  var params = [];
79
82
  for (var i = 0, l = module.length; i < l; ++i) {
80
83
  var dep = lookup(parentId, module[i]);
81
- if (!dep && _require.original)
82
- return _require.original.apply(window, arguments);
84
+ if (dep == undefined && require.original)
85
+ return;
83
86
  params.push(dep);
84
87
  }
85
- if (callback) {
86
- callback.apply(null, params);
87
- }
88
+ return callback && callback.apply(null, params) || true;
88
89
  }
89
- else if (typeof module === 'string') {
90
- var payload = lookup(parentId, module);
91
- if (!payload && _require.original)
92
- return _require.original.apply(window, arguments);
93
-
94
- if (callback) {
95
- callback();
96
- }
90
+ };
97
91
 
98
- return payload;
99
- }
100
- else {
101
- if (_require.original)
102
- return _require.original.apply(window, arguments);
103
- }
92
+ var require = function(module, callback) {
93
+ var packagedModule = _require("", module, callback);
94
+ if (packagedModule == undefined && require.original)
95
+ return require.original.apply(this, arguments);
96
+ return packagedModule;
104
97
  };
105
98
 
106
99
  var normalizeModule = function(parentId, moduleName) {
@@ -119,7 +112,6 @@ var normalizeModule = function(parentId, moduleName) {
119
112
  moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
120
113
  }
121
114
  }
122
-
123
115
  return moduleName;
124
116
  };
125
117
 
@@ -128,12 +120,11 @@ var normalizeModule = function(parentId, moduleName) {
128
120
  * definition function if needed.
129
121
  */
130
122
  var lookup = function(parentId, moduleName) {
131
-
132
123
  moduleName = normalizeModule(parentId, moduleName);
133
124
 
134
- var module = _define.modules[moduleName];
125
+ var module = define.modules[moduleName];
135
126
  if (!module) {
136
- module = _define.payloads[moduleName];
127
+ module = define.payloads[moduleName];
137
128
  if (typeof module === 'function') {
138
129
  var exports = {};
139
130
  var mod = {
@@ -149,19 +140,15 @@ var lookup = function(parentId, moduleName) {
149
140
 
150
141
  var returnValue = module(req, exports, mod);
151
142
  exports = returnValue || mod.exports;
152
- _define.modules[moduleName] = exports;
153
- delete _define.payloads[moduleName];
143
+ define.modules[moduleName] = exports;
144
+ delete define.payloads[moduleName];
154
145
  }
155
- module = _define.modules[moduleName] = exports || module;
146
+ module = define.modules[moduleName] = exports || module;
156
147
  }
157
148
  return module;
158
149
  };
159
150
 
160
151
  function exportAce(ns) {
161
- var require = function(module, callback) {
162
- return _require("", module, callback);
163
- };
164
-
165
152
  var root = global;
166
153
  if (ns) {
167
154
  if (!global[ns])
@@ -170,13 +157,13 @@ function exportAce(ns) {
170
157
  }
171
158
 
172
159
  if (!root.define || !root.define.packaged) {
173
- _define.original = root.define;
174
- root.define = _define;
160
+ define.original = root.define;
161
+ root.define = define;
175
162
  root.define.packaged = true;
176
163
  }
177
164
 
178
165
  if (!root.require || !root.require.packaged) {
179
- _require.original = root.require;
166
+ require.original = root.require;
180
167
  root.require = require;
181
168
  root.require.packaged = true;
182
169
  }
@@ -967,9 +954,6 @@ require("./es5-shim");
967
954
  define("ace/lib/dom",["require","exports","module"], function(require, exports, module) {
968
955
  "use strict";
969
956
 
970
- if (typeof document == "undefined")
971
- return;
972
-
973
957
  var XHTML_NS = "http://www.w3.org/1999/xhtml";
974
958
 
975
959
  exports.getDocumentHead = function(doc) {
@@ -1097,6 +1081,10 @@ exports.getInnerHeight = function(element) {
1097
1081
  );
1098
1082
  };
1099
1083
 
1084
+
1085
+ if (typeof document == "undefined")
1086
+ return;
1087
+
1100
1088
  if (window.pageYOffset !== undefined) {
1101
1089
  exports.getPageScrollTop = function() {
1102
1090
  return window.pageYOffset;
@@ -1294,8 +1282,8 @@ var Keys = (function() {
1294
1282
  73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
1295
1283
  80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
1296
1284
  87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
1297
- 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[',
1298
- 220: '\\',221: ']', 222: '\''
1285
+ 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',
1286
+ 219: '[', 220: '\\',221: ']', 222: '\''
1299
1287
  }
1300
1288
  };
1301
1289
  var name, i;
@@ -1325,7 +1313,7 @@ var Keys = (function() {
1325
1313
  })();
1326
1314
 
1327
1315
  ret.KEY_MODS[0] = "";
1328
- ret.KEY_MODS[-1] = "input";
1316
+ ret.KEY_MODS[-1] = "input-";
1329
1317
 
1330
1318
  return ret;
1331
1319
  })();
@@ -1589,32 +1577,17 @@ function normalizeCommandKeys(callback, e, keyCode) {
1589
1577
  if (keyCode === 18 || keyCode === 17) {
1590
1578
  var location = "location" in e ? e.location : e.keyLocation;
1591
1579
  if (keyCode === 17 && location === 1) {
1592
- ts = e.timeStamp;
1580
+ if (pressedKeys[keyCode] == 1)
1581
+ ts = e.timeStamp;
1593
1582
  } else if (keyCode === 18 && hashId === 3 && location === 2) {
1594
- var dt = -ts;
1595
- ts = e.timeStamp;
1596
- dt += ts;
1597
- if (dt < 3)
1583
+ var dt = e.timestamp - ts;
1584
+ if (dt < 50)
1598
1585
  pressedKeys.altGr = true;
1599
1586
  }
1600
1587
  }
1601
1588
  }
1602
1589
 
1603
1590
  if (keyCode in keys.MODIFIER_KEYS) {
1604
- switch (keys.MODIFIER_KEYS[keyCode]) {
1605
- case "Alt":
1606
- hashId = 2;
1607
- break;
1608
- case "Shift":
1609
- hashId = 4;
1610
- break;
1611
- case "Ctrl":
1612
- hashId = 1;
1613
- break;
1614
- default:
1615
- hashId = 8;
1616
- break;
1617
- }
1618
1591
  keyCode = -1;
1619
1592
  }
1620
1593
 
@@ -1661,7 +1634,7 @@ exports.addCommandKeyListener = function(el, callback) {
1661
1634
  var lastDefaultPrevented = null;
1662
1635
 
1663
1636
  addListener(el, "keydown", function(e) {
1664
- pressedKeys[e.keyCode] = true;
1637
+ pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1;
1665
1638
  var result = normalizeCommandKeys(callback, e, e.keyCode);
1666
1639
  lastDefaultPrevented = e.defaultPrevented;
1667
1640
  return result;
@@ -1921,13 +1894,13 @@ var TextInput = function(parentNode, host) {
1921
1894
  if (useragent.isTouchPad)
1922
1895
  text.setAttribute("x-palm-disable-auto-cap", true);
1923
1896
 
1924
- text.wrap = "off";
1925
- text.autocorrect = "off";
1926
- text.autocapitalize = "off";
1927
- text.spellcheck = false;
1897
+ text.setAttribute("wrap", "off");
1898
+ text.setAttribute("autocorrect", "off");
1899
+ text.setAttribute("autocapitalize", "off");
1900
+ text.setAttribute("spellcheck", false);
1928
1901
 
1929
1902
  text.style.opacity = "0";
1930
- if (useragent.isOldIE) text.style.top = "-100px";
1903
+ if (useragent.isOldIE) text.style.top = "-1000px";
1931
1904
  parentNode.insertBefore(text, parentNode.firstChild);
1932
1905
 
1933
1906
  var PLACEHOLDER = "\x01\x01";
@@ -1948,7 +1921,15 @@ var TextInput = function(parentNode, host) {
1948
1921
  host.onFocus(e);
1949
1922
  resetSelection();
1950
1923
  });
1951
- this.focus = function() { text.focus(); };
1924
+ this.focus = function() {
1925
+ if (tempStyle) return text.focus();
1926
+ text.style.position = "fixed";
1927
+ text.style.top = "-1000px";
1928
+ text.focus();
1929
+ setTimeout(function() {
1930
+ text.style.position = "";
1931
+ }, 0);
1932
+ };
1952
1933
  this.blur = function() { text.blur(); };
1953
1934
  this.isFocused = function() {
1954
1935
  return isFocused;
@@ -1966,6 +1947,8 @@ var TextInput = function(parentNode, host) {
1966
1947
  function resetSelection(isEmpty) {
1967
1948
  if (inComposition)
1968
1949
  return;
1950
+ inComposition = true;
1951
+
1969
1952
  if (inputHandler) {
1970
1953
  selectionStart = 0;
1971
1954
  selectionEnd = isEmpty ? 0 : text.value.length - 1;
@@ -1976,6 +1959,8 @@ var TextInput = function(parentNode, host) {
1976
1959
  try {
1977
1960
  text.setSelectionRange(selectionStart, selectionEnd);
1978
1961
  } catch(e){}
1962
+
1963
+ inComposition = false;
1979
1964
  }
1980
1965
 
1981
1966
  function resetValue() {
@@ -2382,9 +2367,10 @@ function DefaultHandlers(mouseHandler) {
2382
2367
  if (button !== 0) {
2383
2368
  var selectionRange = editor.getSelectionRange();
2384
2369
  var selectionEmpty = selectionRange.isEmpty();
2385
-
2370
+ editor.$blockScrolling++;
2386
2371
  if (selectionEmpty)
2387
2372
  editor.selection.moveToPosition(pos);
2373
+ editor.$blockScrolling--;
2388
2374
  editor.textInput.onContextMenu(ev.domEvent);
2389
2375
  return; // stopping event here breaks contextmenu on ff mac
2390
2376
  }
@@ -2407,7 +2393,7 @@ function DefaultHandlers(mouseHandler) {
2407
2393
  this.startSelect = function(pos, waitForClickSelection) {
2408
2394
  pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
2409
2395
  var editor = this.editor;
2410
-
2396
+ editor.$blockScrolling++;
2411
2397
  if (this.mousedownEvent.getShiftKey())
2412
2398
  editor.selection.selectToPosition(pos);
2413
2399
  else if (!waitForClickSelection)
@@ -2419,12 +2405,13 @@ function DefaultHandlers(mouseHandler) {
2419
2405
  }
2420
2406
  editor.setStyle("ace_selecting");
2421
2407
  this.setState("select");
2408
+ editor.$blockScrolling--;
2422
2409
  };
2423
2410
 
2424
2411
  this.select = function() {
2425
2412
  var anchor, editor = this.editor;
2426
2413
  var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
2427
-
2414
+ editor.$blockScrolling++;
2428
2415
  if (this.$clickSelection) {
2429
2416
  var cmp = this.$clickSelection.comparePoint(cursor);
2430
2417
 
@@ -2440,7 +2427,7 @@ function DefaultHandlers(mouseHandler) {
2440
2427
  editor.selection.setSelectionAnchor(anchor.row, anchor.column);
2441
2428
  }
2442
2429
  editor.selection.selectToPosition(cursor);
2443
-
2430
+ editor.$blockScrolling--;
2444
2431
  editor.renderer.scrollCursorIntoView();
2445
2432
  };
2446
2433
 
@@ -2448,7 +2435,7 @@ function DefaultHandlers(mouseHandler) {
2448
2435
  var anchor, editor = this.editor;
2449
2436
  var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
2450
2437
  var range = editor.selection[unitName](cursor.row, cursor.column);
2451
-
2438
+ editor.$blockScrolling++;
2452
2439
  if (this.$clickSelection) {
2453
2440
  var cmpStart = this.$clickSelection.comparePoint(range.start);
2454
2441
  var cmpEnd = this.$clickSelection.comparePoint(range.end);
@@ -2472,7 +2459,7 @@ function DefaultHandlers(mouseHandler) {
2472
2459
  editor.selection.setSelectionAnchor(anchor.row, anchor.column);
2473
2460
  }
2474
2461
  editor.selection.selectToPosition(cursor);
2475
-
2462
+ editor.$blockScrolling--;
2476
2463
  editor.renderer.scrollCursorIntoView();
2477
2464
  };
2478
2465
 
@@ -3418,13 +3405,137 @@ exports.EventEmitter = EventEmitter;
3418
3405
 
3419
3406
  });
3420
3407
 
3421
- define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/event_emitter"], function(require, exports, module) {
3408
+ define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) {
3409
+ "no use strict";
3410
+
3411
+ var oop = require("./oop");
3412
+ var EventEmitter = require("./event_emitter").EventEmitter;
3413
+
3414
+ var optionsProvider = {
3415
+ setOptions: function(optList) {
3416
+ Object.keys(optList).forEach(function(key) {
3417
+ this.setOption(key, optList[key]);
3418
+ }, this);
3419
+ },
3420
+ getOptions: function(optionNames) {
3421
+ var result = {};
3422
+ if (!optionNames) {
3423
+ optionNames = Object.keys(this.$options);
3424
+ } else if (!Array.isArray(optionNames)) {
3425
+ result = optionNames;
3426
+ optionNames = Object.keys(result);
3427
+ }
3428
+ optionNames.forEach(function(key) {
3429
+ result[key] = this.getOption(key);
3430
+ }, this);
3431
+ return result;
3432
+ },
3433
+ setOption: function(name, value) {
3434
+ if (this["$" + name] === value)
3435
+ return;
3436
+ var opt = this.$options[name];
3437
+ if (!opt) {
3438
+ return warn('misspelled option "' + name + '"');
3439
+ }
3440
+ if (opt.forwardTo)
3441
+ return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
3442
+
3443
+ if (!opt.handlesSet)
3444
+ this["$" + name] = value;
3445
+ if (opt && opt.set)
3446
+ opt.set.call(this, value);
3447
+ },
3448
+ getOption: function(name) {
3449
+ var opt = this.$options[name];
3450
+ if (!opt) {
3451
+ return warn('misspelled option "' + name + '"');
3452
+ }
3453
+ if (opt.forwardTo)
3454
+ return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
3455
+ return opt && opt.get ? opt.get.call(this) : this["$" + name];
3456
+ }
3457
+ };
3458
+
3459
+ function warn(message) {
3460
+ if (typeof console != "undefined" && console.warn)
3461
+ console.warn.apply(console, arguments);
3462
+ }
3463
+
3464
+ function reportError(msg, data) {
3465
+ var e = new Error(msg);
3466
+ e.data = data;
3467
+ if (typeof console == "object" && console.error)
3468
+ console.error(e);
3469
+ setTimeout(function() { throw e; });
3470
+ }
3471
+
3472
+ var AppConfig = function() {
3473
+ this.$defaultOptions = {};
3474
+ };
3475
+
3476
+ (function() {
3477
+ oop.implement(this, EventEmitter);
3478
+ this.defineOptions = function(obj, path, options) {
3479
+ if (!obj.$options)
3480
+ this.$defaultOptions[path] = obj.$options = {};
3481
+
3482
+ Object.keys(options).forEach(function(key) {
3483
+ var opt = options[key];
3484
+ if (typeof opt == "string")
3485
+ opt = {forwardTo: opt};
3486
+
3487
+ opt.name || (opt.name = key);
3488
+ obj.$options[opt.name] = opt;
3489
+ if ("initialValue" in opt)
3490
+ obj["$" + opt.name] = opt.initialValue;
3491
+ });
3492
+ oop.implement(obj, optionsProvider);
3493
+
3494
+ return this;
3495
+ };
3496
+
3497
+ this.resetOptions = function(obj) {
3498
+ Object.keys(obj.$options).forEach(function(key) {
3499
+ var opt = obj.$options[key];
3500
+ if ("value" in opt)
3501
+ obj.setOption(key, opt.value);
3502
+ });
3503
+ };
3504
+
3505
+ this.setDefaultValue = function(path, name, value) {
3506
+ var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});
3507
+ if (opts[name]) {
3508
+ if (opts.forwardTo)
3509
+ this.setDefaultValue(opts.forwardTo, name, value);
3510
+ else
3511
+ opts[name].value = value;
3512
+ }
3513
+ };
3514
+
3515
+ this.setDefaultValues = function(path, optionHash) {
3516
+ Object.keys(optionHash).forEach(function(key) {
3517
+ this.setDefaultValue(path, key, optionHash[key]);
3518
+ }, this);
3519
+ };
3520
+
3521
+ this.warn = warn;
3522
+ this.reportError = reportError;
3523
+
3524
+ }).call(AppConfig.prototype);
3525
+
3526
+ exports.AppConfig = AppConfig;
3527
+
3528
+ });
3529
+
3530
+ define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"], function(require, exports, module) {
3422
3531
  "no use strict";
3423
3532
 
3424
3533
  var lang = require("./lib/lang");
3425
3534
  var oop = require("./lib/oop");
3426
3535
  var net = require("./lib/net");
3427
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
3536
+ var AppConfig = require("./lib/app_config").AppConfig;
3537
+
3538
+ module.exports = exports = new AppConfig();
3428
3539
 
3429
3540
  var global = (function() {
3430
3541
  return this;
@@ -3457,8 +3568,6 @@ exports.set = function(key, value) {
3457
3568
  exports.all = function() {
3458
3569
  return lang.copyObject(options);
3459
3570
  };
3460
- oop.implement(exports, EventEmitter);
3461
-
3462
3571
  exports.moduleUrl = function(name, component) {
3463
3572
  if (options.$moduleUrls[name])
3464
3573
  return options.$moduleUrls[name];
@@ -3581,99 +3690,6 @@ function deHyphenate(str) {
3581
3690
  return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
3582
3691
  }
3583
3692
 
3584
- var optionsProvider = {
3585
- setOptions: function(optList) {
3586
- Object.keys(optList).forEach(function(key) {
3587
- this.setOption(key, optList[key]);
3588
- }, this);
3589
- },
3590
- getOptions: function(optionNames) {
3591
- var result = {};
3592
- if (!optionNames) {
3593
- optionNames = Object.keys(this.$options);
3594
- } else if (!Array.isArray(optionNames)) {
3595
- result = optionNames;
3596
- optionNames = Object.keys(result);
3597
- }
3598
- optionNames.forEach(function(key) {
3599
- result[key] = this.getOption(key);
3600
- }, this);
3601
- return result;
3602
- },
3603
- setOption: function(name, value) {
3604
- if (this["$" + name] === value)
3605
- return;
3606
- var opt = this.$options[name];
3607
- if (!opt) {
3608
- if (typeof console != "undefined" && console.warn)
3609
- console.warn('misspelled option "' + name + '"');
3610
- return undefined;
3611
- }
3612
- if (opt.forwardTo)
3613
- return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
3614
-
3615
- if (!opt.handlesSet)
3616
- this["$" + name] = value;
3617
- if (opt && opt.set)
3618
- opt.set.call(this, value);
3619
- },
3620
- getOption: function(name) {
3621
- var opt = this.$options[name];
3622
- if (!opt) {
3623
- if (typeof console != "undefined" && console.warn)
3624
- console.warn('misspelled option "' + name + '"');
3625
- return undefined;
3626
- }
3627
- if (opt.forwardTo)
3628
- return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
3629
- return opt && opt.get ? opt.get.call(this) : this["$" + name];
3630
- }
3631
- };
3632
-
3633
- var defaultOptions = {};
3634
- exports.defineOptions = function(obj, path, options) {
3635
- if (!obj.$options)
3636
- defaultOptions[path] = obj.$options = {};
3637
-
3638
- Object.keys(options).forEach(function(key) {
3639
- var opt = options[key];
3640
- if (typeof opt == "string")
3641
- opt = {forwardTo: opt};
3642
-
3643
- opt.name || (opt.name = key);
3644
- obj.$options[opt.name] = opt;
3645
- if ("initialValue" in opt)
3646
- obj["$" + opt.name] = opt.initialValue;
3647
- });
3648
- oop.implement(obj, optionsProvider);
3649
-
3650
- return this;
3651
- };
3652
-
3653
- exports.resetOptions = function(obj) {
3654
- Object.keys(obj.$options).forEach(function(key) {
3655
- var opt = obj.$options[key];
3656
- if ("value" in opt)
3657
- obj.setOption(key, opt.value);
3658
- });
3659
- };
3660
-
3661
- exports.setDefaultValue = function(path, name, value) {
3662
- var opts = defaultOptions[path] || (defaultOptions[path] = {});
3663
- if (opts[name]) {
3664
- if (opts.forwardTo)
3665
- exports.setDefaultValue(opts.forwardTo, name, value);
3666
- else
3667
- opts[name].value = value;
3668
- }
3669
- };
3670
-
3671
- exports.setDefaultValues = function(path, optionHash) {
3672
- Object.keys(optionHash).forEach(function(key) {
3673
- exports.setDefaultValue(path, key, optionHash[key]);
3674
- });
3675
- };
3676
-
3677
3693
  });
3678
3694
 
3679
3695
  define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"], function(require, exports, module) {
@@ -3694,13 +3710,13 @@ var MouseHandler = function(editor) {
3694
3710
  new DefaultHandlers(this);
3695
3711
  new DefaultGutterHandler(this);
3696
3712
  new DragdropHandler(this);
3697
-
3698
- var focusEditor = function(e) {
3699
- if (!editor.isFocused() && editor.textInput)
3700
- editor.textInput.moveToMouse(e);
3701
- editor.focus()
3713
+
3714
+ var focusEditor = function(e) {
3715
+ if (!document.hasFocus || !document.hasFocus())
3716
+ window.focus();
3717
+ editor.focus();
3702
3718
  };
3703
-
3719
+
3704
3720
  var mouseTarget = editor.renderer.getMouseEventTarget();
3705
3721
  event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
3706
3722
  event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
@@ -3710,7 +3726,7 @@ var MouseHandler = function(editor) {
3710
3726
  event.addMultiMouseDownListener(editor.renderer.scrollBarH.inner, [400, 300, 250], this, "onMouseEvent");
3711
3727
  if (useragent.isIE) {
3712
3728
  event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor);
3713
- event.addListener(editor.renderer.scrollBarH.element, "mousemove", focusEditor);
3729
+ event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor);
3714
3730
  }
3715
3731
  }
3716
3732
  event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
@@ -3731,12 +3747,12 @@ var MouseHandler = function(editor) {
3731
3747
  editor.on("mousemove", function(e){
3732
3748
  if (_self.state || _self.$dragDelay || !_self.$dragEnabled)
3733
3749
  return;
3734
-
3735
- var char = editor.renderer.screenToTextCoordinates(e.x, e.y);
3750
+
3751
+ var character = editor.renderer.screenToTextCoordinates(e.x, e.y);
3736
3752
  var range = editor.session.selection.getRange();
3737
3753
  var renderer = editor.renderer;
3738
3754
 
3739
- if (!range.isEmpty() && range.insideStart(char.row, char.column)) {
3755
+ if (!range.isEmpty() && range.insideStart(character.row, character.column)) {
3740
3756
  renderer.setCursorStyle("default");
3741
3757
  } else {
3742
3758
  renderer.setCursorStyle("");
@@ -4867,8 +4883,10 @@ var Selection = function(session) {
4867
4883
  exports.Selection = Selection;
4868
4884
  });
4869
4885
 
4870
- define("ace/tokenizer",["require","exports","module"], function(require, exports, module) {
4886
+ define("ace/tokenizer",["require","exports","module","ace/config"], function(require, exports, module) {
4871
4887
  "use strict";
4888
+
4889
+ var config = require("./config");
4872
4890
  var MAX_TOKEN_COUNT = 2000;
4873
4891
  var Tokenizer = function(rules) {
4874
4892
  this.states = rules;
@@ -5165,13 +5183,8 @@ var Tokenizer = function(rules) {
5165
5183
  };
5166
5184
  };
5167
5185
 
5168
- this.reportError = function(msg, data) {
5169
- var e = new Error(msg);
5170
- e.data = data;
5171
- if (typeof console == "object" && console.error)
5172
- console.error(e);
5173
- setTimeout(function() { throw e; });
5174
- };
5186
+ this.reportError = config.reportError;
5187
+
5175
5188
  }).call(Tokenizer.prototype);
5176
5189
 
5177
5190
  exports.Tokenizer = Tokenizer;
@@ -6198,9 +6211,9 @@ var Document = function(text) {
6198
6211
  this._insertLines = function(row, lines) {
6199
6212
  if (lines.length == 0)
6200
6213
  return {row: row, column: 0};
6201
- while (lines.length > 0xF000) {
6202
- var end = this._insertLines(row, lines.slice(0, 0xF000));
6203
- lines = lines.slice(0xF000);
6214
+ while (lines.length > 20000) {
6215
+ var end = this._insertLines(row, lines.slice(0, 20000));
6216
+ lines = lines.slice(20000);
6204
6217
  row = end.row;
6205
6218
  }
6206
6219
 
@@ -7727,7 +7740,8 @@ function Folding() {
7727
7740
 
7728
7741
  this.$foldMode = foldMode;
7729
7742
 
7730
- this.removeListener('change', this.$updateFoldWidgets);
7743
+ this.off('change', this.$updateFoldWidgets);
7744
+ this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
7731
7745
  this._emit("changeAnnotation");
7732
7746
 
7733
7747
  if (!foldMode || this.$foldStyle == "manual") {
@@ -7740,8 +7754,9 @@ function Folding() {
7740
7754
  this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
7741
7755
 
7742
7756
  this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
7757
+ this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);
7743
7758
  this.on('change', this.$updateFoldWidgets);
7744
-
7759
+ this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
7745
7760
  };
7746
7761
 
7747
7762
  this.getParentFoldRangeData = function (row, ignoreCurrent) {
@@ -7822,7 +7837,7 @@ function Folding() {
7822
7837
  this.foldAll(startRow, endRow, options.all ? 10000 : 0);
7823
7838
  } else if (options.children) {
7824
7839
  endRow = range ? range.end.row : this.getLength();
7825
- this.foldAll(row + 1, range.end.row, options.all ? 10000 : 0);
7840
+ this.foldAll(row + 1, endRow, options.all ? 10000 : 0);
7826
7841
  } else if (range) {
7827
7842
  if (options.all)
7828
7843
  range.collapseChildren = 10000;
@@ -7872,7 +7887,13 @@ function Folding() {
7872
7887
  this.foldWidgets.splice.apply(this.foldWidgets, args);
7873
7888
  }
7874
7889
  };
7875
-
7890
+ this.tokenizerUpdateFoldWidgets = function(e) {
7891
+ var rows = e.data;
7892
+ if (rows.first != rows.last) {
7893
+ if (this.foldWidgets.length > rows.first)
7894
+ this.foldWidgets.splice(rows.first, this.foldWidgets.length);
7895
+ }
7896
+ }
7876
7897
  }
7877
7898
 
7878
7899
  exports.Folding = Folding;
@@ -8531,17 +8552,17 @@ var EditSession = function(text, mode) {
8531
8552
  config.loadModule(["mode", path], function(m) {
8532
8553
  if (this.$modeId !== path)
8533
8554
  return cb && cb();
8534
- if (this.$modes[path] && !options)
8535
- return this.$onChangeMode(this.$modes[path]);
8536
- if (m && m.Mode) {
8555
+ if (this.$modes[path] && !options) {
8556
+ this.$onChangeMode(this.$modes[path]);
8557
+ } else if (m && m.Mode) {
8537
8558
  m = new m.Mode(options);
8538
8559
  if (!options) {
8539
8560
  this.$modes[path] = m;
8540
8561
  m.$id = path;
8541
8562
  }
8542
8563
  this.$onChangeMode(m);
8543
- cb && cb();
8544
8564
  }
8565
+ cb && cb();
8545
8566
  }.bind(this));
8546
8567
  if (!this.$mode)
8547
8568
  this.$onChangeMode(this.$modes["ace/mode/text"], true);
@@ -8604,10 +8625,7 @@ var EditSession = function(text, mode) {
8604
8625
  try {
8605
8626
  this.$worker = this.$mode.createWorker(this);
8606
8627
  } catch (e) {
8607
- if (typeof console == "object") {
8608
- console.log("Could not load worker");
8609
- console.log(e);
8610
- }
8628
+ config.warn("Could not load worker", e);
8611
8629
  this.$worker = null;
8612
8630
  }
8613
8631
  };
@@ -9008,12 +9026,10 @@ var EditSession = function(text, mode) {
9008
9026
  };
9009
9027
  this.setWrapLimitRange = function(min, max) {
9010
9028
  if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
9011
- this.$wrapLimitRange = {
9012
- min: min,
9013
- max: max
9014
- };
9029
+ this.$wrapLimitRange = { min: min, max: max };
9015
9030
  this.$modified = true;
9016
- this._signal("changeWrapMode");
9031
+ if (this.$useWrapMode)
9032
+ this._signal("changeWrapMode");
9017
9033
  }
9018
9034
  };
9019
9035
  this.adjustWrapLimit = function(desiredLimit, $printMargin) {
@@ -9677,6 +9693,7 @@ config.defineOptions(EditSession.prototype, "session", {
9677
9693
 
9678
9694
  if (this.$wrap == value)
9679
9695
  return;
9696
+ this.$wrap = value;
9680
9697
  if (!value) {
9681
9698
  this.setUseWrapMode(false);
9682
9699
  } else {
@@ -9684,7 +9701,6 @@ config.defineOptions(EditSession.prototype, "session", {
9684
9701
  this.setWrapLimitRange(col, col);
9685
9702
  this.setUseWrapMode(true);
9686
9703
  }
9687
- this.$wrap = value;
9688
9704
  },
9689
9705
  get: function() {
9690
9706
  if (this.getUseWrapMode()) {
@@ -9782,8 +9798,8 @@ var Search = function() {
9782
9798
  this.$options = options;
9783
9799
  };
9784
9800
  this.find = function(session) {
9785
- var iterator = this.$matchIterator(session, this.$options);
9786
-
9801
+ var options = this.$options;
9802
+ var iterator = this.$matchIterator(session, options);
9787
9803
  if (!iterator)
9788
9804
  return false;
9789
9805
 
@@ -9791,7 +9807,13 @@ var Search = function() {
9791
9807
  iterator.forEach(function(range, row, offset) {
9792
9808
  if (!range.start) {
9793
9809
  var column = range.offset + (offset || 0);
9794
- firstRange = new Range(row, column, row, column+range.length);
9810
+ firstRange = new Range(row, column, row, column + range.length);
9811
+ if (!range.length && options.start && options.start.start
9812
+ && options.skipCurrent != false && firstRange.isEqual(options.start)
9813
+ ) {
9814
+ firstRange = null;
9815
+ return false;
9816
+ }
9795
9817
  } else
9796
9818
  firstRange = range;
9797
9819
  return true;
@@ -9901,8 +9923,7 @@ var Search = function() {
9901
9923
  if (!re)
9902
9924
  return false;
9903
9925
 
9904
- var self = this, callback, backwards = options.backwards;
9905
-
9926
+ var callback;
9906
9927
  if (options.$isMultiLine) {
9907
9928
  var len = re.length;
9908
9929
  var matchIterator = function(line, row, offset) {
@@ -9927,7 +9948,7 @@ var Search = function() {
9927
9948
  if (callback(range))
9928
9949
  return true;
9929
9950
  };
9930
- } else if (backwards) {
9951
+ } else if (options.backwards) {
9931
9952
  var matchIterator = function(line, row, startIndex) {
9932
9953
  var matches = lang.getMatchOffsets(line, re);
9933
9954
  for (var i = matches.length-1; i >= 0; i--)
@@ -9942,11 +9963,13 @@ var Search = function() {
9942
9963
  return true;
9943
9964
  };
9944
9965
  }
9966
+
9967
+ var lineIterator = this.$lineIterator(session, options);
9945
9968
 
9946
9969
  return {
9947
9970
  forEach: function(_callback) {
9948
9971
  callback = _callback;
9949
- self.$lineIterator(session, options).forEach(matchIterator);
9972
+ lineIterator.forEach(matchIterator);
9950
9973
  }
9951
9974
  };
9952
9975
  };
@@ -10423,29 +10446,33 @@ exports.commands = [{
10423
10446
  name: "fold",
10424
10447
  bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
10425
10448
  exec: function(editor) { editor.session.toggleFold(false); },
10449
+ multiSelectAction: "forEach",
10426
10450
  scrollIntoView: "center",
10427
10451
  readOnly: true
10428
10452
  }, {
10429
10453
  name: "unfold",
10430
10454
  bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
10431
10455
  exec: function(editor) { editor.session.toggleFold(true); },
10456
+ multiSelectAction: "forEach",
10432
10457
  scrollIntoView: "center",
10433
10458
  readOnly: true
10434
10459
  }, {
10435
10460
  name: "toggleFoldWidget",
10436
10461
  bindKey: bindKey("F2", "F2"),
10437
10462
  exec: function(editor) { editor.session.toggleFoldWidget(); },
10463
+ multiSelectAction: "forEach",
10438
10464
  scrollIntoView: "center",
10439
10465
  readOnly: true
10440
10466
  }, {
10441
10467
  name: "toggleParentFoldWidget",
10442
10468
  bindKey: bindKey("Alt-F2", "Alt-F2"),
10443
10469
  exec: function(editor) { editor.session.toggleFoldWidget(true); },
10470
+ multiSelectAction: "forEach",
10444
10471
  scrollIntoView: "center",
10445
10472
  readOnly: true
10446
10473
  }, {
10447
10474
  name: "foldall",
10448
- bindKey: bindKey("Ctrl-Alt-0", "Ctrl-Command-Option-0"),
10475
+ bindKey: bindKey(null, "Ctrl-Command-Option-0"),
10449
10476
  exec: function(editor) { editor.session.foldAll(); },
10450
10477
  scrollIntoView: "center",
10451
10478
  readOnly: true
@@ -10531,12 +10558,14 @@ exports.commands = [{
10531
10558
  bindKey: bindKey("Shift-Up", "Shift-Up"),
10532
10559
  exec: function(editor) { editor.getSelection().selectUp(); },
10533
10560
  multiSelectAction: "forEach",
10561
+ scrollIntoView: "cursor",
10534
10562
  readOnly: true
10535
10563
  }, {
10536
10564
  name: "golineup",
10537
10565
  bindKey: bindKey("Up", "Up|Ctrl-P"),
10538
10566
  exec: function(editor, args) { editor.navigateUp(args.times); },
10539
10567
  multiSelectAction: "forEach",
10568
+ scrollIntoView: "cursor",
10540
10569
  readOnly: true
10541
10570
  }, {
10542
10571
  name: "selecttoend",
@@ -10721,16 +10750,25 @@ exports.commands = [{
10721
10750
  bindKey: bindKey("Ctrl-P", "Ctrl-P"),
10722
10751
  exec: function(editor) { editor.jumpToMatching(); },
10723
10752
  multiSelectAction: "forEach",
10753
+ scrollIntoView: "animate",
10724
10754
  readOnly: true
10725
10755
  }, {
10726
10756
  name: "selecttomatching",
10727
10757
  bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
10728
10758
  exec: function(editor) { editor.jumpToMatching(true); },
10729
10759
  multiSelectAction: "forEach",
10760
+ scrollIntoView: "animate",
10761
+ readOnly: true
10762
+ }, {
10763
+ name: "expandToMatching",
10764
+ bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
10765
+ exec: function(editor) { editor.jumpToMatching(true, true); },
10766
+ multiSelectAction: "forEach",
10767
+ scrollIntoView: "animate",
10730
10768
  readOnly: true
10731
10769
  }, {
10732
10770
  name: "passKeysToBrowser",
10733
- bindKey: bindKey("null", "null"),
10771
+ bindKey: bindKey(null, null),
10734
10772
  exec: function() {},
10735
10773
  passEvent: true,
10736
10774
  readOnly: true
@@ -10782,11 +10820,13 @@ exports.commands = [{
10782
10820
  name: "modifyNumberUp",
10783
10821
  bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
10784
10822
  exec: function(editor) { editor.modifyNumber(1); },
10823
+ scrollIntoView: "cursor",
10785
10824
  multiSelectAction: "forEach"
10786
10825
  }, {
10787
10826
  name: "modifyNumberDown",
10788
10827
  bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
10789
10828
  exec: function(editor) { editor.modifyNumber(-1); },
10829
+ scrollIntoView: "cursor",
10790
10830
  multiSelectAction: "forEach"
10791
10831
  }, {
10792
10832
  name: "replace",
@@ -10953,7 +10993,7 @@ exports.commands = [{
10953
10993
  var isBackwards = editor.selection.isBackwards();
10954
10994
  var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
10955
10995
  var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
10956
- var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length
10996
+ var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length;
10957
10997
  var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
10958
10998
  var selectedCount = selectedText.replace(/\n\s*/, " ").length;
10959
10999
  var insertLine = editor.session.doc.getLine(selectionStart.row);
@@ -10964,7 +11004,7 @@ exports.commands = [{
10964
11004
  curLine = " " + curLine;
10965
11005
  }
10966
11006
  insertLine += curLine;
10967
- };
11007
+ }
10968
11008
 
10969
11009
  if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {
10970
11010
  insertLine += editor.session.doc.getNewLineCharacter();
@@ -11125,14 +11165,18 @@ var Editor = function(renderer, session) {
11125
11165
  args: commadEvent.args,
11126
11166
  scrollTop: this.renderer.scrollTop
11127
11167
  };
11168
+ if (this.curOp.command.name && this.curOp.command.scrollIntoView !== undefined)
11169
+ this.$blockScrolling++;
11128
11170
  };
11129
11171
 
11130
11172
  this.endOperation = function(e) {
11131
11173
  if (this.curOp) {
11132
11174
  if (e && e.returnValue === false)
11133
11175
  return this.curOp = null;
11134
-
11176
+ this._signal("beforeEndOperation");
11135
11177
  var command = this.curOp.command;
11178
+ if (command.name && this.$blockScrolling > 0)
11179
+ this.$blockScrolling--;
11136
11180
  if (command && command.scrollIntoView) {
11137
11181
  switch (command.scrollIntoView) {
11138
11182
  case "center":
@@ -11402,12 +11446,18 @@ var Editor = function(renderer, session) {
11402
11446
  var iterator = new TokenIterator(self.session, pos.row, pos.column);
11403
11447
  var token = iterator.getCurrentToken();
11404
11448
 
11405
- if (!token || token.type.indexOf('tag-name') === -1) {
11449
+ if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) {
11406
11450
  session.removeMarker(session.$tagHighlight);
11407
11451
  session.$tagHighlight = null;
11408
11452
  return;
11409
11453
  }
11410
-
11454
+
11455
+ if (token.type.indexOf("tag-open") != -1) {
11456
+ token = iterator.stepForward();
11457
+ if (!token)
11458
+ return;
11459
+ }
11460
+
11411
11461
  var tag = token.value;
11412
11462
  var depth = 0;
11413
11463
  var prevToken = iterator.stepBackward();
@@ -11526,6 +11576,10 @@ var Editor = function(renderer, session) {
11526
11576
  this.$cursorChange();
11527
11577
 
11528
11578
  if (!this.$blockScrolling) {
11579
+ config.warn("Automatically scrolling cursor into view after selection change",
11580
+ "this will be disabled in the next version",
11581
+ "set editor.$blockScrolling = Infinity to disable this message"
11582
+ );
11529
11583
  this.renderer.scrollCursorIntoView();
11530
11584
  }
11531
11585
 
@@ -11668,9 +11722,28 @@ var Editor = function(renderer, session) {
11668
11722
  this.onPaste = function(text) {
11669
11723
  if (this.$readOnly)
11670
11724
  return;
11725
+
11671
11726
  var e = {text: text};
11672
11727
  this._signal("paste", e);
11673
- this.insert(e.text, true);
11728
+ text = e.text;
11729
+ if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
11730
+ this.insert(text);
11731
+ } else {
11732
+ var lines = text.split(/\r\n|\r|\n/);
11733
+ var ranges = this.selection.rangeList.ranges;
11734
+
11735
+ if (lines.length > ranges.length || lines.length < 2 || !lines[1])
11736
+ return this.commands.exec("insertstring", this, text);
11737
+
11738
+ for (var i = ranges.length; i--;) {
11739
+ var range = ranges[i];
11740
+ if (!range.isEmpty())
11741
+ this.session.remove(range);
11742
+
11743
+ this.session.insert(range.start, lines[i]);
11744
+ }
11745
+ }
11746
+ this.renderer.scrollCursorIntoView();
11674
11747
  };
11675
11748
 
11676
11749
  this.execCommand = function(command, args) {
@@ -12143,67 +12216,71 @@ var Editor = function(renderer, session) {
12143
12216
  }
12144
12217
  };
12145
12218
  this.moveLinesDown = function() {
12146
- this.$moveLines(function(firstRow, lastRow) {
12147
- return this.session.moveLinesDown(firstRow, lastRow);
12148
- });
12219
+ this.$moveLines(1, false);
12149
12220
  };
12150
12221
  this.moveLinesUp = function() {
12151
- this.$moveLines(function(firstRow, lastRow) {
12152
- return this.session.moveLinesUp(firstRow, lastRow);
12153
- });
12222
+ this.$moveLines(-1, false);
12154
12223
  };
12155
12224
  this.moveText = function(range, toPosition, copy) {
12156
12225
  return this.session.moveText(range, toPosition, copy);
12157
12226
  };
12158
12227
  this.copyLinesUp = function() {
12159
- this.$moveLines(function(firstRow, lastRow) {
12160
- this.session.duplicateLines(firstRow, lastRow);
12161
- return 0;
12162
- });
12228
+ this.$moveLines(-1, true);
12163
12229
  };
12164
12230
  this.copyLinesDown = function() {
12165
- this.$moveLines(function(firstRow, lastRow) {
12166
- return this.session.duplicateLines(firstRow, lastRow);
12167
- });
12231
+ this.$moveLines(1, true);
12168
12232
  };
12169
- this.$moveLines = function(mover) {
12233
+ this.$moveLines = function(dir, copy) {
12234
+ var rows, moved;
12170
12235
  var selection = this.selection;
12171
12236
  if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
12172
12237
  var range = selection.toOrientedRange();
12173
- var rows = this.$getSelectedRows(range);
12174
- var linesMoved = mover.call(this, rows.first, rows.last);
12175
- range.moveBy(linesMoved, 0);
12238
+ rows = this.$getSelectedRows(range);
12239
+ moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir);
12240
+ if (copy && dir == -1) moved = 0;
12241
+ range.moveBy(moved, 0);
12176
12242
  selection.fromOrientedRange(range);
12177
12243
  } else {
12178
12244
  var ranges = selection.rangeList.ranges;
12179
12245
  selection.rangeList.detach(this.session);
12180
-
12181
- for (var i = ranges.length; i--; ) {
12246
+ this.inVirtualSelectionMode = true;
12247
+
12248
+ var diff = 0;
12249
+ var totalDiff = 0;
12250
+ var l = ranges.length;
12251
+ for (var i = 0; i < l; i++) {
12182
12252
  var rangeIndex = i;
12183
- var rows = ranges[i].collapseRows();
12184
- var last = rows.end.row;
12185
- var first = rows.start.row;
12186
- while (i--) {
12187
- rows = ranges[i].collapseRows();
12188
- if (first - rows.end.row <= 1)
12189
- first = rows.end.row;
12190
- else
12253
+ ranges[i].moveBy(diff, 0);
12254
+ rows = this.$getSelectedRows(ranges[i]);
12255
+ var first = rows.first;
12256
+ var last = rows.last;
12257
+ while (++i < l) {
12258
+ if (totalDiff) ranges[i].moveBy(totalDiff, 0);
12259
+ var subRows = this.$getSelectedRows(ranges[i]);
12260
+ if (copy && subRows.first != last)
12261
+ break;
12262
+ else if (!copy && subRows.first > last + 1)
12191
12263
  break;
12264
+ last = subRows.last;
12192
12265
  }
12193
- i++;
12194
-
12195
- var linesMoved = mover.call(this, first, last);
12196
- while (rangeIndex >= i) {
12197
- ranges[rangeIndex].moveBy(linesMoved, 0);
12198
- rangeIndex--;
12266
+ i--;
12267
+ diff = this.session.$moveLines(first, last, copy ? 0 : dir);
12268
+ if (copy && dir == -1) rangeIndex = i + 1;
12269
+ while (rangeIndex <= i) {
12270
+ ranges[rangeIndex].moveBy(diff, 0);
12271
+ rangeIndex++;
12199
12272
  }
12273
+ if (!copy) diff = 0;
12274
+ totalDiff += diff;
12200
12275
  }
12276
+
12201
12277
  selection.fromOrientedRange(selection.ranges[0]);
12202
12278
  selection.rangeList.attach(this.session);
12279
+ this.inVirtualSelectionMode = false;
12203
12280
  }
12204
12281
  };
12205
- this.$getSelectedRows = function() {
12206
- var range = this.getSelectionRange().collapseRows();
12282
+ this.$getSelectedRows = function(range) {
12283
+ range = (range || this.getSelectionRange()).collapseRows();
12207
12284
 
12208
12285
  return {
12209
12286
  first: this.session.getRowFoldStart(range.start.row),
@@ -13431,10 +13508,10 @@ var Text = function(parentEl) {
13431
13508
  if (this.showInvisibles) {
13432
13509
  tabStr.push("<span class='ace_invisible ace_invisible_tab'>"
13433
13510
  + this.TAB_CHAR
13434
- + lang.stringRepeat("\xa0", i - 1)
13511
+ + lang.stringRepeat(" ", i - 1)
13435
13512
  + "</span>");
13436
13513
  } else {
13437
- tabStr.push(lang.stringRepeat("\xa0", i));
13514
+ tabStr.push(lang.stringRepeat(" ", i));
13438
13515
  }
13439
13516
  }
13440
13517
  if (this.displayIndentGuides) {
@@ -13447,9 +13524,9 @@ var Text = function(parentEl) {
13447
13524
  spaceClass = " ace_invisible_space";
13448
13525
  tabClass = " ace_invisible_tab";
13449
13526
  var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
13450
- var tabContent = this.TAB_CHAR + lang.stringRepeat("\xa0", this.tabSize - 1);
13527
+ var tabContent = this.TAB_CHAR + lang.stringRepeat(" ", this.tabSize - 1);
13451
13528
  } else{
13452
- var spaceContent = lang.stringRepeat("\xa0", this.tabSize);
13529
+ var spaceContent = lang.stringRepeat(" ", this.tabSize);
13453
13530
  var tabContent = spaceContent;
13454
13531
  }
13455
13532
 
@@ -13621,9 +13698,9 @@ var Text = function(parentEl) {
13621
13698
  var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
13622
13699
  var replaceFunc = function(c, a, b, tabIdx, idx4) {
13623
13700
  if (a) {
13624
- return self.showInvisibles ?
13625
- "<span class='ace_invisible ace_invisible_space'>" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "</span>" :
13626
- lang.stringRepeat("\xa0", c.length);
13701
+ return self.showInvisibles
13702
+ ? "<span class='ace_invisible ace_invisible_space'>" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "</span>"
13703
+ : c;
13627
13704
  } else if (c == "&") {
13628
13705
  return "&#38;";
13629
13706
  } else if (c == "<") {
@@ -14028,11 +14105,15 @@ var Cursor = function(parentEl) {
14028
14105
  }
14029
14106
 
14030
14107
  var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
14031
-
14032
- style.left = pixelPos.left + "px";
14033
- style.top = pixelPos.top + "px";
14034
- style.width = config.characterWidth + "px";
14035
- style.height = config.lineHeight + "px";
14108
+
14109
+ if (!this.drawCursor) {
14110
+ style.left = pixelPos.left + "px";
14111
+ style.top = pixelPos.top + "px";
14112
+ style.width = config.characterWidth + "px";
14113
+ style.height = config.lineHeight + "px";
14114
+ } else {
14115
+ this.drawCursor(style, pixelPos, config, selections[i], this.session);
14116
+ }
14036
14117
  }
14037
14118
  while (this.cursors.length > cursorIndex)
14038
14119
  this.removeCursor();
@@ -14042,6 +14123,8 @@ var Cursor = function(parentEl) {
14042
14123
  this.$pixelPos = pixelPos;
14043
14124
  this.restartTimer();
14044
14125
  };
14126
+
14127
+ this.drawCursor = null;
14045
14128
 
14046
14129
  this.$setOverwrite = function(overwrite) {
14047
14130
  if (overwrite != this.overwrite) {
@@ -14278,9 +14361,9 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
14278
14361
 
14279
14362
  this.$setMeasureNodeStyles = function(style, isRoot) {
14280
14363
  style.width = style.height = "auto";
14281
- style.left = style.top = "-100px";
14364
+ style.left = style.top = "0px";
14282
14365
  style.visibility = "hidden";
14283
- style.position = "fixed";
14366
+ style.position = "absolute";
14284
14367
  style.whiteSpace = "pre";
14285
14368
 
14286
14369
  if (useragent.isIE < 8) {
@@ -14528,6 +14611,7 @@ text-indent: 0;\
14528
14611
  z-index: 1;\
14529
14612
  position: absolute;\
14530
14613
  overflow: hidden;\
14614
+ word-wrap: normal;\
14531
14615
  white-space: pre;\
14532
14616
  height: 100%;\
14533
14617
  width: 100%;\
@@ -14741,7 +14825,7 @@ z-index: 8;\
14741
14825
  }\
14742
14826
  ";
14743
14827
 
14744
- dom.importCssString(editorCss, "ace_editor");
14828
+ dom.importCssString(editorCss, "ace_editor.css");
14745
14829
 
14746
14830
  var VirtualRenderer = function(container, theme) {
14747
14831
  var _self = this;
@@ -14987,6 +15071,7 @@ var VirtualRenderer = function(container, theme) {
14987
15071
 
14988
15072
  if (this.resizing)
14989
15073
  this.resizing = 0;
15074
+ this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;
14990
15075
  };
14991
15076
 
14992
15077
  this.$updateCachedSize = function(force, gutterWidth, width, height) {
@@ -15163,9 +15248,12 @@ var VirtualRenderer = function(container, theme) {
15163
15248
  var posLeft = this.$cursorLayer.$pixelPos.left;
15164
15249
  posTop -= config.offset;
15165
15250
 
15251
+ var style = this.textarea.style;
15166
15252
  var h = this.lineHeight;
15167
- if (posTop < 0 || posTop > config.height - h)
15253
+ if (posTop < 0 || posTop > config.height - h) {
15254
+ style.top = style.left = "0";
15168
15255
  return;
15256
+ }
15169
15257
 
15170
15258
  var w = this.characterWidth;
15171
15259
  if (this.$composition) {
@@ -15178,11 +15266,10 @@ var VirtualRenderer = function(container, theme) {
15178
15266
  posLeft = this.$size.scrollerWidth - w;
15179
15267
 
15180
15268
  posLeft += this.gutterWidth;
15181
-
15182
- this.textarea.style.height = h + "px";
15183
- this.textarea.style.width = w + "px";
15184
- this.textarea.style.left = Math.min(posLeft, this.$size.scrollerWidth - w) + "px";
15185
- this.textarea.style.top = Math.min(posTop, this.$size.height - h) + "px";
15269
+ style.height = h + "px";
15270
+ style.width = w + "px";
15271
+ style.left = Math.min(posLeft, this.$size.scrollerWidth - w) + "px";
15272
+ style.top = Math.min(posTop, this.$size.height - h) + "px";
15186
15273
  };
15187
15274
  this.getFirstVisibleRow = function() {
15188
15275
  return this.layerConfig.firstRow;
@@ -15228,7 +15315,7 @@ var VirtualRenderer = function(container, theme) {
15228
15315
  this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
15229
15316
  };
15230
15317
  this.getVScrollBarAlwaysVisible = function() {
15231
- return this.$hScrollBarAlwaysVisible;
15318
+ return this.$vScrollBarAlwaysVisible;
15232
15319
  };
15233
15320
  this.setVScrollBarAlwaysVisible = function(alwaysVisible) {
15234
15321
  this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
@@ -16506,7 +16593,8 @@ function onMouseDown(e) {
16506
16593
  if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))
16507
16594
  return;
16508
16595
  screenCursor = newCursor;
16509
-
16596
+
16597
+ editor.$blockScrolling++;
16510
16598
  editor.selection.moveToPosition(cursor);
16511
16599
  editor.renderer.scrollCursorIntoView();
16512
16600
 
@@ -16516,8 +16604,9 @@ function onMouseDown(e) {
16516
16604
  rectSel[0] = editor.$mouseHandler.$clickSelection.clone();
16517
16605
  rectSel.forEach(editor.addSelectionMarker, editor);
16518
16606
  editor.updateSelectionMarkers();
16607
+ editor.$blockScrolling--;
16519
16608
  };
16520
-
16609
+ editor.$blockScrolling++;
16521
16610
  if (isMultiSelect && !accel) {
16522
16611
  selection.toSingleRange();
16523
16612
  } else if (!isMultiSelect && accel) {
@@ -16529,6 +16618,7 @@ function onMouseDown(e) {
16529
16618
  screenAnchor = session.documentToScreenPosition(selection.lead);
16530
16619
  else
16531
16620
  selection.moveToPosition(pos);
16621
+ editor.$blockScrolling--;
16532
16622
 
16533
16623
  screenCursor = {row: -1, column: -1};
16534
16624
 
@@ -16568,41 +16658,49 @@ exports.defaultCommands = [{
16568
16658
  name: "addCursorAbove",
16569
16659
  exec: function(editor) { editor.selectMoreLines(-1); },
16570
16660
  bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
16661
+ scrollIntoView: "cursor",
16571
16662
  readonly: true
16572
16663
  }, {
16573
16664
  name: "addCursorBelow",
16574
16665
  exec: function(editor) { editor.selectMoreLines(1); },
16575
16666
  bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
16667
+ scrollIntoView: "cursor",
16576
16668
  readonly: true
16577
16669
  }, {
16578
16670
  name: "addCursorAboveSkipCurrent",
16579
16671
  exec: function(editor) { editor.selectMoreLines(-1, true); },
16580
16672
  bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
16673
+ scrollIntoView: "cursor",
16581
16674
  readonly: true
16582
16675
  }, {
16583
16676
  name: "addCursorBelowSkipCurrent",
16584
16677
  exec: function(editor) { editor.selectMoreLines(1, true); },
16585
16678
  bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
16679
+ scrollIntoView: "cursor",
16586
16680
  readonly: true
16587
16681
  }, {
16588
16682
  name: "selectMoreBefore",
16589
16683
  exec: function(editor) { editor.selectMore(-1); },
16590
16684
  bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
16685
+ scrollIntoView: "cursor",
16591
16686
  readonly: true
16592
16687
  }, {
16593
16688
  name: "selectMoreAfter",
16594
16689
  exec: function(editor) { editor.selectMore(1); },
16595
16690
  bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
16691
+ scrollIntoView: "cursor",
16596
16692
  readonly: true
16597
16693
  }, {
16598
16694
  name: "selectNextBefore",
16599
16695
  exec: function(editor) { editor.selectMore(-1, true); },
16600
16696
  bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
16697
+ scrollIntoView: "cursor",
16601
16698
  readonly: true
16602
16699
  }, {
16603
16700
  name: "selectNextAfter",
16604
16701
  exec: function(editor) { editor.selectMore(1, true); },
16605
16702
  bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
16703
+ scrollIntoView: "cursor",
16606
16704
  readonly: true
16607
16705
  }, {
16608
16706
  name: "splitIntoLines",
@@ -16612,17 +16710,20 @@ exports.defaultCommands = [{
16612
16710
  }, {
16613
16711
  name: "alignCursors",
16614
16712
  exec: function(editor) { editor.alignCursors(); },
16615
- bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
16713
+ bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"},
16714
+ scrollIntoView: "cursor"
16616
16715
  }, {
16617
16716
  name: "findAll",
16618
16717
  exec: function(editor) { editor.findAll(); },
16619
16718
  bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
16719
+ scrollIntoView: "cursor",
16620
16720
  readonly: true
16621
16721
  }];
16622
16722
  exports.multiSelectCommands = [{
16623
16723
  name: "singleSelection",
16624
16724
  bindKey: "esc",
16625
16725
  exec: function(editor) { editor.exitMultiSelectMode(); },
16726
+ scrollIntoView: "cursor",
16626
16727
  readonly: true,
16627
16728
  isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
16628
16729
  }];
@@ -17063,35 +17164,11 @@ var Editor = require("./editor").Editor;
17063
17164
  var pos = anchor == this.multiSelect.anchor
17064
17165
  ? range.cursor == range.start ? range.end : range.start
17065
17166
  : range.cursor;
17066
- if (!isSamePoint(pos, anchor))
17167
+ if (pos.row != anchor.row
17168
+ || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
17067
17169
  this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
17068
17170
  }
17069
17171
  };
17070
- this.onPaste = function(text) {
17071
- if (this.$readOnly)
17072
- return;
17073
-
17074
-
17075
- var e = {text: text};
17076
- this._signal("paste", e);
17077
- text = e.text;
17078
- if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
17079
- return this.insert(text);
17080
-
17081
- var lines = text.split(/\r\n|\r|\n/);
17082
- var ranges = this.selection.rangeList.ranges;
17083
-
17084
- if (lines.length > ranges.length || lines.length < 2 || !lines[1])
17085
- return this.commands.exec("insertstring", this, text);
17086
-
17087
- for (var i = ranges.length; i--;) {
17088
- var range = ranges[i];
17089
- if (!range.isEmpty())
17090
- this.session.remove(range);
17091
-
17092
- this.session.insert(range.start, lines[i]);
17093
- }
17094
- };
17095
17172
  this.findAll = function(needle, options, additive) {
17096
17173
  options = options || {};
17097
17174
  options.needle = needle || options.needle;
@@ -17970,7 +18047,7 @@ function findAnnotations(session, row, dir) {
17970
18047
  if (i < 0)
17971
18048
  i = -i - 1;
17972
18049
 
17973
- if (i >= annotations.length - 1)
18050
+ if (i >= annotations.length)
17974
18051
  i = dir > 0 ? 0 : annotations.length - 1;
17975
18052
  else if (i === 0 && dir < 0)
17976
18053
  i = annotations.length - 1;