ace-rails-ap 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +210 -161
  4. data/vendor/assets/javascripts/ace/ext-beautify.js +0 -1
  5. data/vendor/assets/javascripts/ace/ext-chromevox.js +0 -1
  6. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +0 -1
  7. data/vendor/assets/javascripts/ace/ext-emmet.js +66 -48
  8. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +9 -19
  9. data/vendor/assets/javascripts/ace/ext-language_tools.js +108 -10
  10. data/vendor/assets/javascripts/ace/ext-linking.js +0 -1
  11. data/vendor/assets/javascripts/ace/ext-modelist.js +4 -1
  12. data/vendor/assets/javascripts/ace/ext-old_ie.js +23 -2
  13. data/vendor/assets/javascripts/ace/ext-searchbox.js +23 -2
  14. data/vendor/assets/javascripts/ace/ext-settings_menu.js +10 -1
  15. data/vendor/assets/javascripts/ace/ext-spellcheck.js +0 -1
  16. data/vendor/assets/javascripts/ace/ext-split.js +0 -1
  17. data/vendor/assets/javascripts/ace/ext-static_highlight.js +0 -1
  18. data/vendor/assets/javascripts/ace/ext-statusbar.js +2 -4
  19. data/vendor/assets/javascripts/ace/ext-textarea.js +0 -1
  20. data/vendor/assets/javascripts/ace/ext-themelist.js +0 -1
  21. data/vendor/assets/javascripts/ace/ext-whitespace.js +0 -1
  22. data/vendor/assets/javascripts/ace/keybinding-emacs.js +159 -50
  23. data/vendor/assets/javascripts/ace/mode-autohotkey.js +1 -1
  24. data/vendor/assets/javascripts/ace/mode-c_cpp.js +32 -14
  25. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -1
  26. data/vendor/assets/javascripts/ace/mode-coldfusion.js +62 -24
  27. data/vendor/assets/javascripts/ace/mode-csharp.js +14 -8
  28. data/vendor/assets/javascripts/ace/mode-css.js +2 -2
  29. data/vendor/assets/javascripts/ace/mode-curly.js +62 -24
  30. data/vendor/assets/javascripts/ace/mode-d.js +13 -7
  31. data/vendor/assets/javascripts/ace/mode-dart.js +32 -14
  32. data/vendor/assets/javascripts/ace/mode-django.js +62 -24
  33. data/vendor/assets/javascripts/ace/mode-dockerfile.js +3 -3
  34. data/vendor/assets/javascripts/ace/mode-dot.js +12 -6
  35. data/vendor/assets/javascripts/ace/mode-ejs.js +126 -27
  36. data/vendor/assets/javascripts/ace/mode-elixir.js +493 -0
  37. data/vendor/assets/javascripts/ace/mode-elm.js +248 -0
  38. data/vendor/assets/javascripts/ace/mode-forth.js +1 -1
  39. data/vendor/assets/javascripts/ace/mode-ftl.js +20 -10
  40. data/vendor/assets/javascripts/ace/mode-gitignore.js +1 -0
  41. data/vendor/assets/javascripts/ace/mode-glsl.js +32 -14
  42. data/vendor/assets/javascripts/ace/mode-golang.js +14 -8
  43. data/vendor/assets/javascripts/ace/mode-groovy.js +22 -12
  44. data/vendor/assets/javascripts/ace/mode-haml.js +64 -3
  45. data/vendor/assets/javascripts/ace/mode-handlebars.js +72 -34
  46. data/vendor/assets/javascripts/ace/mode-haxe.js +14 -8
  47. data/vendor/assets/javascripts/ace/mode-html.js +62 -24
  48. data/vendor/assets/javascripts/ace/mode-html_ruby.js +126 -27
  49. data/vendor/assets/javascripts/ace/mode-jack.js +2 -2
  50. data/vendor/assets/javascripts/ace/mode-jade.js +21 -11
  51. data/vendor/assets/javascripts/ace/mode-java.js +22 -12
  52. data/vendor/assets/javascripts/ace/mode-javascript.js +22 -12
  53. data/vendor/assets/javascripts/ace/mode-json.js +2 -2
  54. data/vendor/assets/javascripts/ace/mode-jsoniq.js +47 -1835
  55. data/vendor/assets/javascripts/ace/mode-jsp.js +22 -12
  56. data/vendor/assets/javascripts/ace/mode-jsx.js +14 -8
  57. data/vendor/assets/javascripts/ace/mode-less.js +2 -2
  58. data/vendor/assets/javascripts/ace/mode-liquid.js +20 -10
  59. data/vendor/assets/javascripts/ace/mode-logiql.js +2 -2
  60. data/vendor/assets/javascripts/ace/mode-lsl.js +2 -2
  61. data/vendor/assets/javascripts/ace/mode-luapage.js +62 -24
  62. data/vendor/assets/javascripts/ace/mode-markdown.js +62 -24
  63. data/vendor/assets/javascripts/ace/mode-mel.js +2 -2
  64. data/vendor/assets/javascripts/ace/mode-mysql.js +12 -6
  65. data/vendor/assets/javascripts/ace/mode-nix.js +32 -14
  66. data/vendor/assets/javascripts/ace/mode-objectivec.js +30 -12
  67. data/vendor/assets/javascripts/ace/mode-pgsql.js +20 -10
  68. data/vendor/assets/javascripts/ace/mode-php.js +1126 -40
  69. data/vendor/assets/javascripts/ace/mode-powershell.js +2 -2
  70. data/vendor/assets/javascripts/ace/mode-protobuf.js +32 -14
  71. data/vendor/assets/javascripts/ace/mode-rhtml.js +62 -24
  72. data/vendor/assets/javascripts/ace/mode-ruby.js +66 -5
  73. data/vendor/assets/javascripts/ace/mode-rust.js +36 -3
  74. data/vendor/assets/javascripts/ace/mode-scad.js +14 -8
  75. data/vendor/assets/javascripts/ace/mode-scala.js +22 -12
  76. data/vendor/assets/javascripts/ace/mode-scss.js +2 -2
  77. data/vendor/assets/javascripts/ace/mode-sh.js +2 -2
  78. data/vendor/assets/javascripts/ace/mode-sjs.js +22 -12
  79. data/vendor/assets/javascripts/ace/mode-smarty.js +62 -24
  80. data/vendor/assets/javascripts/ace/mode-soy_template.js +63 -25
  81. data/vendor/assets/javascripts/ace/mode-stylus.js +4 -1
  82. data/vendor/assets/javascripts/ace/mode-svg.js +62 -24
  83. data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
  84. data/vendor/assets/javascripts/ace/mode-twig.js +62 -24
  85. data/vendor/assets/javascripts/ace/mode-typescript.js +22 -12
  86. data/vendor/assets/javascripts/ace/mode-vala.js +2 -2
  87. data/vendor/assets/javascripts/ace/mode-velocity.js +62 -24
  88. data/vendor/assets/javascripts/ace/mode-xml.js +40 -12
  89. data/vendor/assets/javascripts/ace/mode-xquery.js +47 -1835
  90. data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -1
  91. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -1
  92. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +2 -2
  93. data/vendor/assets/javascripts/ace/worker-coffee.js +15 -5
  94. data/vendor/assets/javascripts/ace/worker-css.js +15 -5
  95. data/vendor/assets/javascripts/ace/worker-html.js +15 -5
  96. data/vendor/assets/javascripts/ace/worker-javascript.js +15 -5
  97. data/vendor/assets/javascripts/ace/worker-json.js +17 -6
  98. data/vendor/assets/javascripts/ace/worker-lua.js +15 -5
  99. data/vendor/assets/javascripts/ace/worker-php.js +15 -5
  100. data/vendor/assets/javascripts/ace/worker-xquery.js +15 -5
  101. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d2fb63a06d2158d849eabd3ed4dd99c9a48d5b7
4
- data.tar.gz: 48549a36168f07d6cb458a882951cab1e21b6476
3
+ metadata.gz: 2cc5d57286310940b01bf444c90157de22458f80
4
+ data.tar.gz: 35372099cf669dbf6639d6f5a69b45f9a30c4274
5
5
  SHA512:
6
- metadata.gz: 8d41081d8ad6bba7bf9b6b9482aae5ede28fe95b517884989b843c6ebfd4fd9eddedc98161f7ab74ba8876e67ef147821f9ef67821bb47960e3035304a1664b5
7
- data.tar.gz: 25c6f9ae787c70adc7edb7b72f7982af2ab823465665fc042fe973deb64cf40199dfc729171ac3ebdeb5727cf7ea0455fbeaf5605ec358c0a93f2b2bb7675497
6
+ metadata.gz: 4b12bead68c4eb9d30d6bac6c7b17ef2a7aa481ee759e4ec090fd382f5321c919cb8f18711f60e9672be7831b5353eafafb2459d2a06367fd1e16a4e1e32b4fe
7
+ data.tar.gz: 05c2bc884dd715f97fbd697d0c65db8db7aeab519da54b0eadb674f5ebff823f0437297be1a30b86c04134be9439f97f705e52109d0611deac546578c9036be7
@@ -1,5 +1,5 @@
1
1
  module Ace
2
2
  module Rails
3
- VERSION = "3.0.1"
3
+ VERSION = "3.0.2"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Copyright (c) 2010, Ajax.org B.V.
5
5
  * All rights reserved.
6
- *
6
+ *
7
7
  * Redistribution and use in source and binary forms, with or without
8
8
  * modification, are permitted provided that the following conditions are met:
9
9
  * * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
14
14
  * * Neither the name of Ajax.org B.V. nor the
15
15
  * names of its contributors may be used to endorse or promote products
16
16
  * derived from this software without specific prior written permission.
17
- *
17
+ *
18
18
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
19
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
20
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -65,7 +65,7 @@ var _define = function(module, deps, payload) {
65
65
  _define.modules = {};
66
66
  _define.payloads = {};
67
67
  }
68
-
68
+
69
69
  _define.payloads[module] = payload;
70
70
  _define.modules[module] = null;
71
71
  };
@@ -160,7 +160,7 @@ var lookup = function(parentId, moduleName) {
160
160
  function exportAce(ns) {
161
161
  var require = function(module, callback) {
162
162
  return _require("", module, callback);
163
- };
163
+ };
164
164
 
165
165
  var root = global;
166
166
  if (ns) {
@@ -1324,6 +1324,9 @@ var Keys = (function() {
1324
1324
  }
1325
1325
  })();
1326
1326
 
1327
+ ret.KEY_MODS[0] = "";
1328
+ ret.KEY_MODS[-1] = "input";
1329
+
1327
1330
  return ret;
1328
1331
  })();
1329
1332
  oop.mixin(exports, Keys);
@@ -1831,7 +1834,6 @@ exports.getMatchOffsets = function(string, regExp) {
1831
1834
  return matches;
1832
1835
  };
1833
1836
  exports.deferredCall = function(fcn) {
1834
-
1835
1837
  var timer = null;
1836
1838
  var callback = function() {
1837
1839
  timer = null;
@@ -1937,13 +1939,13 @@ var TextInput = function(parentNode, host) {
1937
1939
  var isSelectionEmpty = true;
1938
1940
  try { var isFocused = document.activeElement === text; } catch(e) {}
1939
1941
 
1940
- event.addListener(text, "blur", function() {
1941
- host.onBlur();
1942
+ event.addListener(text, "blur", function(e) {
1943
+ host.onBlur(e);
1942
1944
  isFocused = false;
1943
1945
  });
1944
- event.addListener(text, "focus", function() {
1946
+ event.addListener(text, "focus", function(e) {
1945
1947
  isFocused = true;
1946
- host.onFocus();
1948
+ host.onFocus(e);
1947
1949
  resetSelection();
1948
1950
  });
1949
1951
  this.focus = function() { text.focus(); };
@@ -3966,8 +3968,16 @@ var KeyBinding = function(editor) {
3966
3968
  this.getKeyboardHandler = function() {
3967
3969
  return this.$handlers[this.$handlers.length - 1];
3968
3970
  };
3971
+
3972
+ this.getStatusText = function() {
3973
+ var data = this.$data;
3974
+ var editor = data.editor;
3975
+ return this.$handlers.map(function(h) {
3976
+ return h.getStatusText && h.getStatusText(editor, data) || "";
3977
+ }).filter(Boolean).join(" ");
3978
+ };
3969
3979
 
3970
- this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
3980
+ this.$callKeyboardHandlers = function(hashId, keyString, keyCode, e) {
3971
3981
  var toExecute;
3972
3982
  var success = false;
3973
3983
  var commands = this.$editor.commands;
@@ -4859,7 +4869,7 @@ exports.Selection = Selection;
4859
4869
 
4860
4870
  define("ace/tokenizer",["require","exports","module"], function(require, exports, module) {
4861
4871
  "use strict";
4862
- var MAX_TOKEN_COUNT = 1000;
4872
+ var MAX_TOKEN_COUNT = 2000;
4863
4873
  var Tokenizer = function(rules) {
4864
4874
  this.states = rules;
4865
4875
 
@@ -4890,9 +4900,11 @@ var Tokenizer = function(rules) {
4890
4900
  if (rule.token.length == 1 || matchcount == 1) {
4891
4901
  rule.token = rule.token[0];
4892
4902
  } else if (matchcount - 1 != rule.token.length) {
4893
- throw new Error("number of classes and regexp groups in '" +
4894
- rule.token + "'\n'" + rule.regex + "' doesn't match\n"
4895
- + (matchcount - 1) + "!=" + rule.token.length);
4903
+ this.reportError("number of classes and regexp groups doesn't match", {
4904
+ rule: rule,
4905
+ groupCount: matchcount - 1
4906
+ });
4907
+ rule.token = rule.token[0];
4896
4908
  } else {
4897
4909
  rule.tokenArray = rule.token;
4898
4910
  rule.token = null;
@@ -5043,6 +5055,7 @@ var Tokenizer = function(rules) {
5043
5055
 
5044
5056
  var match, tokens = [];
5045
5057
  var lastIndex = 0;
5058
+ var matchAttempts = 0;
5046
5059
 
5047
5060
  var token = {type: null, value: ""};
5048
5061
 
@@ -5083,7 +5096,7 @@ var Tokenizer = function(rules) {
5083
5096
 
5084
5097
  state = this.states[currentState];
5085
5098
  if (!state) {
5086
- window.console && console.error && console.error(currentState, "doesn't exist");
5099
+ this.reportError("state doesn't exist", currentState);
5087
5100
  currentState = "start";
5088
5101
  state = this.states[currentState];
5089
5102
  }
@@ -5096,7 +5109,7 @@ var Tokenizer = function(rules) {
5096
5109
  }
5097
5110
 
5098
5111
  if (value) {
5099
- if (typeof type == "string") {
5112
+ if (typeof type === "string") {
5100
5113
  if ((!rule || rule.merge !== false) && token.type === type) {
5101
5114
  token.value += value;
5102
5115
  } else {
@@ -5118,7 +5131,13 @@ var Tokenizer = function(rules) {
5118
5131
 
5119
5132
  lastIndex = index;
5120
5133
 
5121
- if (tokens.length > MAX_TOKEN_COUNT) {
5134
+ if (matchAttempts++ > MAX_TOKEN_COUNT) {
5135
+ if (matchAttempts > 2 * line.length) {
5136
+ this.reportError("infinite loop with in ace tokenizer", {
5137
+ startState: startState,
5138
+ line: line
5139
+ });
5140
+ }
5122
5141
  while (lastIndex < line.length) {
5123
5142
  if (token.type)
5124
5143
  tokens.push(token);
@@ -5145,7 +5164,14 @@ var Tokenizer = function(rules) {
5145
5164
  state : stack.length ? stack : currentState
5146
5165
  };
5147
5166
  };
5148
-
5167
+
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
+ };
5149
5175
  }).call(Tokenizer.prototype);
5150
5176
 
5151
5177
  exports.Tokenizer = Tokenizer;
@@ -7334,12 +7360,11 @@ function Folding() {
7334
7360
  if (startFold && endFold == startFold)
7335
7361
  return startFold.addSubFold(fold);
7336
7362
 
7337
- if (
7338
- (startFold && !startFold.range.isStart(startRow, startColumn))
7339
- || (endFold && !endFold.range.isEnd(endRow, endColumn))
7340
- ) {
7341
- throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range);
7342
- }
7363
+ if (startFold && !startFold.range.isStart(startRow, startColumn))
7364
+ this.removeFold(startFold);
7365
+
7366
+ if (endFold && !endFold.range.isEnd(endRow, endColumn))
7367
+ this.removeFold(endFold);
7343
7368
  var folds = this.getFoldsInRange(fold.range);
7344
7369
  if (folds.length > 0) {
7345
7370
  this.removeFolds(folds);
@@ -8992,7 +9017,7 @@ var EditSession = function(text, mode) {
8992
9017
  }
8993
9018
  };
8994
9019
  this.adjustWrapLimit = function(desiredLimit, $printMargin) {
8995
- var limits = this.$wrapLimitRange
9020
+ var limits = this.$wrapLimitRange;
8996
9021
  if (limits.max < 0)
8997
9022
  limits = {min: $printMargin, max: $printMargin};
8998
9023
  var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
@@ -9092,7 +9117,7 @@ var EditSession = function(text, mode) {
9092
9117
  var foldLine = this.getFoldLine(firstRow);
9093
9118
  var idx = 0;
9094
9119
  if (foldLine) {
9095
- var cmp = foldLine.range.compareInside(start.row, start.column)
9120
+ var cmp = foldLine.range.compareInside(start.row, start.column);
9096
9121
  if (cmp == 0) {
9097
9122
  foldLine = foldLine.split(start.row, start.column);
9098
9123
  if (foldLine) {
@@ -9438,7 +9463,7 @@ var EditSession = function(text, mode) {
9438
9463
  return {
9439
9464
  row: maxRow,
9440
9465
  column: this.getLine(maxRow).length
9441
- }
9466
+ };
9442
9467
  } else {
9443
9468
  line = this.getLine(docRow);
9444
9469
  foldLine = null;
@@ -9941,7 +9966,7 @@ var Search = function() {
9941
9966
  if (options.wholeWord)
9942
9967
  needle = "\\b" + needle + "\\b";
9943
9968
 
9944
- var modifier = options.caseSensitive ? "g" : "gi";
9969
+ var modifier = options.caseSensitive ? "gm" : "gmi";
9945
9970
 
9946
9971
  options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
9947
9972
  if (options.$isMultiLine)
@@ -10036,35 +10061,25 @@ define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys",
10036
10061
 
10037
10062
  var keyUtil = require("../lib/keys");
10038
10063
  var useragent = require("../lib/useragent");
10064
+ var KEY_MODS = keyUtil.KEY_MODS;
10039
10065
 
10040
10066
  function HashHandler(config, platform) {
10041
10067
  this.platform = platform || (useragent.isMac ? "mac" : "win");
10042
10068
  this.commands = {};
10043
10069
  this.commandKeyBinding = {};
10044
- if (this.__defineGetter__ && this.__defineSetter__ && typeof console != "undefined" && console.error) {
10045
- var warned = false;
10046
- var warn = function() {
10047
- if (!warned) {
10048
- warned = true;
10049
- console.error("commmandKeyBinding has too many m's. use commandKeyBinding");
10050
- }
10051
- };
10052
- this.__defineGetter__("commmandKeyBinding", function() {
10053
- warn();
10054
- return this.commandKeyBinding;
10055
- });
10056
- this.__defineSetter__("commmandKeyBinding", function(val) {
10057
- warn();
10058
- return this.commandKeyBinding = val;
10059
- });
10060
- } else {
10061
- this.commmandKeyBinding = this.commandKeyBinding;
10062
- }
10063
-
10064
10070
  this.addCommands(config);
10065
- };
10071
+ this.$singleCommand = true;
10072
+ }
10073
+
10074
+ function MultiHashHandler(config, platform) {
10075
+ HashHandler.call(this, config, platform);
10076
+ this.$singleCommand = false;
10077
+ }
10078
+
10079
+ MultiHashHandler.prototype = HashHandler.prototype;
10066
10080
 
10067
10081
  (function() {
10082
+
10068
10083
 
10069
10084
  this.addCommand = function(command) {
10070
10085
  if (this.commands[command.name])
@@ -10076,34 +10091,73 @@ function HashHandler(config, platform) {
10076
10091
  this._buildKeyHash(command);
10077
10092
  };
10078
10093
 
10079
- this.removeCommand = function(command) {
10080
- var name = (typeof command === 'string' ? command : command.name);
10094
+ this.removeCommand = function(command, keepCommand) {
10095
+ var name = command && (typeof command === 'string' ? command : command.name);
10081
10096
  command = this.commands[name];
10082
- delete this.commands[name];
10097
+ if (!keepCommand)
10098
+ delete this.commands[name];
10083
10099
  var ckb = this.commandKeyBinding;
10084
- for (var hashId in ckb) {
10085
- for (var key in ckb[hashId]) {
10086
- if (ckb[hashId][key] == command)
10087
- delete ckb[hashId][key];
10100
+ for (var keyId in ckb) {
10101
+ var cmdGroup = ckb[keyId];
10102
+ if (cmdGroup == command) {
10103
+ delete ckb[keyId];
10104
+ } else if (Array.isArray(cmdGroup)) {
10105
+ var i = cmdGroup.indexOf(command);
10106
+ if (i != -1) {
10107
+ cmdGroup.splice(i, 1);
10108
+ if (cmdGroup.length == 1)
10109
+ ckb[keyId] = cmdGroup[0];
10110
+ }
10088
10111
  }
10089
10112
  }
10090
10113
  };
10091
10114
 
10092
- this.bindKey = function(key, command) {
10093
- if(!key)
10115
+ this.bindKey = function(key, command, asDefault) {
10116
+ if (typeof key == "object")
10117
+ key = key[this.platform];
10118
+ if (!key)
10094
10119
  return;
10095
- if (typeof command == "function") {
10096
- this.addCommand({exec: command, bindKey: key, name: command.name || key});
10097
- return;
10098
- }
10099
-
10100
- var ckb = this.commandKeyBinding;
10120
+ if (typeof command == "function")
10121
+ return this.addCommand({exec: command, bindKey: key, name: command.name || key});
10122
+
10101
10123
  key.split("|").forEach(function(keyPart) {
10102
- var binding = this.parseKeys(keyPart, command);
10103
- var hashId = binding.hashId;
10104
- (ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
10124
+ var chain = "";
10125
+ if (keyPart.indexOf(" ") != -1) {
10126
+ var parts = keyPart.split(/\s+/);
10127
+ keyPart = parts.pop();
10128
+ parts.forEach(function(keyPart) {
10129
+ var binding = this.parseKeys(keyPart);
10130
+ var id = KEY_MODS[binding.hashId] + binding.key;
10131
+ chain += (chain ? " " : "") + id;
10132
+ this._addCommandToBinding(chain, "chainKeys");
10133
+ }, this);
10134
+ chain += " ";
10135
+ }
10136
+ var binding = this.parseKeys(keyPart);
10137
+ var id = KEY_MODS[binding.hashId] + binding.key;
10138
+ this._addCommandToBinding(chain + id, command, asDefault);
10105
10139
  }, this);
10106
10140
  };
10141
+
10142
+ this._addCommandToBinding = function(keyId, command, asDefault) {
10143
+ var ckb = this.commandKeyBinding, i;
10144
+ if (!command) {
10145
+ delete ckb[keyId];
10146
+ } else if (!ckb[keyId] || this.$singleCommand) {
10147
+ ckb[keyId] = command;
10148
+ } else {
10149
+ if (!Array.isArray(ckb[keyId])) {
10150
+ ckb[keyId] = [ckb[keyId]];
10151
+ } else if ((i = ckb[keyId].indexOf(command)) != -1) {
10152
+ ckb[keyId].splice(i, 1);
10153
+ }
10154
+
10155
+ if (asDefault || command.isDefault)
10156
+ ckb[keyId].unshift(command);
10157
+ else
10158
+ ckb[keyId].push(command);
10159
+ }
10160
+ };
10107
10161
 
10108
10162
  this.addCommands = function(commands) {
10109
10163
  commands && Object.keys(commands).forEach(function(name) {
@@ -10140,17 +10194,9 @@ function HashHandler(config, platform) {
10140
10194
  };
10141
10195
 
10142
10196
  this._buildKeyHash = function(command) {
10143
- var binding = command.bindKey;
10144
- if (!binding)
10145
- return;
10146
-
10147
- var key = typeof binding == "string" ? binding: binding[this.platform];
10148
- this.bindKey(key, command);
10197
+ this.bindKey(command.bindKey, command);
10149
10198
  };
10150
10199
  this.parseKeys = function(keys) {
10151
- if (keys.indexOf(" ") != -1)
10152
- keys = keys.split(/\s+/).pop();
10153
-
10154
10200
  var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
10155
10201
  var key = parts.pop();
10156
10202
 
@@ -10167,7 +10213,7 @@ function HashHandler(config, platform) {
10167
10213
  var modifier = keyUtil.KEY_MODS[parts[i]];
10168
10214
  if (modifier == null) {
10169
10215
  if (typeof console != "undefined")
10170
- console.error("invalid modifier " + parts[i] + " in " + keys);
10216
+ console.error("invalid modifier " + parts[i] + " in " + keys);
10171
10217
  return false;
10172
10218
  }
10173
10219
  hashId |= modifier;
@@ -10176,44 +10222,66 @@ function HashHandler(config, platform) {
10176
10222
  };
10177
10223
 
10178
10224
  this.findKeyCommand = function findKeyCommand(hashId, keyString) {
10179
- var ckbr = this.commandKeyBinding;
10180
- return ckbr[hashId] && ckbr[hashId][keyString];
10225
+ var key = KEY_MODS[hashId] + keyString;
10226
+ return this.commandKeyBinding[key];
10181
10227
  };
10182
10228
 
10183
10229
  this.handleKeyboard = function(data, hashId, keyString, keyCode) {
10184
- return {
10185
- command: this.findKeyCommand(hashId, keyString)
10186
- };
10230
+ var key = KEY_MODS[hashId] + keyString;
10231
+ var command = this.commandKeyBinding[key];
10232
+ if (data.$keyChain) {
10233
+ data.$keyChain += " " + key;
10234
+ command = this.commandKeyBinding[data.$keyChain] || command;
10235
+ }
10236
+
10237
+ if (command) {
10238
+ if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
10239
+ data.$keyChain = data.$keyChain || key;
10240
+ return {command: "null"};
10241
+ }
10242
+ }
10243
+
10244
+ if (data.$keyChain && keyCode > 0)
10245
+ data.$keyChain = "";
10246
+ return {command: command};
10187
10247
  };
10188
10248
 
10189
- }).call(HashHandler.prototype)
10249
+ }).call(HashHandler.prototype);
10190
10250
 
10191
10251
  exports.HashHandler = HashHandler;
10252
+ exports.MultiHashHandler = MultiHashHandler;
10192
10253
  });
10193
10254
 
10194
10255
  define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"], function(require, exports, module) {
10195
10256
  "use strict";
10196
10257
 
10197
10258
  var oop = require("../lib/oop");
10198
- var HashHandler = require("../keyboard/hash_handler").HashHandler;
10259
+ var MultiHashHandler = require("../keyboard/hash_handler").MultiHashHandler;
10199
10260
  var EventEmitter = require("../lib/event_emitter").EventEmitter;
10200
10261
 
10201
10262
  var CommandManager = function(platform, commands) {
10202
- HashHandler.call(this, commands, platform);
10263
+ MultiHashHandler.call(this, commands, platform);
10203
10264
  this.byName = this.commands;
10204
10265
  this.setDefaultHandler("exec", function(e) {
10205
10266
  return e.command.exec(e.editor, e.args || {});
10206
10267
  });
10207
10268
  };
10208
10269
 
10209
- oop.inherits(CommandManager, HashHandler);
10270
+ oop.inherits(CommandManager, MultiHashHandler);
10210
10271
 
10211
10272
  (function() {
10212
10273
 
10213
10274
  oop.implement(this, EventEmitter);
10214
10275
 
10215
10276
  this.exec = function(command, editor, args) {
10216
- if (typeof command === 'string')
10277
+ if (Array.isArray(command)) {
10278
+ for (var i = command.length; i--; ) {
10279
+ if (this.exec(command[i], editor, args)) return true;
10280
+ }
10281
+ return false;
10282
+ }
10283
+
10284
+ if (typeof command === "string")
10217
10285
  command = this.commands[command];
10218
10286
 
10219
10287
  if (!command)
@@ -10223,10 +10291,10 @@ oop.inherits(CommandManager, HashHandler);
10223
10291
  return false;
10224
10292
 
10225
10293
  var e = {editor: editor, command: command, args: args};
10226
- var retvalue = this._emit("exec", e);
10294
+ e.returnValue = this._emit("exec", e);
10227
10295
  this._signal("afterExec", e);
10228
10296
 
10229
- return retvalue === false ? false : true;
10297
+ return e.returnValue === false ? false : true;
10230
10298
  };
10231
10299
 
10232
10300
  this.toggleRecording = function(editor) {
@@ -11022,30 +11090,8 @@ var Editor = function(renderer, session) {
11022
11090
  function last(a) {return a[a.length - 1]}
11023
11091
 
11024
11092
  this.selections = [];
11025
- this.commands.on("exec", function(e) {
11026
- this.startOperation(e);
11027
-
11028
- var command = e.command;
11029
- if (command.aceCommandGroup == "fileJump") {
11030
- var prev = this.prevOp;
11031
- if (!prev || prev.command.aceCommandGroup != "fileJump") {
11032
- this.lastFileJumpPos = last(this.selections);
11033
- }
11034
- } else {
11035
- this.lastFileJumpPos = null;
11036
- }
11037
- }.bind(this), true);
11038
-
11039
- this.commands.on("afterExec", function(e) {
11040
- var command = e.command;
11041
-
11042
- if (command.aceCommandGroup == "fileJump") {
11043
- if (this.lastFileJumpPos && !this.curOp.selectionChanged) {
11044
- this.selection.fromJSON(this.lastFileJumpPos);
11045
- }
11046
- }
11047
- this.endOperation(e);
11048
- }.bind(this), true);
11093
+ this.commands.on("exec", this.startOperation.bind(this), true);
11094
+ this.commands.on("afterExec", this.endOperation.bind(this), true);
11049
11095
 
11050
11096
  this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
11051
11097
 
@@ -11079,19 +11125,15 @@ var Editor = function(renderer, session) {
11079
11125
  args: commadEvent.args,
11080
11126
  scrollTop: this.renderer.scrollTop
11081
11127
  };
11082
-
11083
- var command = this.curOp.command;
11084
- if (command && command.scrollIntoView)
11085
- this.$blockScrolling++;
11086
-
11087
- this.selections.push(this.selection.toJSON());
11088
11128
  };
11089
11129
 
11090
- this.endOperation = function() {
11130
+ this.endOperation = function(e) {
11091
11131
  if (this.curOp) {
11132
+ if (e && e.returnValue === false)
11133
+ return this.curOp = null;
11134
+
11092
11135
  var command = this.curOp.command;
11093
11136
  if (command && command.scrollIntoView) {
11094
- this.$blockScrolling--;
11095
11137
  switch (command.scrollIntoView) {
11096
11138
  case "center":
11097
11139
  this.renderer.scrollCursorIntoView(null, 0.5);
@@ -11153,19 +11195,19 @@ var Editor = function(renderer, session) {
11153
11195
  else if (mergeableCommands.indexOf(e.command.name) !== -1)
11154
11196
  this.sequenceStartTime = Date.now();
11155
11197
  };
11156
- this.setKeyboardHandler = function(keyboardHandler) {
11157
- if (!keyboardHandler) {
11158
- this.keyBinding.setKeyboardHandler(null);
11159
- } else if (typeof keyboardHandler === "string") {
11198
+ this.setKeyboardHandler = function(keyboardHandler, cb) {
11199
+ if (keyboardHandler && typeof keyboardHandler === "string") {
11160
11200
  this.$keybindingId = keyboardHandler;
11161
11201
  var _self = this;
11162
11202
  config.loadModule(["keybinding", keyboardHandler], function(module) {
11163
11203
  if (_self.$keybindingId == keyboardHandler)
11164
11204
  _self.keyBinding.setKeyboardHandler(module && module.handler);
11205
+ cb && cb();
11165
11206
  });
11166
11207
  } else {
11167
11208
  this.$keybindingId = null;
11168
11209
  this.keyBinding.setKeyboardHandler(keyboardHandler);
11210
+ cb && cb();
11169
11211
  }
11170
11212
  };
11171
11213
  this.getKeyboardHandler = function() {
@@ -11431,21 +11473,21 @@ var Editor = function(renderer, session) {
11431
11473
  this.blur = function() {
11432
11474
  this.textInput.blur();
11433
11475
  };
11434
- this.onFocus = function() {
11476
+ this.onFocus = function(e) {
11435
11477
  if (this.$isFocused)
11436
11478
  return;
11437
11479
  this.$isFocused = true;
11438
11480
  this.renderer.showCursor();
11439
11481
  this.renderer.visualizeFocus();
11440
- this._emit("focus");
11482
+ this._emit("focus", e);
11441
11483
  };
11442
- this.onBlur = function() {
11484
+ this.onBlur = function(e) {
11443
11485
  if (!this.$isFocused)
11444
11486
  return;
11445
11487
  this.$isFocused = false;
11446
11488
  this.renderer.hideCursor();
11447
11489
  this.renderer.visualizeBlur();
11448
- this._emit("blur");
11490
+ this._emit("blur", e);
11449
11491
  };
11450
11492
 
11451
11493
  this.$cursorChange = function() {
@@ -11631,9 +11673,8 @@ var Editor = function(renderer, session) {
11631
11673
  this.insert(e.text, true);
11632
11674
  };
11633
11675
 
11634
-
11635
11676
  this.execCommand = function(command, args) {
11636
- this.commands.exec(command, this, args);
11677
+ return this.commands.exec(command, this, args);
11637
11678
  };
11638
11679
  this.insert = function(text, pasted) {
11639
11680
  var session = this.session;
@@ -12663,7 +12704,9 @@ var Editor = function(renderer, session) {
12663
12704
  rect = self.renderer.container.getBoundingClientRect();
12664
12705
  });
12665
12706
  var onAfterRender = this.renderer.on("afterRender", function() {
12666
- if (shouldScroll && rect && self.isFocused()) {
12707
+ if (shouldScroll && rect && (self.isFocused()
12708
+ || self.searchBox && self.searchBox.isFocused())
12709
+ ) {
12667
12710
  var renderer = self.renderer;
12668
12711
  var pos = renderer.$cursorLayer.$pixelPos;
12669
12712
  var config = renderer.layerConfig;
@@ -15377,23 +15420,24 @@ var VirtualRenderer = function(container, theme) {
15377
15420
  this.scrollBarH.setVisible(horizScroll);
15378
15421
  }
15379
15422
 
15380
- if (!this.$maxLines && this.$scrollPastEnd) {
15381
- maxHeight += (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
15382
- }
15423
+ var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd
15424
+ ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
15425
+ : 0;
15426
+ maxHeight += scrollPastEnd;
15427
+
15428
+ this.session.setScrollTop(Math.max(-this.scrollMargin.top,
15429
+ Math.min(this.scrollTop, maxHeight - size.scrollerHeight + this.scrollMargin.bottom)));
15430
+
15431
+ this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft,
15432
+ longestLine + 2 * this.$padding - size.scrollerWidth + this.scrollMargin.right)));
15383
15433
 
15384
15434
  var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
15385
- size.scrollerHeight - maxHeight < 0);
15435
+ size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop);
15386
15436
  var vScrollChanged = this.$vScroll !== vScroll;
15387
15437
  if (vScrollChanged) {
15388
15438
  this.$vScroll = vScroll;
15389
15439
  this.scrollBarV.setVisible(vScroll);
15390
15440
  }
15391
-
15392
- this.session.setScrollTop(Math.max(-this.scrollMargin.top,
15393
- Math.min(this.scrollTop, maxHeight - size.scrollerHeight + this.scrollMargin.bottom)));
15394
-
15395
- this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft,
15396
- longestLine + 2 * this.$padding - size.scrollerWidth + this.scrollMargin.right)));
15397
15441
 
15398
15442
  var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
15399
15443
  var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
@@ -16005,14 +16049,9 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
16005
16049
  this.onMessage = function(e) {
16006
16050
  var msg = e.data;
16007
16051
  switch(msg.type) {
16008
- case "log":
16009
- window.console && console.log && console.log.apply(console, msg.data);
16010
- break;
16011
-
16012
16052
  case "event":
16013
16053
  this._signal(msg.name, {data: msg.data});
16014
16054
  break;
16015
-
16016
16055
  case "call":
16017
16056
  var callback = this.callbacks[msg.id];
16018
16057
  if (callback) {
@@ -16020,8 +16059,18 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
16020
16059
  delete this.callbacks[msg.id];
16021
16060
  }
16022
16061
  break;
16062
+ case "error":
16063
+ this.reportError(msg.data);
16064
+ break;
16065
+ case "log":
16066
+ window.console && console.log && console.log.apply(console, msg.data);
16067
+ break;
16023
16068
  }
16024
16069
  };
16070
+
16071
+ this.reportError = function(err) {
16072
+ window.console && console.error && console.error(err);
16073
+ };
16025
16074
 
16026
16075
  this.$normalizePath = function(path) {
16027
16076
  return net.qualifyURL(path);
@@ -16032,7 +16081,8 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
16032
16081
  this.deltaQueue = null;
16033
16082
  this.$worker.terminate();
16034
16083
  this.$worker = null;
16035
- this.$doc.removeEventListener("change", this.changeListener);
16084
+ if (this.$doc)
16085
+ this.$doc.off("change", this.changeListener);
16036
16086
  this.$doc = null;
16037
16087
  };
16038
16088
 
@@ -17642,9 +17692,10 @@ function LineWidgets(session) {
17642
17692
  this.renderWidgets = this.renderWidgets.bind(this);
17643
17693
  this.measureWidgets = this.measureWidgets.bind(this);
17644
17694
  this.session._changedWidgets = [];
17645
- this.detach = this.detach.bind(this);
17695
+ this.$onChangeEditor = this.$onChangeEditor.bind(this);
17646
17696
 
17647
17697
  this.session.on("change", this.updateOnChange);
17698
+ this.session.on("changeEditor", this.$onChangeEditor);
17648
17699
  }
17649
17700
 
17650
17701
  (function() {
@@ -17670,8 +17721,12 @@ function LineWidgets(session) {
17670
17721
  return screenRows;
17671
17722
  };
17672
17723
 
17724
+ this.$onChangeEditor = function(e) {
17725
+ this.attach(e.editor);
17726
+ };
17727
+
17673
17728
  this.attach = function(editor) {
17674
- if (editor.widgetManager && editor.widgetManager != this)
17729
+ if (editor && editor.widgetManager && editor.widgetManager != this)
17675
17730
  editor.widgetManager.detach();
17676
17731
 
17677
17732
  if (this.editor == editor)
@@ -17680,21 +17735,16 @@ function LineWidgets(session) {
17680
17735
  this.detach();
17681
17736
  this.editor = editor;
17682
17737
 
17683
- this.editor.on("changeSession", this.detach);
17684
-
17685
- editor.widgetManager = this;
17686
-
17687
- editor.renderer.on("beforeRender", this.measureWidgets);
17688
- editor.renderer.on("afterRender", this.renderWidgets);
17738
+ if (editor) {
17739
+ editor.widgetManager = this;
17740
+ editor.renderer.on("beforeRender", this.measureWidgets);
17741
+ editor.renderer.on("afterRender", this.renderWidgets);
17742
+ }
17689
17743
  };
17690
17744
  this.detach = function(e) {
17691
- if (e && e.session == this.session)
17692
- return; // sometimes attach can be called before setSession
17693
17745
  var editor = this.editor;
17694
17746
  if (!editor)
17695
17747
  return;
17696
-
17697
- editor.off("changeSession", this.detach);
17698
17748
 
17699
17749
  this.editor = null;
17700
17750
  editor.widgetManager = null;
@@ -18142,7 +18192,6 @@ exports.createEditSession = function(text, mode) {
18142
18192
  exports.EditSession = EditSession;
18143
18193
  exports.UndoManager = UndoManager;
18144
18194
  });
18145
- ;
18146
18195
  (function() {
18147
18196
  window.require(["ace/ace"], function(a) {
18148
18197
  a && a.config.init(true);