ace-rails-ap 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +993 -613
  4. data/vendor/assets/javascripts/ace/ext-chromevox.js +3 -4
  5. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +5 -6
  6. data/vendor/assets/javascripts/ace/ext-emmet.js +50 -21
  7. data/vendor/assets/javascripts/ace/ext-language_tools.js +21 -19
  8. data/vendor/assets/javascripts/ace/ext-modelist.js +11 -6
  9. data/vendor/assets/javascripts/ace/ext-old_ie.js +12 -5
  10. data/vendor/assets/javascripts/ace/ext-searchbox.js +12 -5
  11. data/vendor/assets/javascripts/ace/ext-settings_menu.js +14 -7
  12. data/vendor/assets/javascripts/ace/ext-static_highlight.js +5 -5
  13. data/vendor/assets/javascripts/ace/ext-statusbar.js +14 -12
  14. data/vendor/assets/javascripts/ace/ext-textarea.js +1 -2
  15. data/vendor/assets/javascripts/ace/ext-themelist.js +2 -0
  16. data/vendor/assets/javascripts/ace/ext-whitespace.js +17 -13
  17. data/vendor/assets/javascripts/ace/keybinding-emacs.js +76 -78
  18. data/vendor/assets/javascripts/ace/keybinding-vim.js +221 -80
  19. data/vendor/assets/javascripts/ace/mode-abc.js +2 -3
  20. data/vendor/assets/javascripts/ace/mode-actionscript.js +2 -3
  21. data/vendor/assets/javascripts/ace/mode-apache_conf.js +2 -3
  22. data/vendor/assets/javascripts/ace/mode-applescript.js +2 -3
  23. data/vendor/assets/javascripts/ace/mode-autohotkey.js +2 -3
  24. data/vendor/assets/javascripts/ace/mode-batchfile.js +2 -3
  25. data/vendor/assets/javascripts/ace/mode-c_cpp.js +8 -5
  26. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -1
  27. data/vendor/assets/javascripts/ace/mode-coldfusion.js +533 -139
  28. data/vendor/assets/javascripts/ace/mode-csharp.js +4 -5
  29. data/vendor/assets/javascripts/ace/mode-css.js +185 -6
  30. data/vendor/assets/javascripts/ace/mode-curly.js +495 -138
  31. data/vendor/assets/javascripts/ace/mode-d.js +2 -3
  32. data/vendor/assets/javascripts/ace/mode-dart.js +8 -5
  33. data/vendor/assets/javascripts/ace/mode-django.js +495 -138
  34. data/vendor/assets/javascripts/ace/mode-dockerfile.js +59 -14
  35. data/vendor/assets/javascripts/ace/mode-dot.js +2 -3
  36. data/vendor/assets/javascripts/ace/mode-ejs.js +497 -152
  37. data/vendor/assets/javascripts/ace/mode-elm.js +6 -4
  38. data/vendor/assets/javascripts/ace/mode-erlang.js +3 -4
  39. data/vendor/assets/javascripts/ace/mode-forth.js +3 -4
  40. data/vendor/assets/javascripts/ace/mode-ftl.js +145 -17
  41. data/vendor/assets/javascripts/ace/mode-gherkin.js +58 -25
  42. data/vendor/assets/javascripts/ace/mode-glsl.js +8 -5
  43. data/vendor/assets/javascripts/ace/mode-golang.js +36 -25
  44. data/vendor/assets/javascripts/ace/mode-groovy.js +145 -17
  45. data/vendor/assets/javascripts/ace/mode-handlebars.js +496 -140
  46. data/vendor/assets/javascripts/ace/mode-haskell.js +3 -4
  47. data/vendor/assets/javascripts/ace/mode-haxe.js +4 -5
  48. data/vendor/assets/javascripts/ace/mode-html.js +495 -138
  49. data/vendor/assets/javascripts/ace/mode-html_elixir.js +3372 -0
  50. data/vendor/assets/javascripts/ace/mode-html_ruby.js +495 -138
  51. data/vendor/assets/javascripts/ace/mode-ini.js +1 -1
  52. data/vendor/assets/javascripts/ace/mode-io.js +2 -3
  53. data/vendor/assets/javascripts/ace/mode-jack.js +4 -5
  54. data/vendor/assets/javascripts/ace/mode-jade.js +155 -25
  55. data/vendor/assets/javascripts/ace/mode-java.js +145 -17
  56. data/vendor/assets/javascripts/ace/mode-javascript.js +145 -17
  57. data/vendor/assets/javascripts/ace/mode-json.js +4 -5
  58. data/vendor/assets/javascripts/ace/mode-jsoniq.js +4 -5
  59. data/vendor/assets/javascripts/ace/mode-jsp.js +150 -23
  60. data/vendor/assets/javascripts/ace/mode-jsx.js +4 -5
  61. data/vendor/assets/javascripts/ace/mode-julia.js +2 -3
  62. data/vendor/assets/javascripts/ace/mode-less.js +5 -6
  63. data/vendor/assets/javascripts/ace/mode-liquid.js +145 -17
  64. data/vendor/assets/javascripts/ace/mode-logiql.js +2 -2
  65. data/vendor/assets/javascripts/ace/mode-lsl.js +8 -10
  66. data/vendor/assets/javascripts/ace/mode-lua.js +2 -2
  67. data/vendor/assets/javascripts/ace/mode-luapage.js +497 -140
  68. data/vendor/assets/javascripts/ace/mode-makefile.js +54 -8
  69. data/vendor/assets/javascripts/ace/mode-markdown.js +497 -139
  70. data/vendor/assets/javascripts/ace/mode-mask.js +150 -22
  71. data/vendor/assets/javascripts/ace/mode-maze.js +283 -0
  72. data/vendor/assets/javascripts/ace/mode-mel.js +4 -5
  73. data/vendor/assets/javascripts/ace/mode-mushcode.js +0 -1
  74. data/vendor/assets/javascripts/ace/mode-mysql.js +1 -1
  75. data/vendor/assets/javascripts/ace/mode-nix.js +8 -5
  76. data/vendor/assets/javascripts/ace/mode-objectivec.js +6 -3
  77. data/vendor/assets/javascripts/ace/mode-perl.js +4 -5
  78. data/vendor/assets/javascripts/ace/mode-pgsql.js +141 -12
  79. data/vendor/assets/javascripts/ace/mode-php.js +9872 -143
  80. data/vendor/assets/javascripts/ace/mode-powershell.js +4 -5
  81. data/vendor/assets/javascripts/ace/mode-praat.js +18 -14
  82. data/vendor/assets/javascripts/ace/mode-prolog.js +2 -3
  83. data/vendor/assets/javascripts/ace/mode-protobuf.js +8 -5
  84. data/vendor/assets/javascripts/ace/mode-rhtml.js +495 -138
  85. data/vendor/assets/javascripts/ace/mode-ruby.js +2 -2
  86. data/vendor/assets/javascripts/ace/mode-rust.js +32 -39
  87. data/vendor/assets/javascripts/ace/mode-scad.js +4 -5
  88. data/vendor/assets/javascripts/ace/mode-scala.js +158 -21
  89. data/vendor/assets/javascripts/ace/mode-scheme.js +118 -1
  90. data/vendor/assets/javascripts/ace/mode-scss.js +4 -5
  91. data/vendor/assets/javascripts/ace/mode-sh.js +58 -13
  92. data/vendor/assets/javascripts/ace/mode-sjs.js +145 -17
  93. data/vendor/assets/javascripts/ace/mode-smarty.js +495 -138
  94. data/vendor/assets/javascripts/ace/mode-soy_template.js +496 -140
  95. data/vendor/assets/javascripts/ace/mode-sql.js +12 -4
  96. data/vendor/assets/javascripts/ace/mode-sqlserver.js +437 -0
  97. data/vendor/assets/javascripts/ace/mode-svg.js +147 -20
  98. data/vendor/assets/javascripts/ace/mode-swift.js +738 -0
  99. data/vendor/assets/javascripts/ace/mode-swig.js +1099 -0
  100. data/vendor/assets/javascripts/ace/mode-tcl.js +2 -3
  101. data/vendor/assets/javascripts/ace/mode-tex.js +1 -0
  102. data/vendor/assets/javascripts/ace/mode-toml.js +4 -0
  103. data/vendor/assets/javascripts/ace/mode-twig.js +495 -138
  104. data/vendor/assets/javascripts/ace/mode-typescript.js +147 -19
  105. data/vendor/assets/javascripts/ace/mode-vala.js +4 -5
  106. data/vendor/assets/javascripts/ace/mode-vbscript.js +26 -13
  107. data/vendor/assets/javascripts/ace/mode-velocity.js +495 -138
  108. data/vendor/assets/javascripts/ace/mode-verilog.js +8 -0
  109. data/vendor/assets/javascripts/ace/mode-xml.js +2 -3
  110. data/vendor/assets/javascripts/ace/mode-xquery.js +4 -5
  111. data/vendor/assets/javascripts/ace/snippets/actionscript.js +5 -0
  112. data/vendor/assets/javascripts/ace/snippets/html_elixir.js +7 -0
  113. data/vendor/assets/javascripts/ace/snippets/java.js +6 -0
  114. data/vendor/assets/javascripts/ace/snippets/javascript.js +13 -0
  115. data/vendor/assets/javascripts/ace/snippets/lsl.js +166 -0
  116. data/vendor/assets/javascripts/ace/snippets/maze.js +16 -0
  117. data/vendor/assets/javascripts/ace/snippets/php.js +105 -4
  118. data/vendor/assets/javascripts/ace/snippets/sqlserver.js +76 -0
  119. data/vendor/assets/javascripts/ace/snippets/swift.js +7 -0
  120. data/vendor/assets/javascripts/ace/snippets/swig.js +7 -0
  121. data/vendor/assets/javascripts/ace/theme-clouds.js +0 -1
  122. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +0 -1
  123. data/vendor/assets/javascripts/ace/theme-cobalt.js +3 -3
  124. data/vendor/assets/javascripts/ace/theme-dawn.js +0 -1
  125. data/vendor/assets/javascripts/ace/theme-github.js +0 -1
  126. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +0 -1
  127. data/vendor/assets/javascripts/ace/theme-iplastic.js +121 -0
  128. data/vendor/assets/javascripts/ace/theme-katzenmilch.js +1 -2
  129. data/vendor/assets/javascripts/ace/theme-kr_theme.js +0 -1
  130. data/vendor/assets/javascripts/ace/theme-kuroir.js +0 -1
  131. data/vendor/assets/javascripts/ace/theme-merbivore.js +0 -1
  132. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +0 -1
  133. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +0 -1
  134. data/vendor/assets/javascripts/ace/theme-monokai.js +0 -1
  135. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +0 -1
  136. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +0 -1
  137. data/vendor/assets/javascripts/ace/theme-solarized_light.js +0 -1
  138. data/vendor/assets/javascripts/ace/theme-sqlserver.js +138 -0
  139. data/vendor/assets/javascripts/ace/theme-terminal.js +0 -1
  140. data/vendor/assets/javascripts/ace/theme-textmate.js +0 -1
  141. data/vendor/assets/javascripts/ace/theme-tomorrow.js +0 -1
  142. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +0 -1
  143. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +0 -1
  144. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +0 -1
  145. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +0 -1
  146. data/vendor/assets/javascripts/ace/theme-twilight.js +0 -1
  147. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +0 -1
  148. data/vendor/assets/javascripts/ace/theme-xcode.js +0 -1
  149. data/vendor/assets/javascripts/ace/worker-coffee.js +576 -6015
  150. data/vendor/assets/javascripts/ace/worker-css.js +529 -449
  151. data/vendor/assets/javascripts/ace/worker-html.js +528 -448
  152. data/vendor/assets/javascripts/ace/worker-javascript.js +8719 -7656
  153. data/vendor/assets/javascripts/ace/worker-json.js +530 -450
  154. data/vendor/assets/javascripts/ace/worker-lua.js +530 -450
  155. data/vendor/assets/javascripts/ace/worker-php.js +530 -450
  156. data/vendor/assets/javascripts/ace/worker-xml.js +530 -450
  157. data/vendor/assets/javascripts/ace/worker-xquery.js +529 -449
  158. metadata +14 -2
@@ -96,11 +96,11 @@ var supportedModes = {
96
96
  ADA: ["ada|adb"],
97
97
  Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
98
98
  AsciiDoc: ["asciidoc|adoc"],
99
- Assembly_x86:["asm"],
99
+ Assembly_x86:["asm|a"],
100
100
  AutoHotKey: ["ahk"],
101
101
  BatchFile: ["bat|cmd"],
102
+ C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
102
103
  C9Search: ["c9search_results"],
103
- C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
104
104
  Cirru: ["cirru|cr"],
105
105
  Clojure: ["clj|cljs"],
106
106
  Cobol: ["CBL|COB"],
@@ -116,7 +116,7 @@ var supportedModes = {
116
116
  Dot: ["dot"],
117
117
  Dummy: ["dummy"],
118
118
  DummySyntax: ["dummy"],
119
- Eiffel: ["e"],
119
+ Eiffel: ["e|ge"],
120
120
  EJS: ["ejs"],
121
121
  Elixir: ["ex|exs"],
122
122
  Elm: ["elm"],
@@ -135,6 +135,7 @@ var supportedModes = {
135
135
  haXe: ["hx"],
136
136
  HTML: ["html|htm|xhtml"],
137
137
  HTML_Ruby: ["erb|rhtml|html.erb"],
138
+ HTML_Elixir: ["eex|html.eex"],
138
139
  INI: ["ini|conf|cfg|prefs"],
139
140
  Io: ["io"],
140
141
  Jack: ["jack"],
@@ -161,6 +162,7 @@ var supportedModes = {
161
162
  Markdown: ["md|markdown"],
162
163
  Mask: ["mask"],
163
164
  MATLAB: ["matlab"],
165
+ Maze: ["mz"],
164
166
  MEL: ["mel"],
165
167
  MUSHCode: ["mc|mush"],
166
168
  MySQL: ["mysql"],
@@ -170,7 +172,7 @@ var supportedModes = {
170
172
  Pascal: ["pas|p"],
171
173
  Perl: ["pl|pm"],
172
174
  pgSQL: ["pgsql"],
173
- PHP: ["php|phtml"],
175
+ PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp"],
174
176
  Powershell: ["ps1"],
175
177
  Praat: ["praat|praatscript|psc|proc"],
176
178
  Prolog: ["plg|prolog"],
@@ -185,7 +187,7 @@ var supportedModes = {
185
187
  SASS: ["sass"],
186
188
  SCAD: ["scad"],
187
189
  Scala: ["scala"],
188
- Scheme: ["scm|rkt"],
190
+ Scheme: ["scm|sm|rkt|oak|scheme"],
189
191
  SCSS: ["scss"],
190
192
  SH: ["sh|bash|^.bashrc"],
191
193
  SJS: ["sjs"],
@@ -194,14 +196,16 @@ var supportedModes = {
194
196
  Soy_Template:["soy"],
195
197
  Space: ["space"],
196
198
  SQL: ["sql"],
199
+ SQLServer: ["sqlserver"],
197
200
  Stylus: ["styl|stylus"],
198
201
  SVG: ["svg"],
202
+ Swift: ["swift"],
199
203
  Tcl: ["tcl"],
200
204
  Tex: ["tex"],
201
205
  Text: ["txt"],
202
206
  Textile: ["textile"],
203
207
  Toml: ["toml"],
204
- Twig: ["twig"],
208
+ Twig: ["twig|swig"],
205
209
  Typescript: ["ts|typescript|str"],
206
210
  Vala: ["vala"],
207
211
  VBScript: ["vbs|vb"],
@@ -221,6 +225,7 @@ var nameOverrides = {
221
225
  C_Cpp: "C and C++",
222
226
  coffee: "CoffeeScript",
223
227
  HTML_Ruby: "HTML (Ruby)",
228
+ HTML_Elixir: "HTML (Elixir)",
224
229
  FTL: "FreeMarker"
225
230
  };
226
231
  var modesByName = {};
@@ -253,12 +258,14 @@ var themeData = [
253
258
  ["Dreamweaver" ],
254
259
  ["Eclipse" ],
255
260
  ["GitHub" ],
261
+ ["IPlastic" ],
256
262
  ["Solarized Light"],
257
263
  ["TextMate" ],
258
264
  ["Tomorrow" ],
259
265
  ["XCode" ],
260
266
  ["Kuroir"],
261
267
  ["KatzenMilch"],
268
+ ["SQL Server" ,"sqlserver" , "light"],
262
269
  ["Ambiance" ,"ambiance" , "dark"],
263
270
  ["Chaos" ,"chaos" , "dark"],
264
271
  ["Clouds Midnight" ,"clouds_midnight" , "dark"],
@@ -414,7 +421,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
414
421
  });
415
422
 
416
423
  var el = topmenu.appendChild(document.createElement('div'));
417
- var version = "1.1.9";
424
+ var version = "1.2.1";
418
425
  el.style.padding = "1em";
419
426
  el.textContent = "Ace version " + version;
420
427
 
@@ -39,6 +39,10 @@ counter-reset: ace_line;\
39
39
  var config = require("../config");
40
40
  var dom = require("../lib/dom");
41
41
 
42
+ var SimpleTextLayer = function() {
43
+ this.config = {};
44
+ };
45
+ SimpleTextLayer.prototype = TextLayer.prototype;
42
46
 
43
47
  var highlight = function(el, opts, callback) {
44
48
  var m = el.className.match(/lang-(\w+)/);
@@ -117,12 +121,8 @@ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
117
121
  session.setUseWorker(false);
118
122
  session.setMode(mode);
119
123
 
120
- var textLayer = new TextLayer(document.createElement("div"));
124
+ var textLayer = new SimpleTextLayer();
121
125
  textLayer.setSession(session);
122
- textLayer.config = {
123
- characterWidth: 10,
124
- lineHeight: 20
125
- };
126
126
 
127
127
  session.setValue(input);
128
128
 
@@ -11,13 +11,11 @@ var StatusBar = function(editor, parentNode) {
11
11
 
12
12
  var statusUpdate = lang.delayedCall(function(){
13
13
  this.updateStatus(editor)
14
- }.bind(this));
15
- editor.on("changeStatus", function() {
16
- statusUpdate.schedule(100);
17
- });
18
- editor.on("changeSelection", function() {
19
- statusUpdate.schedule(100);
20
- });
14
+ }.bind(this)).schedule.bind(null, 100);
15
+
16
+ editor.on("changeStatus", statusUpdate);
17
+ editor.on("changeSelection", statusUpdate);
18
+ editor.on("keyboardActivity", statusUpdate);
21
19
  };
22
20
 
23
21
  (function(){
@@ -30,13 +28,17 @@ var StatusBar = function(editor, parentNode) {
30
28
  add(editor.keyBinding.getStatusText(editor));
31
29
  if (editor.commands.recording)
32
30
  add("REC");
33
-
34
- var c = editor.selection.lead;
35
- add(c.row + ":" + c.column, " ");
36
- if (!editor.selection.isEmpty()) {
31
+
32
+ var sel = editor.selection;
33
+ var c = sel.lead;
34
+
35
+ if (!sel.isEmpty()) {
37
36
  var r = editor.getSelectionRange();
38
- add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")");
37
+ add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")", " ");
39
38
  }
39
+ add(c.row + ":" + c.column, " ");
40
+ if (sel.rangeCount)
41
+ add("[" + sel.rangeCount + "]", " ");
40
42
  status.pop();
41
43
  this.element.textContent = status.join("");
42
44
  };
@@ -98,7 +98,6 @@ background: rgb(181, 213, 255);\
98
98
  }\
99
99
  .ace-tm.ace_multiselect .ace_selection.ace_start {\
100
100
  box-shadow: 0 0 3px 0px white;\
101
- border-radius: 2px;\
102
101
  }\
103
102
  .ace-tm .ace_marker-layer .ace_step {\
104
103
  background: rgb(252, 255, 0);\
@@ -168,7 +167,7 @@ exports.edit = function(el) {
168
167
  value = oldNode.value;
169
168
  el = dom.createElement("pre");
170
169
  oldNode.parentNode.replaceChild(el, oldNode);
171
- } else {
170
+ } else if (el) {
172
171
  value = dom.getInnerText(el);
173
172
  el.innerHTML = '';
174
173
  }
@@ -10,12 +10,14 @@ var themeData = [
10
10
  ["Dreamweaver" ],
11
11
  ["Eclipse" ],
12
12
  ["GitHub" ],
13
+ ["IPlastic" ],
13
14
  ["Solarized Light"],
14
15
  ["TextMate" ],
15
16
  ["Tomorrow" ],
16
17
  ["XCode" ],
17
18
  ["Kuroir"],
18
19
  ["KatzenMilch"],
20
+ ["SQL Server" ,"sqlserver" , "light"],
19
21
  ["Ambiance" ,"ambiance" , "dark"],
20
22
  ["Chaos" ,"chaos" , "dark"],
21
23
  ["Clouds Midnight" ,"clouds_midnight" , "dark"],
@@ -13,18 +13,20 @@ exports.$detectIndentation = function(lines, fallback) {
13
13
  if (!/^\s*[^*+\-\s]/.test(line))
14
14
  continue;
15
15
 
16
- if (line[0] == "\t")
16
+ if (line[0] == "\t") {
17
17
  tabIndents++;
18
-
19
- var spaces = line.match(/^ */)[0].length;
20
- if (spaces && line[spaces] != "\t") {
21
- var diff = spaces - prevSpaces;
22
- if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
23
- changes[diff] = (changes[diff] || 0) + 1;
24
-
25
- stats[spaces] = (stats[spaces] || 0) + 1;
18
+ prevSpaces = -Number.MAX_VALUE;
19
+ } else {
20
+ var spaces = line.match(/^ */)[0].length;
21
+ if (spaces && line[spaces] != "\t") {
22
+ var diff = spaces - prevSpaces;
23
+ if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
24
+ changes[diff] = (changes[diff] || 0) + 1;
25
+
26
+ stats[spaces] = (stats[spaces] || 0) + 1;
27
+ }
28
+ prevSpaces = spaces;
26
29
  }
27
- prevSpaces = spaces;
28
30
  while (i < max && line[line.length - 1] == "\\")
29
31
  line = lines[i++];
30
32
  }
@@ -46,7 +48,7 @@ exports.$detectIndentation = function(lines, fallback) {
46
48
  spaceIndents = score;
47
49
  score = stats[1] ? 0.9 : 0.8;
48
50
  if (!stats.length)
49
- score = 0
51
+ score = 0;
50
52
  } else
51
53
  score /= spaceIndents;
52
54
 
@@ -60,9 +62,11 @@ exports.$detectIndentation = function(lines, fallback) {
60
62
  if (first.score && first.score > 1.4)
61
63
  var tabLength = first.length;
62
64
 
63
- if (tabIndents > spaceIndents + 1)
65
+ if (tabIndents > spaceIndents + 1) {
66
+ if (tabLength == 1 || spaceIndents < tabIndents / 4 || first.score < 1.8)
67
+ tabLength = undefined;
64
68
  return {ch: "\t", length: tabLength};
65
-
69
+ }
66
70
  if (spaceIndents > tabIndents + 1)
67
71
  return {ch: " ", length: tabLength};
68
72
  };
@@ -222,18 +222,14 @@ exports.iSearchCommands = [{
222
222
  bindKey: {win: "Ctrl-F", mac: "Command-F"},
223
223
  exec: function(iSearch) {
224
224
  iSearch.cancelSearch(true);
225
- },
226
- readOnly: true,
227
- isIncrementalSearchCommand: true
225
+ }
228
226
  }, {
229
227
  name: "searchForward",
230
228
  bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
231
229
  exec: function(iSearch, options) {
232
230
  options.useCurrentOrPrevSearch = true;
233
231
  iSearch.next(options);
234
- },
235
- readOnly: true,
236
- isIncrementalSearchCommand: true
232
+ }
237
233
  }, {
238
234
  name: "searchBackward",
239
235
  bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
@@ -241,42 +237,30 @@ exports.iSearchCommands = [{
241
237
  options.useCurrentOrPrevSearch = true;
242
238
  options.backwards = true;
243
239
  iSearch.next(options);
244
- },
245
- readOnly: true,
246
- isIncrementalSearchCommand: true
240
+ }
247
241
  }, {
248
242
  name: "extendSearchTerm",
249
243
  exec: function(iSearch, string) {
250
244
  iSearch.addString(string);
251
- },
252
- readOnly: true,
253
- isIncrementalSearchCommand: true
245
+ }
254
246
  }, {
255
247
  name: "extendSearchTermSpace",
256
248
  bindKey: "space",
257
- exec: function(iSearch) { iSearch.addString(' '); },
258
- readOnly: true,
259
- isIncrementalSearchCommand: true
249
+ exec: function(iSearch) { iSearch.addString(' '); }
260
250
  }, {
261
251
  name: "shrinkSearchTerm",
262
252
  bindKey: "backspace",
263
253
  exec: function(iSearch) {
264
254
  iSearch.removeChar();
265
- },
266
- readOnly: true,
267
- isIncrementalSearchCommand: true
255
+ }
268
256
  }, {
269
257
  name: 'confirmSearch',
270
258
  bindKey: 'return',
271
- exec: function(iSearch) { iSearch.deactivate(); },
272
- readOnly: true,
273
- isIncrementalSearchCommand: true
259
+ exec: function(iSearch) { iSearch.deactivate(); }
274
260
  }, {
275
261
  name: 'cancelSearch',
276
262
  bindKey: 'esc|Ctrl-G',
277
- exec: function(iSearch) { iSearch.deactivate(true); },
278
- readOnly: true,
279
- isIncrementalSearchCommand: true
263
+ exec: function(iSearch) { iSearch.deactivate(true); }
280
264
  }, {
281
265
  name: 'occurisearch',
282
266
  bindKey: 'Ctrl-O',
@@ -284,9 +268,7 @@ exports.iSearchCommands = [{
284
268
  var options = oop.mixin({}, iSearch.$options);
285
269
  iSearch.deactivate();
286
270
  occurStartCommand.exec(iSearch.$editor, options);
287
- },
288
- readOnly: true,
289
- isIncrementalSearchCommand: true
271
+ }
290
272
  }, {
291
273
  name: "yankNextWord",
292
274
  bindKey: "Ctrl-w",
@@ -295,9 +277,7 @@ exports.iSearchCommands = [{
295
277
  range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }),
296
278
  string = ed.session.getTextRange(range);
297
279
  iSearch.addString(string);
298
- },
299
- readOnly: true,
300
- isIncrementalSearchCommand: true
280
+ }
301
281
  }, {
302
282
  name: "yankNextChar",
303
283
  bindKey: "Ctrl-Alt-y",
@@ -306,15 +286,11 @@ exports.iSearchCommands = [{
306
286
  range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }),
307
287
  string = ed.session.getTextRange(range);
308
288
  iSearch.addString(string);
309
- },
310
- readOnly: true,
311
- isIncrementalSearchCommand: true
289
+ }
312
290
  }, {
313
291
  name: 'recenterTopBottom',
314
292
  bindKey: 'Ctrl-l',
315
- exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); },
316
- readOnly: true,
317
- isIncrementalSearchCommand: true
293
+ exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); }
318
294
  }, {
319
295
  name: 'selectAllMatches',
320
296
  bindKey: 'Ctrl-space',
@@ -326,18 +302,19 @@ exports.iSearchCommands = [{
326
302
  return ranges.concat(ea ? ea : []); }, []) : [];
327
303
  iSearch.deactivate(false);
328
304
  ranges.forEach(ed.selection.addRange.bind(ed.selection));
329
- },
330
- readOnly: true,
331
- isIncrementalSearchCommand: true
305
+ }
332
306
  }, {
333
307
  name: 'searchAsRegExp',
334
308
  bindKey: 'Alt-r',
335
309
  exec: function(iSearch) {
336
310
  iSearch.convertNeedleToRegExp();
337
- },
338
- readOnly: true,
339
- isIncrementalSearchCommand: true
340
- }];
311
+ }
312
+ }].map(function(cmd) {
313
+ cmd.readOnly = true;
314
+ cmd.isIncrementalSearchCommand = true;
315
+ cmd.scrollIntoView = "animate-cursor";
316
+ return cmd;
317
+ });
341
318
 
342
319
  function IncrementalSearchKeyboardHandler(iSearch) {
343
320
  this.$iSearch = iSearch;
@@ -345,24 +322,29 @@ function IncrementalSearchKeyboardHandler(iSearch) {
345
322
 
346
323
  oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
347
324
 
348
- ;(function() {
325
+ (function() {
349
326
 
350
327
  this.attach = function(editor) {
351
328
  var iSearch = this.$iSearch;
352
329
  HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
353
330
  this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
354
- if (!e.command.isIncrementalSearchCommand) return undefined;
331
+ if (!e.command.isIncrementalSearchCommand)
332
+ return iSearch.deactivate();
355
333
  e.stopPropagation();
356
334
  e.preventDefault();
357
- return e.command.exec(iSearch, e.args || {});
335
+ var scrollTop = editor.session.getScrollTop();
336
+ var result = e.command.exec(iSearch, e.args || {});
337
+ editor.renderer.scrollCursorIntoView(null, 0.5);
338
+ editor.renderer.animateScrolling(scrollTop);
339
+ return result;
358
340
  });
359
- }
341
+ };
360
342
 
361
343
  this.detach = function(editor) {
362
344
  if (!this.$commandExecHandler) return;
363
345
  editor.commands.removeEventListener('exec', this.$commandExecHandler);
364
346
  delete this.$commandExecHandler;
365
- }
347
+ };
366
348
 
367
349
  var handleKeyboard$super = this.handleKeyboard;
368
350
  this.handleKeyboard = function(data, hashId, key, keyCode) {
@@ -374,8 +356,8 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
374
356
  var extendCmd = this.commands.extendSearchTerm;
375
357
  if (extendCmd) { return {command: extendCmd, args: key}; }
376
358
  }
377
- return {command: "null", passEvent: hashId == 0 || hashId == 4};
378
- }
359
+ return false;
360
+ };
379
361
 
380
362
  }).call(IncrementalSearchKeyboardHandler.prototype);
381
363
 
@@ -436,7 +418,7 @@ function objectToRegExp(obj) {
436
418
  this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
437
419
  this.selectionFix(ed);
438
420
  this.statusMessage(true);
439
- }
421
+ };
440
422
 
441
423
  this.deactivate = function(reset) {
442
424
  this.cancelSearch(reset);
@@ -448,13 +430,13 @@ function objectToRegExp(obj) {
448
430
  }
449
431
  ed.onPaste = this.$originalEditorOnPaste;
450
432
  this.message('');
451
- }
433
+ };
452
434
 
453
435
  this.selectionFix = function(editor) {
454
436
  if (editor.selection.isEmpty() && !editor.session.$emacsMark) {
455
437
  editor.clearSelection();
456
438
  }
457
- }
439
+ };
458
440
 
459
441
  this.highlight = function(regexp) {
460
442
  var sess = this.$editor.session,
@@ -462,7 +444,7 @@ function objectToRegExp(obj) {
462
444
  new SearchHighlight(null, "ace_isearch-result", "text"));
463
445
  hl.setRegexp(regexp);
464
446
  sess._emit("changeBackMarker"); // force highlight layer redraw
465
- }
447
+ };
466
448
 
467
449
  this.cancelSearch = function(reset) {
468
450
  var e = this.$editor;
@@ -476,7 +458,7 @@ function objectToRegExp(obj) {
476
458
  }
477
459
  this.highlight(null);
478
460
  return Range.fromPoints(this.$currentPos, this.$currentPos);
479
- }
461
+ };
480
462
 
481
463
  this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) {
482
464
  if (!this.$editor) return null;
@@ -487,7 +469,7 @@ function objectToRegExp(obj) {
487
469
  if (options.needle.length === 0) {
488
470
  this.statusMessage(true);
489
471
  return this.cancelSearch(true);
490
- };
472
+ }
491
473
  options.start = this.$currentPos;
492
474
  var session = this.$editor.session,
493
475
  found = this.find(session),
@@ -497,13 +479,13 @@ function objectToRegExp(obj) {
497
479
  if (options.backwards) found = Range.fromPoints(found.end, found.start);
498
480
  this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end));
499
481
  if (moveToNext) this.$currentPos = found.end;
500
- this.highlight(options.re)
482
+ this.highlight(options.re);
501
483
  }
502
484
 
503
485
  this.statusMessage(found);
504
486
 
505
487
  return found;
506
- }
488
+ };
507
489
 
508
490
  this.addString = function(s) {
509
491
  return this.highlightAndFindWithNeedle(false, function(needle) {
@@ -513,7 +495,7 @@ function objectToRegExp(obj) {
513
495
  reObj.expression += s;
514
496
  return objectToRegExp(reObj);
515
497
  });
516
- }
498
+ };
517
499
 
518
500
  this.removeChar = function(c) {
519
501
  return this.highlightAndFindWithNeedle(false, function(needle) {
@@ -523,7 +505,7 @@ function objectToRegExp(obj) {
523
505
  reObj.expression = reObj.expression.substring(0, reObj.expression.length-1);
524
506
  return objectToRegExp(reObj);
525
507
  });
526
- }
508
+ };
527
509
 
528
510
  this.next = function(options) {
529
511
  options = options || {};
@@ -533,28 +515,28 @@ function objectToRegExp(obj) {
533
515
  return options.useCurrentOrPrevSearch && needle.length === 0 ?
534
516
  this.$prevNeedle || '' : needle;
535
517
  });
536
- }
518
+ };
537
519
 
538
520
  this.onMouseDown = function(evt) {
539
521
  this.deactivate();
540
522
  return true;
541
- }
523
+ };
542
524
 
543
525
  this.onPaste = function(text) {
544
526
  this.addString(text);
545
- }
527
+ };
546
528
 
547
529
  this.convertNeedleToRegExp = function() {
548
530
  return this.highlightAndFindWithNeedle(false, function(needle) {
549
531
  return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig');
550
532
  });
551
- }
533
+ };
552
534
 
553
535
  this.convertNeedleToString = function() {
554
536
  return this.highlightAndFindWithNeedle(false, function(needle) {
555
537
  return isRegExp(needle) ? regExpToObject(needle).expression : needle;
556
538
  });
557
- }
539
+ };
558
540
 
559
541
  this.statusMessage = function(found) {
560
542
  var options = this.$options, msg = '';
@@ -562,7 +544,7 @@ function objectToRegExp(obj) {
562
544
  msg += 'isearch: ' + options.needle;
563
545
  msg += found ? '' : ' (not found)';
564
546
  this.message(msg);
565
- }
547
+ };
566
548
 
567
549
  this.message = function(msg) {
568
550
  if (this.$editor.showCommandLine) {
@@ -571,7 +553,7 @@ function objectToRegExp(obj) {
571
553
  } else {
572
554
  console.log(msg);
573
555
  }
574
- }
556
+ };
575
557
 
576
558
  }).call(IncrementalSearch.prototype);
577
559
 
@@ -980,7 +962,7 @@ exports.emacsKeys = {
980
962
  "M-;": "togglecomment",
981
963
 
982
964
  "C-/|C-x u|S-C--|C-z": "undo",
983
- "S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
965
+ "S-C-/|S-C-x u|C--|S-C-z": "redo", // infinite undo?
984
966
  "C-x r": "selectRectangularRegion",
985
967
  "M-x": {command: "focusCommandLine", args: "M-x "}
986
968
  };
@@ -1022,7 +1004,7 @@ exports.handler.addCommands({
1022
1004
  transientMarkModeActive = true,
1023
1005
  hasNoSelection = ranges.every(function(range) { return range.isEmpty(); });
1024
1006
  if (transientMarkModeActive && (mark || !hasNoSelection)) {
1025
- if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)})
1007
+ if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)});
1026
1008
  else editor.clearSelection();
1027
1009
  if (mark) editor.pushEmacsMark(null);
1028
1010
  return;
@@ -1082,17 +1064,27 @@ exports.handler.addCommands({
1082
1064
  },
1083
1065
  killLine: function(editor) {
1084
1066
  editor.pushEmacsMark(null);
1085
- var pos = editor.getCursorPosition();
1086
- if (pos.column === 0 &&
1087
- editor.session.doc.getLine(pos.row).length === 0) {
1088
- editor.selection.selectLine();
1089
- } else {
1090
- editor.clearSelection();
1091
- editor.selection.selectLineEnd();
1092
- }
1067
+ editor.clearSelection();
1093
1068
  var range = editor.getSelectionRange();
1069
+ var line = editor.session.getLine(range.start.row);
1070
+ range.end.column = line.length;
1071
+ line = line.substr(range.start.column)
1072
+
1073
+ var foldLine = editor.session.getFoldLine(range.start.row);
1074
+ if (foldLine && range.end.row != foldLine.end.row) {
1075
+ range.end.row = foldLine.end.row;
1076
+ line = "x";
1077
+ }
1078
+ if (/^\s*$/.test(line)) {
1079
+ range.end.row++;
1080
+ line = editor.session.getLine(range.end.row);
1081
+ range.end.column = /^\s*$/.test(line) ? line.length : 0;
1082
+ }
1094
1083
  var text = editor.session.getTextRange(range);
1095
- exports.killRing.add(text);
1084
+ if (editor.prevOp.command == this)
1085
+ exports.killRing.append(text);
1086
+ else
1087
+ exports.killRing.add(text);
1096
1088
 
1097
1089
  editor.session.remove(range);
1098
1090
  editor.clearSelection();
@@ -1164,6 +1156,12 @@ exports.killRing = {
1164
1156
  if (this.$data.length > 30)
1165
1157
  this.$data.shift();
1166
1158
  },
1159
+ append: function(str) {
1160
+ var idx = this.$data.length - 1;
1161
+ var text = this.$data[idx] || "";
1162
+ if (str) text += str;
1163
+ if (text) this.$data[idx] = text;
1164
+ },
1167
1165
  get: function(n) {
1168
1166
  n = n || 1;
1169
1167
  return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n');