ace-rails-ap 4.2 → 4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (331) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/ace-rails-ap.gemspec +0 -2
  4. data/lib/ace/rails/version.rb +1 -1
  5. data/update.sh +1 -1
  6. data/vendor/assets/javascripts/ace/ace.js +1297 -1274
  7. data/vendor/assets/javascripts/ace/ext-beautify.js +6 -2
  8. data/vendor/assets/javascripts/ace/ext-code_lens.js +238 -0
  9. data/vendor/assets/javascripts/ace/ext-emmet.js +340 -236
  10. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +37 -32
  11. data/vendor/assets/javascripts/ace/ext-language_tools.js +415 -263
  12. data/vendor/assets/javascripts/ace/ext-linking.js +1 -1
  13. data/vendor/assets/javascripts/ace/ext-modelist.js +15 -5
  14. data/vendor/assets/javascripts/ace/ext-options.js +88 -50
  15. data/vendor/assets/javascripts/ace/ext-prompt.js +2783 -0
  16. data/vendor/assets/javascripts/ace/ext-rtl.js +1 -3
  17. data/vendor/assets/javascripts/ace/ext-settings_menu.js +92 -54
  18. data/vendor/assets/javascripts/ace/ext-spellcheck.js +0 -1
  19. data/vendor/assets/javascripts/ace/ext-statusbar.js +2 -2
  20. data/vendor/assets/javascripts/ace/ext-themelist.js +2 -1
  21. data/vendor/assets/javascripts/ace/ext-whitespace.js +4 -0
  22. data/vendor/assets/javascripts/ace/keybinding-emacs.js +22 -22
  23. data/vendor/assets/javascripts/ace/keybinding-sublime.js +2 -5
  24. data/vendor/assets/javascripts/ace/keybinding-vim.js +336 -70
  25. data/vendor/assets/javascripts/ace/keybinding-vscode.js +262 -0
  26. data/vendor/assets/javascripts/ace/mode-abc.js +3 -0
  27. data/vendor/assets/javascripts/ace/mode-actionscript.js +1 -0
  28. data/vendor/assets/javascripts/ace/mode-alda.js +311 -0
  29. data/vendor/assets/javascripts/ace/mode-aql.js +102 -0
  30. data/vendor/assets/javascripts/ace/mode-asl.js +17 -16
  31. data/vendor/assets/javascripts/ace/mode-autohotkey.js +3 -1
  32. data/vendor/assets/javascripts/ace/mode-c_cpp.js +1 -0
  33. data/vendor/assets/javascripts/ace/mode-cirru.js +2 -2
  34. data/vendor/assets/javascripts/ace/mode-clojure.js +1 -0
  35. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -0
  36. data/vendor/assets/javascripts/ace/mode-coldfusion.js +3 -0
  37. data/vendor/assets/javascripts/ace/mode-crystal.js +642 -0
  38. data/vendor/assets/javascripts/ace/mode-csound_document.js +82 -34
  39. data/vendor/assets/javascripts/ace/mode-csound_orchestra.js +72 -30
  40. data/vendor/assets/javascripts/ace/mode-csound_score.js +30 -21
  41. data/vendor/assets/javascripts/ace/mode-css.js +1 -0
  42. data/vendor/assets/javascripts/ace/mode-curly.js +3 -0
  43. data/vendor/assets/javascripts/ace/mode-d.js +1 -1
  44. data/vendor/assets/javascripts/ace/mode-dart.js +2 -0
  45. data/vendor/assets/javascripts/ace/mode-diff.js +1 -0
  46. data/vendor/assets/javascripts/ace/mode-django.js +4 -0
  47. data/vendor/assets/javascripts/ace/mode-dockerfile.js +1 -0
  48. data/vendor/assets/javascripts/ace/mode-drools.js +1 -0
  49. data/vendor/assets/javascripts/ace/mode-edifact.js +1 -0
  50. data/vendor/assets/javascripts/ace/mode-ejs.js +673 -165
  51. data/vendor/assets/javascripts/ace/mode-erlang.js +1 -0
  52. data/vendor/assets/javascripts/ace/mode-fsharp.js +2 -2
  53. data/vendor/assets/javascripts/ace/mode-fsl.js +1 -0
  54. data/vendor/assets/javascripts/ace/mode-gherkin.js +0 -2
  55. data/vendor/assets/javascripts/ace/mode-glsl.js +1 -0
  56. data/vendor/assets/javascripts/ace/mode-gobstones.js +254 -94
  57. data/vendor/assets/javascripts/ace/mode-graphqlschema.js +1 -0
  58. data/vendor/assets/javascripts/ace/mode-groovy.js +1 -0
  59. data/vendor/assets/javascripts/ace/mode-haml.js +419 -104
  60. data/vendor/assets/javascripts/ace/mode-handlebars.js +3 -0
  61. data/vendor/assets/javascripts/ace/mode-haskell.js +1 -0
  62. data/vendor/assets/javascripts/ace/mode-html.js +3 -0
  63. data/vendor/assets/javascripts/ace/mode-html_elixir.js +3 -0
  64. data/vendor/assets/javascripts/ace/mode-html_ruby.js +673 -165
  65. data/vendor/assets/javascripts/ace/mode-io.js +2 -7
  66. data/vendor/assets/javascripts/ace/mode-jade.js +1 -1
  67. data/vendor/assets/javascripts/ace/mode-java.js +2 -0
  68. data/vendor/assets/javascripts/ace/mode-javascript.js +1 -0
  69. data/vendor/assets/javascripts/ace/mode-json.js +3 -0
  70. data/vendor/assets/javascripts/ace/mode-json5.js +360 -0
  71. data/vendor/assets/javascripts/ace/mode-jsoniq.js +1 -0
  72. data/vendor/assets/javascripts/ace/mode-jsp.js +1 -0
  73. data/vendor/assets/javascripts/ace/mode-kotlin.js +2 -0
  74. data/vendor/assets/javascripts/ace/mode-liquid.js +4 -0
  75. data/vendor/assets/javascripts/ace/mode-lsl.js +1 -0
  76. data/vendor/assets/javascripts/ace/mode-lua.js +31 -10
  77. data/vendor/assets/javascripts/ace/mode-luapage.js +34 -10
  78. data/vendor/assets/javascripts/ace/mode-lucene.js +77 -9
  79. data/vendor/assets/javascripts/ace/mode-makefile.js +1 -0
  80. data/vendor/assets/javascripts/ace/mode-markdown.js +7 -1
  81. data/vendor/assets/javascripts/ace/mode-mask.js +1 -1
  82. data/vendor/assets/javascripts/ace/mode-maze.js +1 -0
  83. data/vendor/assets/javascripts/ace/mode-mediawiki.js +592 -0
  84. data/vendor/assets/javascripts/ace/mode-nginx.js +298 -0
  85. data/vendor/assets/javascripts/ace/mode-nim.js +363 -0
  86. data/vendor/assets/javascripts/ace/mode-nix.js +1 -0
  87. data/vendor/assets/javascripts/ace/mode-nsis.js +1 -1
  88. data/vendor/assets/javascripts/ace/mode-nunjucks.js +2698 -0
  89. data/vendor/assets/javascripts/ace/mode-pascal.js +84 -66
  90. data/vendor/assets/javascripts/ace/mode-perl.js +1 -0
  91. data/vendor/assets/javascripts/ace/mode-pgsql.js +2 -2
  92. data/vendor/assets/javascripts/ace/mode-php.js +5 -1
  93. data/vendor/assets/javascripts/ace/mode-php_laravel_blade.js +5 -1
  94. data/vendor/assets/javascripts/ace/mode-prisma.js +489 -0
  95. data/vendor/assets/javascripts/ace/mode-protobuf.js +1 -0
  96. data/vendor/assets/javascripts/ace/mode-puppet.js +8 -9
  97. data/vendor/assets/javascripts/ace/mode-python.js +3 -2
  98. data/vendor/assets/javascripts/ace/mode-qml.js +381 -0
  99. data/vendor/assets/javascripts/ace/mode-r.js +1 -0
  100. data/vendor/assets/javascripts/ace/mode-razor.js +4 -0
  101. data/vendor/assets/javascripts/ace/mode-rhtml.js +3 -0
  102. data/vendor/assets/javascripts/ace/mode-rst.js +1 -0
  103. data/vendor/assets/javascripts/ace/mode-ruby.js +670 -165
  104. data/vendor/assets/javascripts/ace/mode-rust.js +1 -1
  105. data/vendor/assets/javascripts/ace/mode-scala.js +1 -0
  106. data/vendor/assets/javascripts/ace/mode-sh.js +1 -0
  107. data/vendor/assets/javascripts/ace/mode-sjs.js +1 -0
  108. data/vendor/assets/javascripts/ace/mode-slim.js +710 -111
  109. data/vendor/assets/javascripts/ace/mode-smarty.js +3 -0
  110. data/vendor/assets/javascripts/ace/mode-snippets.js +1 -0
  111. data/vendor/assets/javascripts/ace/mode-soy_template.js +3 -0
  112. data/vendor/assets/javascripts/ace/mode-sql.js +1 -0
  113. data/vendor/assets/javascripts/ace/mode-sqlserver.js +2 -1
  114. data/vendor/assets/javascripts/ace/mode-svg.js +1 -0
  115. data/vendor/assets/javascripts/ace/mode-swift.js +6 -0
  116. data/vendor/assets/javascripts/ace/mode-tcl.js +4 -0
  117. data/vendor/assets/javascripts/ace/mode-terraform.js +14 -11
  118. data/vendor/assets/javascripts/ace/mode-tex.js +1 -0
  119. data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
  120. data/vendor/assets/javascripts/ace/mode-tsx.js +1 -0
  121. data/vendor/assets/javascripts/ace/mode-twig.js +3 -0
  122. data/vendor/assets/javascripts/ace/mode-typescript.js +1 -0
  123. data/vendor/assets/javascripts/ace/mode-vala.js +1 -0
  124. data/vendor/assets/javascripts/ace/mode-vbscript.js +444 -15
  125. data/vendor/assets/javascripts/ace/mode-velocity.js +4 -0
  126. data/vendor/assets/javascripts/ace/mode-vhdl.js +5 -6
  127. data/vendor/assets/javascripts/ace/mode-visualforce.js +3 -0
  128. data/vendor/assets/javascripts/ace/mode-wollok.js +2 -0
  129. data/vendor/assets/javascripts/ace/mode-xquery.js +1 -0
  130. data/vendor/assets/javascripts/ace/mode-yaml.js +44 -13
  131. data/vendor/assets/javascripts/ace/mode-zeek.js +539 -0
  132. data/vendor/assets/javascripts/ace/snippets/abap.js +8 -6
  133. data/vendor/assets/javascripts/ace/snippets/abc.js +8 -1
  134. data/vendor/assets/javascripts/ace/snippets/actionscript.js +8 -1
  135. data/vendor/assets/javascripts/ace/snippets/ada.js +8 -6
  136. data/vendor/assets/javascripts/ace/snippets/alda.js +9 -0
  137. data/vendor/assets/javascripts/ace/snippets/apache_conf.js +8 -6
  138. data/vendor/assets/javascripts/ace/snippets/apex.js +9 -0
  139. data/vendor/assets/javascripts/ace/snippets/applescript.js +8 -6
  140. data/vendor/assets/javascripts/ace/snippets/aql.js +9 -0
  141. data/vendor/assets/javascripts/ace/snippets/asciidoc.js +8 -6
  142. data/vendor/assets/javascripts/ace/snippets/asl.js +9 -0
  143. data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +8 -6
  144. data/vendor/assets/javascripts/ace/snippets/autohotkey.js +8 -6
  145. data/vendor/assets/javascripts/ace/snippets/batchfile.js +8 -6
  146. data/vendor/assets/javascripts/ace/snippets/c9search.js +8 -6
  147. data/vendor/assets/javascripts/ace/snippets/c_cpp.js +8 -1
  148. data/vendor/assets/javascripts/ace/snippets/cirru.js +8 -6
  149. data/vendor/assets/javascripts/ace/snippets/clojure.js +8 -1
  150. data/vendor/assets/javascripts/ace/snippets/cobol.js +8 -6
  151. data/vendor/assets/javascripts/ace/snippets/coffee.js +8 -1
  152. data/vendor/assets/javascripts/ace/snippets/coldfusion.js +8 -6
  153. data/vendor/assets/javascripts/ace/snippets/crystal.js +9 -0
  154. data/vendor/assets/javascripts/ace/snippets/csharp.js +8 -6
  155. data/vendor/assets/javascripts/ace/snippets/csound_document.js +24 -0
  156. data/vendor/assets/javascripts/ace/snippets/csound_orchestra.js +61 -0
  157. data/vendor/assets/javascripts/ace/snippets/csound_score.js +9 -0
  158. data/vendor/assets/javascripts/ace/snippets/csp.js +9 -0
  159. data/vendor/assets/javascripts/ace/snippets/css.js +8 -1
  160. data/vendor/assets/javascripts/ace/snippets/curly.js +8 -6
  161. data/vendor/assets/javascripts/ace/snippets/d.js +8 -6
  162. data/vendor/assets/javascripts/ace/snippets/dart.js +8 -1
  163. data/vendor/assets/javascripts/ace/snippets/diff.js +8 -1
  164. data/vendor/assets/javascripts/ace/snippets/django.js +8 -1
  165. data/vendor/assets/javascripts/ace/snippets/dockerfile.js +8 -6
  166. data/vendor/assets/javascripts/ace/snippets/dot.js +8 -6
  167. data/vendor/assets/javascripts/ace/snippets/drools.js +8 -1
  168. data/vendor/assets/javascripts/ace/snippets/edifact.js +254 -0
  169. data/vendor/assets/javascripts/ace/snippets/eiffel.js +8 -6
  170. data/vendor/assets/javascripts/ace/snippets/ejs.js +8 -6
  171. data/vendor/assets/javascripts/ace/snippets/elixir.js +8 -6
  172. data/vendor/assets/javascripts/ace/snippets/elm.js +8 -6
  173. data/vendor/assets/javascripts/ace/snippets/erlang.js +8 -1
  174. data/vendor/assets/javascripts/ace/snippets/forth.js +8 -6
  175. data/vendor/assets/javascripts/ace/snippets/fortran.js +8 -6
  176. data/vendor/assets/javascripts/ace/snippets/fsharp.js +9 -0
  177. data/vendor/assets/javascripts/ace/snippets/fsl.js +14 -0
  178. data/vendor/assets/javascripts/ace/snippets/ftl.js +8 -6
  179. data/vendor/assets/javascripts/ace/snippets/gcode.js +8 -6
  180. data/vendor/assets/javascripts/ace/snippets/gherkin.js +8 -6
  181. data/vendor/assets/javascripts/ace/snippets/gitignore.js +8 -6
  182. data/vendor/assets/javascripts/ace/snippets/glsl.js +8 -6
  183. data/vendor/assets/javascripts/ace/snippets/gobstones.js +1701 -24
  184. data/vendor/assets/javascripts/ace/snippets/golang.js +8 -6
  185. data/vendor/assets/javascripts/ace/snippets/graphqlschema.js +8 -1
  186. data/vendor/assets/javascripts/ace/snippets/groovy.js +8 -6
  187. data/vendor/assets/javascripts/ace/snippets/haml.js +8 -1
  188. data/vendor/assets/javascripts/ace/snippets/handlebars.js +8 -6
  189. data/vendor/assets/javascripts/ace/snippets/haskell.js +8 -1
  190. data/vendor/assets/javascripts/ace/snippets/haskell_cabal.js +8 -6
  191. data/vendor/assets/javascripts/ace/snippets/haxe.js +8 -6
  192. data/vendor/assets/javascripts/ace/snippets/hjson.js +8 -6
  193. data/vendor/assets/javascripts/ace/snippets/html.js +36 -2
  194. data/vendor/assets/javascripts/ace/snippets/html_elixir.js +8 -6
  195. data/vendor/assets/javascripts/ace/snippets/html_ruby.js +8 -6
  196. data/vendor/assets/javascripts/ace/snippets/ini.js +8 -6
  197. data/vendor/assets/javascripts/ace/snippets/io.js +8 -1
  198. data/vendor/assets/javascripts/ace/snippets/jack.js +8 -6
  199. data/vendor/assets/javascripts/ace/snippets/jade.js +8 -6
  200. data/vendor/assets/javascripts/ace/snippets/java.js +8 -1
  201. data/vendor/assets/javascripts/ace/snippets/javascript.js +8 -1
  202. data/vendor/assets/javascripts/ace/snippets/json.js +8 -6
  203. data/vendor/assets/javascripts/ace/snippets/json5.js +9 -0
  204. data/vendor/assets/javascripts/ace/snippets/jsoniq.js +8 -1
  205. data/vendor/assets/javascripts/ace/snippets/jsp.js +8 -1
  206. data/vendor/assets/javascripts/ace/snippets/jssm.js +9 -0
  207. data/vendor/assets/javascripts/ace/snippets/jsx.js +8 -6
  208. data/vendor/assets/javascripts/ace/snippets/julia.js +8 -6
  209. data/vendor/assets/javascripts/ace/snippets/kotlin.js +8 -6
  210. data/vendor/assets/javascripts/ace/snippets/latex.js +8 -6
  211. data/vendor/assets/javascripts/ace/snippets/less.js +8 -6
  212. data/vendor/assets/javascripts/ace/snippets/liquid.js +890 -2
  213. data/vendor/assets/javascripts/ace/snippets/lisp.js +8 -6
  214. data/vendor/assets/javascripts/ace/snippets/livescript.js +8 -6
  215. data/vendor/assets/javascripts/ace/snippets/logiql.js +8 -6
  216. data/vendor/assets/javascripts/ace/snippets/logtalk.js +9 -0
  217. data/vendor/assets/javascripts/ace/snippets/lsl.js +8 -1
  218. data/vendor/assets/javascripts/ace/snippets/lua.js +8 -1
  219. data/vendor/assets/javascripts/ace/snippets/luapage.js +8 -6
  220. data/vendor/assets/javascripts/ace/snippets/lucene.js +8 -6
  221. data/vendor/assets/javascripts/ace/snippets/makefile.js +8 -1
  222. data/vendor/assets/javascripts/ace/snippets/markdown.js +8 -1
  223. data/vendor/assets/javascripts/ace/snippets/mask.js +8 -6
  224. data/vendor/assets/javascripts/ace/snippets/matlab.js +8 -6
  225. data/vendor/assets/javascripts/ace/snippets/maze.js +8 -1
  226. data/vendor/assets/javascripts/ace/snippets/mediawiki.js +9 -0
  227. data/vendor/assets/javascripts/ace/snippets/mel.js +8 -6
  228. data/vendor/assets/javascripts/ace/snippets/mixal.js +9 -0
  229. data/vendor/assets/javascripts/ace/snippets/mushcode.js +8 -6
  230. data/vendor/assets/javascripts/ace/snippets/mysql.js +8 -6
  231. data/vendor/assets/javascripts/ace/snippets/nginx.js +9 -0
  232. data/vendor/assets/javascripts/ace/snippets/nim.js +9 -0
  233. data/vendor/assets/javascripts/ace/snippets/nix.js +8 -6
  234. data/vendor/assets/javascripts/ace/snippets/nsis.js +8 -6
  235. data/vendor/assets/javascripts/ace/snippets/nunjucks.js +9 -0
  236. data/vendor/assets/javascripts/ace/snippets/objectivec.js +8 -6
  237. data/vendor/assets/javascripts/ace/snippets/ocaml.js +8 -6
  238. data/vendor/assets/javascripts/ace/snippets/pascal.js +8 -6
  239. data/vendor/assets/javascripts/ace/snippets/perl.js +8 -1
  240. data/vendor/assets/javascripts/ace/snippets/perl6.js +9 -0
  241. data/vendor/assets/javascripts/ace/snippets/pgsql.js +8 -6
  242. data/vendor/assets/javascripts/ace/snippets/php.js +49 -36
  243. data/vendor/assets/javascripts/ace/snippets/php_laravel_blade.js +9 -0
  244. data/vendor/assets/javascripts/ace/snippets/pig.js +8 -6
  245. data/vendor/assets/javascripts/ace/snippets/plain_text.js +8 -6
  246. data/vendor/assets/javascripts/ace/snippets/powershell.js +8 -6
  247. data/vendor/assets/javascripts/ace/snippets/praat.js +8 -6
  248. data/vendor/assets/javascripts/ace/snippets/prisma.js +9 -0
  249. data/vendor/assets/javascripts/ace/snippets/prolog.js +8 -6
  250. data/vendor/assets/javascripts/ace/snippets/properties.js +8 -6
  251. data/vendor/assets/javascripts/ace/snippets/protobuf.js +8 -6
  252. data/vendor/assets/javascripts/ace/snippets/puppet.js +9 -0
  253. data/vendor/assets/javascripts/ace/snippets/python.js +8 -1
  254. data/vendor/assets/javascripts/ace/snippets/qml.js +9 -0
  255. data/vendor/assets/javascripts/ace/snippets/r.js +8 -1
  256. data/vendor/assets/javascripts/ace/snippets/razor.js +8 -1
  257. data/vendor/assets/javascripts/ace/snippets/rdoc.js +8 -6
  258. data/vendor/assets/javascripts/ace/snippets/red.js +9 -0
  259. data/vendor/assets/javascripts/ace/snippets/redshift.js +9 -0
  260. data/vendor/assets/javascripts/ace/snippets/rhtml.js +8 -6
  261. data/vendor/assets/javascripts/ace/snippets/rst.js +8 -1
  262. data/vendor/assets/javascripts/ace/snippets/ruby.js +8 -1
  263. data/vendor/assets/javascripts/ace/snippets/rust.js +8 -6
  264. data/vendor/assets/javascripts/ace/snippets/sass.js +8 -6
  265. data/vendor/assets/javascripts/ace/snippets/scad.js +8 -6
  266. data/vendor/assets/javascripts/ace/snippets/scala.js +8 -6
  267. data/vendor/assets/javascripts/ace/snippets/scheme.js +8 -6
  268. data/vendor/assets/javascripts/ace/snippets/scss.js +8 -6
  269. data/vendor/assets/javascripts/ace/snippets/sh.js +8 -1
  270. data/vendor/assets/javascripts/ace/snippets/sjs.js +8 -6
  271. data/vendor/assets/javascripts/ace/snippets/slim.js +9 -0
  272. data/vendor/assets/javascripts/ace/snippets/smarty.js +8 -6
  273. data/vendor/assets/javascripts/ace/snippets/snippets.js +8 -1
  274. data/vendor/assets/javascripts/ace/snippets/soy_template.js +8 -6
  275. data/vendor/assets/javascripts/ace/snippets/space.js +8 -6
  276. data/vendor/assets/javascripts/ace/snippets/sparql.js +8 -6
  277. data/vendor/assets/javascripts/ace/snippets/sql.js +8 -1
  278. data/vendor/assets/javascripts/ace/snippets/sqlserver.js +8 -1
  279. data/vendor/assets/javascripts/ace/snippets/stylus.js +8 -6
  280. data/vendor/assets/javascripts/ace/snippets/svg.js +8 -6
  281. data/vendor/assets/javascripts/ace/snippets/swift.js +8 -6
  282. data/vendor/assets/javascripts/ace/snippets/tcl.js +8 -1
  283. data/vendor/assets/javascripts/ace/snippets/terraform.js +9 -0
  284. data/vendor/assets/javascripts/ace/snippets/tex.js +8 -1
  285. data/vendor/assets/javascripts/ace/snippets/text.js +8 -6
  286. data/vendor/assets/javascripts/ace/snippets/textile.js +8 -1
  287. data/vendor/assets/javascripts/ace/snippets/toml.js +8 -6
  288. data/vendor/assets/javascripts/ace/snippets/tsx.js +8 -6
  289. data/vendor/assets/javascripts/ace/snippets/turtle.js +8 -6
  290. data/vendor/assets/javascripts/ace/snippets/twig.js +8 -6
  291. data/vendor/assets/javascripts/ace/snippets/typescript.js +8 -6
  292. data/vendor/assets/javascripts/ace/snippets/vala.js +8 -1
  293. data/vendor/assets/javascripts/ace/snippets/vbscript.js +8 -6
  294. data/vendor/assets/javascripts/ace/snippets/velocity.js +8 -1
  295. data/vendor/assets/javascripts/ace/snippets/verilog.js +8 -6
  296. data/vendor/assets/javascripts/ace/snippets/vhdl.js +8 -6
  297. data/vendor/assets/javascripts/ace/snippets/visualforce.js +9 -0
  298. data/vendor/assets/javascripts/ace/snippets/wollok.js +8 -1
  299. data/vendor/assets/javascripts/ace/snippets/xml.js +8 -6
  300. data/vendor/assets/javascripts/ace/snippets/xquery.js +8 -1
  301. data/vendor/assets/javascripts/ace/snippets/yaml.js +8 -6
  302. data/vendor/assets/javascripts/ace/snippets/zeek.js +9 -0
  303. data/vendor/assets/javascripts/ace/theme-ambiance.js +3 -2
  304. data/vendor/assets/javascripts/ace/theme-chaos.js +1 -1
  305. data/vendor/assets/javascripts/ace/theme-nord_dark.js +102 -0
  306. data/vendor/assets/javascripts/ace/worker-base.js +1421 -0
  307. data/vendor/assets/javascripts/ace/worker-coffee.js +17 -703
  308. data/vendor/assets/javascripts/ace/worker-css.js +24 -704
  309. data/vendor/assets/javascripts/ace/worker-html.js +17 -703
  310. data/vendor/assets/javascripts/ace/worker-javascript.js +7833 -5352
  311. data/vendor/assets/javascripts/ace/worker-json.js +17 -703
  312. data/vendor/assets/javascripts/ace/worker-lua.js +17 -703
  313. data/vendor/assets/javascripts/ace/worker-php.js +859 -1477
  314. data/vendor/assets/javascripts/ace/worker-xml.js +26 -707
  315. data/vendor/assets/javascripts/ace/worker-xquery.js +17 -703
  316. metadata +50 -18
  317. data/vendor/assets/javascripts/ace/ext-chromevox.js +0 -540
  318. data/vendor/assets/javascripts/ace/ext-old_ie.js +0 -502
  319. data/vendor/assets/javascripts/ace/mode-bash.js +0 -247
  320. data/vendor/assets/javascripts/ace/mode-bro.js +0 -334
  321. data/vendor/assets/javascripts/ace/mode-lean.js +0 -281
  322. data/vendor/assets/javascripts/ace/mode-live_script.js +0 -481
  323. data/vendor/assets/javascripts/ace/mode-mips_assembler.js +0 -235
  324. data/vendor/assets/javascripts/ace/mode-mipsassembler.js +0 -196
  325. data/vendor/assets/javascripts/ace/mode-swig.js +0 -1099
  326. data/vendor/assets/javascripts/ace/snippets/bro.js +0 -7
  327. data/vendor/assets/javascripts/ace/snippets/lean.js +0 -7
  328. data/vendor/assets/javascripts/ace/snippets/live_script.js +0 -7
  329. data/vendor/assets/javascripts/ace/snippets/mips_assembler.js +0 -7
  330. data/vendor/assets/javascripts/ace/snippets/mipsassembler.js +0 -7
  331. data/vendor/assets/javascripts/ace/snippets/swig.js +0 -7
@@ -173,781 +173,8 @@ exportAce(ACE_NAMESPACE);
173
173
 
174
174
  })();
175
175
 
176
- define("ace/lib/regexp",["require","exports","module"], function(require, exports, module) {
176
+ define("ace/lib/fixoldbrowsers",["require","exports","module"], function(require, exports, module) {
177
177
  "use strict";
178
-
179
- var real = {
180
- exec: RegExp.prototype.exec,
181
- test: RegExp.prototype.test,
182
- match: String.prototype.match,
183
- replace: String.prototype.replace,
184
- split: String.prototype.split
185
- },
186
- compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
187
- compliantLastIndexIncrement = function () {
188
- var x = /^/g;
189
- real.test.call(x, "");
190
- return !x.lastIndex;
191
- }();
192
-
193
- if (compliantLastIndexIncrement && compliantExecNpcg)
194
- return;
195
- RegExp.prototype.exec = function (str) {
196
- var match = real.exec.apply(this, arguments),
197
- name, r2;
198
- if ( typeof(str) == 'string' && match) {
199
- if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
200
- r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
201
- real.replace.call(str.slice(match.index), r2, function () {
202
- for (var i = 1; i < arguments.length - 2; i++) {
203
- if (arguments[i] === undefined)
204
- match[i] = undefined;
205
- }
206
- });
207
- }
208
- if (this._xregexp && this._xregexp.captureNames) {
209
- for (var i = 1; i < match.length; i++) {
210
- name = this._xregexp.captureNames[i - 1];
211
- if (name)
212
- match[name] = match[i];
213
- }
214
- }
215
- if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
216
- this.lastIndex--;
217
- }
218
- return match;
219
- };
220
- if (!compliantLastIndexIncrement) {
221
- RegExp.prototype.test = function (str) {
222
- var match = real.exec.call(this, str);
223
- if (match && this.global && !match[0].length && (this.lastIndex > match.index))
224
- this.lastIndex--;
225
- return !!match;
226
- };
227
- }
228
-
229
- function getNativeFlags (regex) {
230
- return (regex.global ? "g" : "") +
231
- (regex.ignoreCase ? "i" : "") +
232
- (regex.multiline ? "m" : "") +
233
- (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
234
- (regex.sticky ? "y" : "");
235
- }
236
-
237
- function indexOf (array, item, from) {
238
- if (Array.prototype.indexOf) // Use the native array method if available
239
- return array.indexOf(item, from);
240
- for (var i = from || 0; i < array.length; i++) {
241
- if (array[i] === item)
242
- return i;
243
- }
244
- return -1;
245
- }
246
-
247
- });
248
-
249
- define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) {
250
-
251
- function Empty() {}
252
-
253
- if (!Function.prototype.bind) {
254
- Function.prototype.bind = function bind(that) { // .length is 1
255
- var target = this;
256
- if (typeof target != "function") {
257
- throw new TypeError("Function.prototype.bind called on incompatible " + target);
258
- }
259
- var args = slice.call(arguments, 1); // for normal call
260
- var bound = function () {
261
-
262
- if (this instanceof bound) {
263
-
264
- var result = target.apply(
265
- this,
266
- args.concat(slice.call(arguments))
267
- );
268
- if (Object(result) === result) {
269
- return result;
270
- }
271
- return this;
272
-
273
- } else {
274
- return target.apply(
275
- that,
276
- args.concat(slice.call(arguments))
277
- );
278
-
279
- }
280
-
281
- };
282
- if(target.prototype) {
283
- Empty.prototype = target.prototype;
284
- bound.prototype = new Empty();
285
- Empty.prototype = null;
286
- }
287
- return bound;
288
- };
289
- }
290
- var call = Function.prototype.call;
291
- var prototypeOfArray = Array.prototype;
292
- var prototypeOfObject = Object.prototype;
293
- var slice = prototypeOfArray.slice;
294
- var _toString = call.bind(prototypeOfObject.toString);
295
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
296
- var defineGetter;
297
- var defineSetter;
298
- var lookupGetter;
299
- var lookupSetter;
300
- var supportsAccessors;
301
- if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
302
- defineGetter = call.bind(prototypeOfObject.__defineGetter__);
303
- defineSetter = call.bind(prototypeOfObject.__defineSetter__);
304
- lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
305
- lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
306
- }
307
- if ([1,2].splice(0).length != 2) {
308
- if(function() { // test IE < 9 to splice bug - see issue #138
309
- function makeArray(l) {
310
- var a = new Array(l+2);
311
- a[0] = a[1] = 0;
312
- return a;
313
- }
314
- var array = [], lengthBefore;
315
-
316
- array.splice.apply(array, makeArray(20));
317
- array.splice.apply(array, makeArray(26));
318
-
319
- lengthBefore = array.length; //46
320
- array.splice(5, 0, "XXX"); // add one element
321
-
322
- lengthBefore + 1 == array.length
323
-
324
- if (lengthBefore + 1 == array.length) {
325
- return true;// has right splice implementation without bugs
326
- }
327
- }()) {//IE 6/7
328
- var array_splice = Array.prototype.splice;
329
- Array.prototype.splice = function(start, deleteCount) {
330
- if (!arguments.length) {
331
- return [];
332
- } else {
333
- return array_splice.apply(this, [
334
- start === void 0 ? 0 : start,
335
- deleteCount === void 0 ? (this.length - start) : deleteCount
336
- ].concat(slice.call(arguments, 2)))
337
- }
338
- };
339
- } else {//IE8
340
- Array.prototype.splice = function(pos, removeCount){
341
- var length = this.length;
342
- if (pos > 0) {
343
- if (pos > length)
344
- pos = length;
345
- } else if (pos == void 0) {
346
- pos = 0;
347
- } else if (pos < 0) {
348
- pos = Math.max(length + pos, 0);
349
- }
350
-
351
- if (!(pos+removeCount < length))
352
- removeCount = length - pos;
353
-
354
- var removed = this.slice(pos, pos+removeCount);
355
- var insert = slice.call(arguments, 2);
356
- var add = insert.length;
357
- if (pos === length) {
358
- if (add) {
359
- this.push.apply(this, insert);
360
- }
361
- } else {
362
- var remove = Math.min(removeCount, length - pos);
363
- var tailOldPos = pos + remove;
364
- var tailNewPos = tailOldPos + add - remove;
365
- var tailCount = length - tailOldPos;
366
- var lengthAfterRemove = length - remove;
367
-
368
- if (tailNewPos < tailOldPos) { // case A
369
- for (var i = 0; i < tailCount; ++i) {
370
- this[tailNewPos+i] = this[tailOldPos+i];
371
- }
372
- } else if (tailNewPos > tailOldPos) { // case B
373
- for (i = tailCount; i--; ) {
374
- this[tailNewPos+i] = this[tailOldPos+i];
375
- }
376
- } // else, add == remove (nothing to do)
377
-
378
- if (add && pos === lengthAfterRemove) {
379
- this.length = lengthAfterRemove; // truncate array
380
- this.push.apply(this, insert);
381
- } else {
382
- this.length = lengthAfterRemove + add; // reserves space
383
- for (i = 0; i < add; ++i) {
384
- this[pos+i] = insert[i];
385
- }
386
- }
387
- }
388
- return removed;
389
- };
390
- }
391
- }
392
- if (!Array.isArray) {
393
- Array.isArray = function isArray(obj) {
394
- return _toString(obj) == "[object Array]";
395
- };
396
- }
397
- var boxedString = Object("a"),
398
- splitString = boxedString[0] != "a" || !(0 in boxedString);
399
-
400
- if (!Array.prototype.forEach) {
401
- Array.prototype.forEach = function forEach(fun /*, thisp*/) {
402
- var object = toObject(this),
403
- self = splitString && _toString(this) == "[object String]" ?
404
- this.split("") :
405
- object,
406
- thisp = arguments[1],
407
- i = -1,
408
- length = self.length >>> 0;
409
- if (_toString(fun) != "[object Function]") {
410
- throw new TypeError(); // TODO message
411
- }
412
-
413
- while (++i < length) {
414
- if (i in self) {
415
- fun.call(thisp, self[i], i, object);
416
- }
417
- }
418
- };
419
- }
420
- if (!Array.prototype.map) {
421
- Array.prototype.map = function map(fun /*, thisp*/) {
422
- var object = toObject(this),
423
- self = splitString && _toString(this) == "[object String]" ?
424
- this.split("") :
425
- object,
426
- length = self.length >>> 0,
427
- result = Array(length),
428
- thisp = arguments[1];
429
- if (_toString(fun) != "[object Function]") {
430
- throw new TypeError(fun + " is not a function");
431
- }
432
-
433
- for (var i = 0; i < length; i++) {
434
- if (i in self)
435
- result[i] = fun.call(thisp, self[i], i, object);
436
- }
437
- return result;
438
- };
439
- }
440
- if (!Array.prototype.filter) {
441
- Array.prototype.filter = function filter(fun /*, thisp */) {
442
- var object = toObject(this),
443
- self = splitString && _toString(this) == "[object String]" ?
444
- this.split("") :
445
- object,
446
- length = self.length >>> 0,
447
- result = [],
448
- value,
449
- thisp = arguments[1];
450
- if (_toString(fun) != "[object Function]") {
451
- throw new TypeError(fun + " is not a function");
452
- }
453
-
454
- for (var i = 0; i < length; i++) {
455
- if (i in self) {
456
- value = self[i];
457
- if (fun.call(thisp, value, i, object)) {
458
- result.push(value);
459
- }
460
- }
461
- }
462
- return result;
463
- };
464
- }
465
- if (!Array.prototype.every) {
466
- Array.prototype.every = function every(fun /*, thisp */) {
467
- var object = toObject(this),
468
- self = splitString && _toString(this) == "[object String]" ?
469
- this.split("") :
470
- object,
471
- length = self.length >>> 0,
472
- thisp = arguments[1];
473
- if (_toString(fun) != "[object Function]") {
474
- throw new TypeError(fun + " is not a function");
475
- }
476
-
477
- for (var i = 0; i < length; i++) {
478
- if (i in self && !fun.call(thisp, self[i], i, object)) {
479
- return false;
480
- }
481
- }
482
- return true;
483
- };
484
- }
485
- if (!Array.prototype.some) {
486
- Array.prototype.some = function some(fun /*, thisp */) {
487
- var object = toObject(this),
488
- self = splitString && _toString(this) == "[object String]" ?
489
- this.split("") :
490
- object,
491
- length = self.length >>> 0,
492
- thisp = arguments[1];
493
- if (_toString(fun) != "[object Function]") {
494
- throw new TypeError(fun + " is not a function");
495
- }
496
-
497
- for (var i = 0; i < length; i++) {
498
- if (i in self && fun.call(thisp, self[i], i, object)) {
499
- return true;
500
- }
501
- }
502
- return false;
503
- };
504
- }
505
- if (!Array.prototype.reduce) {
506
- Array.prototype.reduce = function reduce(fun /*, initial*/) {
507
- var object = toObject(this),
508
- self = splitString && _toString(this) == "[object String]" ?
509
- this.split("") :
510
- object,
511
- length = self.length >>> 0;
512
- if (_toString(fun) != "[object Function]") {
513
- throw new TypeError(fun + " is not a function");
514
- }
515
- if (!length && arguments.length == 1) {
516
- throw new TypeError("reduce of empty array with no initial value");
517
- }
518
-
519
- var i = 0;
520
- var result;
521
- if (arguments.length >= 2) {
522
- result = arguments[1];
523
- } else {
524
- do {
525
- if (i in self) {
526
- result = self[i++];
527
- break;
528
- }
529
- if (++i >= length) {
530
- throw new TypeError("reduce of empty array with no initial value");
531
- }
532
- } while (true);
533
- }
534
-
535
- for (; i < length; i++) {
536
- if (i in self) {
537
- result = fun.call(void 0, result, self[i], i, object);
538
- }
539
- }
540
-
541
- return result;
542
- };
543
- }
544
- if (!Array.prototype.reduceRight) {
545
- Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
546
- var object = toObject(this),
547
- self = splitString && _toString(this) == "[object String]" ?
548
- this.split("") :
549
- object,
550
- length = self.length >>> 0;
551
- if (_toString(fun) != "[object Function]") {
552
- throw new TypeError(fun + " is not a function");
553
- }
554
- if (!length && arguments.length == 1) {
555
- throw new TypeError("reduceRight of empty array with no initial value");
556
- }
557
-
558
- var result, i = length - 1;
559
- if (arguments.length >= 2) {
560
- result = arguments[1];
561
- } else {
562
- do {
563
- if (i in self) {
564
- result = self[i--];
565
- break;
566
- }
567
- if (--i < 0) {
568
- throw new TypeError("reduceRight of empty array with no initial value");
569
- }
570
- } while (true);
571
- }
572
-
573
- do {
574
- if (i in this) {
575
- result = fun.call(void 0, result, self[i], i, object);
576
- }
577
- } while (i--);
578
-
579
- return result;
580
- };
581
- }
582
- if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
583
- Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
584
- var self = splitString && _toString(this) == "[object String]" ?
585
- this.split("") :
586
- toObject(this),
587
- length = self.length >>> 0;
588
-
589
- if (!length) {
590
- return -1;
591
- }
592
-
593
- var i = 0;
594
- if (arguments.length > 1) {
595
- i = toInteger(arguments[1]);
596
- }
597
- i = i >= 0 ? i : Math.max(0, length + i);
598
- for (; i < length; i++) {
599
- if (i in self && self[i] === sought) {
600
- return i;
601
- }
602
- }
603
- return -1;
604
- };
605
- }
606
- if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
607
- Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
608
- var self = splitString && _toString(this) == "[object String]" ?
609
- this.split("") :
610
- toObject(this),
611
- length = self.length >>> 0;
612
-
613
- if (!length) {
614
- return -1;
615
- }
616
- var i = length - 1;
617
- if (arguments.length > 1) {
618
- i = Math.min(i, toInteger(arguments[1]));
619
- }
620
- i = i >= 0 ? i : length - Math.abs(i);
621
- for (; i >= 0; i--) {
622
- if (i in self && sought === self[i]) {
623
- return i;
624
- }
625
- }
626
- return -1;
627
- };
628
- }
629
- if (!Object.getPrototypeOf) {
630
- Object.getPrototypeOf = function getPrototypeOf(object) {
631
- return object.__proto__ || (
632
- object.constructor ?
633
- object.constructor.prototype :
634
- prototypeOfObject
635
- );
636
- };
637
- }
638
- if (!Object.getOwnPropertyDescriptor) {
639
- var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
640
- "non-object: ";
641
- Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
642
- if ((typeof object != "object" && typeof object != "function") || object === null)
643
- throw new TypeError(ERR_NON_OBJECT + object);
644
- if (!owns(object, property))
645
- return;
646
-
647
- var descriptor, getter, setter;
648
- descriptor = { enumerable: true, configurable: true };
649
- if (supportsAccessors) {
650
- var prototype = object.__proto__;
651
- object.__proto__ = prototypeOfObject;
652
-
653
- var getter = lookupGetter(object, property);
654
- var setter = lookupSetter(object, property);
655
- object.__proto__ = prototype;
656
-
657
- if (getter || setter) {
658
- if (getter) descriptor.get = getter;
659
- if (setter) descriptor.set = setter;
660
- return descriptor;
661
- }
662
- }
663
- descriptor.value = object[property];
664
- return descriptor;
665
- };
666
- }
667
- if (!Object.getOwnPropertyNames) {
668
- Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
669
- return Object.keys(object);
670
- };
671
- }
672
- if (!Object.create) {
673
- var createEmpty;
674
- if (Object.prototype.__proto__ === null) {
675
- createEmpty = function () {
676
- return { "__proto__": null };
677
- };
678
- } else {
679
- createEmpty = function () {
680
- var empty = {};
681
- for (var i in empty)
682
- empty[i] = null;
683
- empty.constructor =
684
- empty.hasOwnProperty =
685
- empty.propertyIsEnumerable =
686
- empty.isPrototypeOf =
687
- empty.toLocaleString =
688
- empty.toString =
689
- empty.valueOf =
690
- empty.__proto__ = null;
691
- return empty;
692
- }
693
- }
694
-
695
- Object.create = function create(prototype, properties) {
696
- var object;
697
- if (prototype === null) {
698
- object = createEmpty();
699
- } else {
700
- if (typeof prototype != "object")
701
- throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
702
- var Type = function () {};
703
- Type.prototype = prototype;
704
- object = new Type();
705
- object.__proto__ = prototype;
706
- }
707
- if (properties !== void 0)
708
- Object.defineProperties(object, properties);
709
- return object;
710
- };
711
- }
712
-
713
- function doesDefinePropertyWork(object) {
714
- try {
715
- Object.defineProperty(object, "sentinel", {});
716
- return "sentinel" in object;
717
- } catch (exception) {
718
- }
719
- }
720
- if (Object.defineProperty) {
721
- var definePropertyWorksOnObject = doesDefinePropertyWork({});
722
- var definePropertyWorksOnDom = typeof document == "undefined" ||
723
- doesDefinePropertyWork(document.createElement("div"));
724
- if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
725
- var definePropertyFallback = Object.defineProperty;
726
- }
727
- }
728
-
729
- if (!Object.defineProperty || definePropertyFallback) {
730
- var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
731
- var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
732
- var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
733
- "on this javascript engine";
734
-
735
- Object.defineProperty = function defineProperty(object, property, descriptor) {
736
- if ((typeof object != "object" && typeof object != "function") || object === null)
737
- throw new TypeError(ERR_NON_OBJECT_TARGET + object);
738
- if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
739
- throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
740
- if (definePropertyFallback) {
741
- try {
742
- return definePropertyFallback.call(Object, object, property, descriptor);
743
- } catch (exception) {
744
- }
745
- }
746
- if (owns(descriptor, "value")) {
747
-
748
- if (supportsAccessors && (lookupGetter(object, property) ||
749
- lookupSetter(object, property)))
750
- {
751
- var prototype = object.__proto__;
752
- object.__proto__ = prototypeOfObject;
753
- delete object[property];
754
- object[property] = descriptor.value;
755
- object.__proto__ = prototype;
756
- } else {
757
- object[property] = descriptor.value;
758
- }
759
- } else {
760
- if (!supportsAccessors)
761
- throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
762
- if (owns(descriptor, "get"))
763
- defineGetter(object, property, descriptor.get);
764
- if (owns(descriptor, "set"))
765
- defineSetter(object, property, descriptor.set);
766
- }
767
-
768
- return object;
769
- };
770
- }
771
- if (!Object.defineProperties) {
772
- Object.defineProperties = function defineProperties(object, properties) {
773
- for (var property in properties) {
774
- if (owns(properties, property))
775
- Object.defineProperty(object, property, properties[property]);
776
- }
777
- return object;
778
- };
779
- }
780
- if (!Object.seal) {
781
- Object.seal = function seal(object) {
782
- return object;
783
- };
784
- }
785
- if (!Object.freeze) {
786
- Object.freeze = function freeze(object) {
787
- return object;
788
- };
789
- }
790
- try {
791
- Object.freeze(function () {});
792
- } catch (exception) {
793
- Object.freeze = (function freeze(freezeObject) {
794
- return function freeze(object) {
795
- if (typeof object == "function") {
796
- return object;
797
- } else {
798
- return freezeObject(object);
799
- }
800
- };
801
- })(Object.freeze);
802
- }
803
- if (!Object.preventExtensions) {
804
- Object.preventExtensions = function preventExtensions(object) {
805
- return object;
806
- };
807
- }
808
- if (!Object.isSealed) {
809
- Object.isSealed = function isSealed(object) {
810
- return false;
811
- };
812
- }
813
- if (!Object.isFrozen) {
814
- Object.isFrozen = function isFrozen(object) {
815
- return false;
816
- };
817
- }
818
- if (!Object.isExtensible) {
819
- Object.isExtensible = function isExtensible(object) {
820
- if (Object(object) === object) {
821
- throw new TypeError(); // TODO message
822
- }
823
- var name = '';
824
- while (owns(object, name)) {
825
- name += '?';
826
- }
827
- object[name] = true;
828
- var returnValue = owns(object, name);
829
- delete object[name];
830
- return returnValue;
831
- };
832
- }
833
- if (!Object.keys) {
834
- var hasDontEnumBug = true,
835
- dontEnums = [
836
- "toString",
837
- "toLocaleString",
838
- "valueOf",
839
- "hasOwnProperty",
840
- "isPrototypeOf",
841
- "propertyIsEnumerable",
842
- "constructor"
843
- ],
844
- dontEnumsLength = dontEnums.length;
845
-
846
- for (var key in {"toString": null}) {
847
- hasDontEnumBug = false;
848
- }
849
-
850
- Object.keys = function keys(object) {
851
-
852
- if (
853
- (typeof object != "object" && typeof object != "function") ||
854
- object === null
855
- ) {
856
- throw new TypeError("Object.keys called on a non-object");
857
- }
858
-
859
- var keys = [];
860
- for (var name in object) {
861
- if (owns(object, name)) {
862
- keys.push(name);
863
- }
864
- }
865
-
866
- if (hasDontEnumBug) {
867
- for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
868
- var dontEnum = dontEnums[i];
869
- if (owns(object, dontEnum)) {
870
- keys.push(dontEnum);
871
- }
872
- }
873
- }
874
- return keys;
875
- };
876
-
877
- }
878
- if (!Date.now) {
879
- Date.now = function now() {
880
- return new Date().getTime();
881
- };
882
- }
883
- var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
884
- "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
885
- "\u2029\uFEFF";
886
- if (!String.prototype.trim || ws.trim()) {
887
- ws = "[" + ws + "]";
888
- var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
889
- trimEndRegexp = new RegExp(ws + ws + "*$");
890
- String.prototype.trim = function trim() {
891
- return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
892
- };
893
- }
894
-
895
- function toInteger(n) {
896
- n = +n;
897
- if (n !== n) { // isNaN
898
- n = 0;
899
- } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
900
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
901
- }
902
- return n;
903
- }
904
-
905
- function isPrimitive(input) {
906
- var type = typeof input;
907
- return (
908
- input === null ||
909
- type === "undefined" ||
910
- type === "boolean" ||
911
- type === "number" ||
912
- type === "string"
913
- );
914
- }
915
-
916
- function toPrimitive(input) {
917
- var val, valueOf, toString;
918
- if (isPrimitive(input)) {
919
- return input;
920
- }
921
- valueOf = input.valueOf;
922
- if (typeof valueOf === "function") {
923
- val = valueOf.call(input);
924
- if (isPrimitive(val)) {
925
- return val;
926
- }
927
- }
928
- toString = input.toString;
929
- if (typeof toString === "function") {
930
- val = toString.call(input);
931
- if (isPrimitive(val)) {
932
- return val;
933
- }
934
- }
935
- throw new TypeError();
936
- }
937
- var toObject = function (o) {
938
- if (o == null) { // this matches both null and undefined
939
- throw new TypeError("can't convert "+o+" to object");
940
- }
941
- return Object(o);
942
- };
943
-
944
- });
945
-
946
- define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"], function(require, exports, module) {
947
- "use strict";
948
-
949
- require("./regexp");
950
- require("./es5-shim");
951
178
  if (typeof Element != "undefined" && !Element.prototype.remove) {
952
179
  Object.defineProperty(Element.prototype, "remove", {
953
180
  enumerable: false,
@@ -976,22 +203,22 @@ exports.getOS = function() {
976
203
  return exports.OS.WINDOWS;
977
204
  }
978
205
  };
979
- if (typeof navigator != "object")
980
- return;
206
+ var _navigator = typeof navigator == "object" ? navigator : {};
981
207
 
982
- var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
983
- var ua = navigator.userAgent;
208
+ var os = (/mac|win|linux/i.exec(_navigator.platform) || ["other"])[0].toLowerCase();
209
+ var ua = _navigator.userAgent || "";
210
+ var appName = _navigator.appName || "";
984
211
  exports.isWin = (os == "win");
985
212
  exports.isMac = (os == "mac");
986
213
  exports.isLinux = (os == "linux");
987
214
  exports.isIE =
988
- (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
215
+ (appName == "Microsoft Internet Explorer" || appName.indexOf("MSAppHost") >= 0)
989
216
  ? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1])
990
217
  : parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]); // for ie
991
218
 
992
219
  exports.isOldIE = exports.isIE && exports.isIE < 9;
993
220
  exports.isGecko = exports.isMozilla = ua.match(/ Gecko\/\d+/);
994
- exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
221
+ exports.isOpera = typeof opera == "object" && Object.prototype.toString.call(window.opera) == "[object Opera]";
995
222
  exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
996
223
 
997
224
  exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
@@ -1000,8 +227,6 @@ exports.isEdge = parseFloat(ua.split(" Edge/")[1]) || undefined;
1000
227
 
1001
228
  exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
1002
229
 
1003
- exports.isIPad = ua.indexOf("iPad") >= 0;
1004
-
1005
230
  exports.isAndroid = ua.indexOf("Android") >= 0;
1006
231
 
1007
232
  exports.isChromeOS = ua.indexOf(" CrOS ") >= 0;
@@ -1010,7 +235,7 @@ exports.isIOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream;
1010
235
 
1011
236
  if (exports.isIOS) exports.isMac = true;
1012
237
 
1013
- exports.isMobile = exports.isIPad || exports.isAndroid;
238
+ exports.isMobile = exports.isIOS || exports.isAndroid;
1014
239
 
1015
240
  });
1016
241
 
@@ -1028,8 +253,11 @@ exports.buildDom = function buildDom(arr, parent, refs) {
1028
253
  return txt;
1029
254
  }
1030
255
 
1031
- if (!Array.isArray(arr))
256
+ if (!Array.isArray(arr)) {
257
+ if (arr && arr.appendChild && parent)
258
+ parent.appendChild(arr);
1032
259
  return arr;
260
+ }
1033
261
  if (typeof arr[0] != "string" || !arr[0]) {
1034
262
  var els = [];
1035
263
  for (var i = 0; i < arr.length; i++) {
@@ -1051,7 +279,7 @@ exports.buildDom = function buildDom(arr, parent, refs) {
1051
279
  var val = options[n];
1052
280
  if (n === "class") {
1053
281
  el.className = Array.isArray(val) ? val.join(" ") : val;
1054
- } else if (typeof val == "function" || n == "value") {
282
+ } else if (typeof val == "function" || n == "value" || n[0] == "$") {
1055
283
  el[n] = val;
1056
284
  } else if (n === "ref") {
1057
285
  if (refs) refs[val] = el;
@@ -1290,12 +518,14 @@ var oop = require("./oop");
1290
518
  var Keys = (function() {
1291
519
  var ret = {
1292
520
  MODIFIER_KEYS: {
1293
- 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
521
+ 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta',
522
+ 91: 'MetaLeft', 92: 'MetaRight', 93: 'ContextMenu'
1294
523
  },
1295
524
 
1296
525
  KEY_MODS: {
1297
526
  "ctrl": 1, "alt": 2, "option" : 2, "shift": 4,
1298
- "super": 8, "meta": 8, "command": 8, "cmd": 8
527
+ "super": 8, "meta": 8, "command": 8, "cmd": 8,
528
+ "control": 1
1299
529
  },
1300
530
 
1301
531
  FUNCTION_KEYS : {
@@ -1405,26 +635,42 @@ var useragent = require("./useragent");
1405
635
  var pressedKeys = null;
1406
636
  var ts = 0;
1407
637
 
1408
- exports.addListener = function(elem, type, callback) {
1409
- if (elem.addEventListener) {
1410
- return elem.addEventListener(type, callback, false);
1411
- }
1412
- if (elem.attachEvent) {
1413
- var wrapper = function() {
1414
- callback.call(elem, window.event);
1415
- };
1416
- callback._wrapper = wrapper;
1417
- elem.attachEvent("on" + type, wrapper);
1418
- }
638
+ var activeListenerOptions;
639
+ function detectListenerOptionsSupport() {
640
+ activeListenerOptions = false;
641
+ try {
642
+ document.createComment("").addEventListener("test", function() {}, {
643
+ get passive() {
644
+ activeListenerOptions = {passive: false};
645
+ }
646
+ });
647
+ } catch(e) {}
648
+ }
649
+
650
+ function getListenerOptions() {
651
+ if (activeListenerOptions == undefined)
652
+ detectListenerOptionsSupport();
653
+ return activeListenerOptions;
654
+ }
655
+
656
+ function EventListener(elem, type, callback) {
657
+ this.elem = elem;
658
+ this.type = type;
659
+ this.callback = callback;
660
+ }
661
+ EventListener.prototype.destroy = function() {
662
+ removeListener(this.elem, this.type, this.callback);
663
+ this.elem = this.type = this.callback = undefined;
1419
664
  };
1420
665
 
1421
- exports.removeListener = function(elem, type, callback) {
1422
- if (elem.removeEventListener) {
1423
- return elem.removeEventListener(type, callback, false);
1424
- }
1425
- if (elem.detachEvent) {
1426
- elem.detachEvent("on" + type, callback._wrapper || callback);
1427
- }
666
+ var addListener = exports.addListener = function(elem, type, callback, destroyer) {
667
+ elem.addEventListener(type, callback, getListenerOptions());
668
+ if (destroyer)
669
+ destroyer.$toDestroy.push(new EventListener(elem, type, callback));
670
+ };
671
+
672
+ var removeListener = exports.removeListener = function(elem, type, callback) {
673
+ elem.removeEventListener(type, callback, getListenerOptions());
1428
674
  };
1429
675
  exports.stopEvent = function(e) {
1430
676
  exports.stopPropagation(e);
@@ -1435,73 +681,41 @@ exports.stopEvent = function(e) {
1435
681
  exports.stopPropagation = function(e) {
1436
682
  if (e.stopPropagation)
1437
683
  e.stopPropagation();
1438
- else
1439
- e.cancelBubble = true;
1440
684
  };
1441
685
 
1442
686
  exports.preventDefault = function(e) {
1443
687
  if (e.preventDefault)
1444
688
  e.preventDefault();
1445
- else
1446
- e.returnValue = false;
1447
689
  };
1448
690
  exports.getButton = function(e) {
1449
691
  if (e.type == "dblclick")
1450
692
  return 0;
1451
693
  if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
1452
694
  return 2;
1453
- if (e.preventDefault) {
1454
- return e.button;
1455
- }
1456
- else {
1457
- return {1:0, 2:2, 4:1}[e.button];
1458
- }
695
+ return e.button;
1459
696
  };
1460
697
 
1461
698
  exports.capture = function(el, eventHandler, releaseCaptureHandler) {
699
+ var ownerDocument = el && el.ownerDocument || document;
1462
700
  function onMouseUp(e) {
1463
701
  eventHandler && eventHandler(e);
1464
702
  releaseCaptureHandler && releaseCaptureHandler(e);
1465
703
 
1466
- exports.removeListener(document, "mousemove", eventHandler, true);
1467
- exports.removeListener(document, "mouseup", onMouseUp, true);
1468
- exports.removeListener(document, "dragstart", onMouseUp, true);
704
+ removeListener(ownerDocument, "mousemove", eventHandler);
705
+ removeListener(ownerDocument, "mouseup", onMouseUp);
706
+ removeListener(ownerDocument, "dragstart", onMouseUp);
1469
707
  }
1470
708
 
1471
- exports.addListener(document, "mousemove", eventHandler, true);
1472
- exports.addListener(document, "mouseup", onMouseUp, true);
1473
- exports.addListener(document, "dragstart", onMouseUp, true);
709
+ addListener(ownerDocument, "mousemove", eventHandler);
710
+ addListener(ownerDocument, "mouseup", onMouseUp);
711
+ addListener(ownerDocument, "dragstart", onMouseUp);
1474
712
 
1475
713
  return onMouseUp;
1476
714
  };
1477
715
 
1478
- exports.addTouchMoveListener = function (el, callback) {
1479
- var startx, starty;
1480
- exports.addListener(el, "touchstart", function (e) {
1481
- var touches = e.touches;
1482
- var touchObj = touches[0];
1483
- startx = touchObj.clientX;
1484
- starty = touchObj.clientY;
1485
- });
1486
- exports.addListener(el, "touchmove", function (e) {
1487
- var touches = e.touches;
1488
- if (touches.length > 1) return;
1489
-
1490
- var touchObj = touches[0];
1491
-
1492
- e.wheelX = startx - touchObj.clientX;
1493
- e.wheelY = starty - touchObj.clientY;
1494
-
1495
- startx = touchObj.clientX;
1496
- starty = touchObj.clientY;
1497
-
1498
- callback(e);
1499
- });
1500
- };
1501
-
1502
- exports.addMouseWheelListener = function(el, callback) {
716
+ exports.addMouseWheelListener = function(el, callback, destroyer) {
1503
717
  if ("onmousewheel" in el) {
1504
- exports.addListener(el, "mousewheel", function(e) {
718
+ addListener(el, "mousewheel", function(e) {
1505
719
  var factor = 8;
1506
720
  if (e.wheelDeltaX !== undefined) {
1507
721
  e.wheelX = -e.wheelDeltaX / factor;
@@ -1511,9 +725,9 @@ exports.addMouseWheelListener = function(el, callback) {
1511
725
  e.wheelY = -e.wheelDelta / factor;
1512
726
  }
1513
727
  callback(e);
1514
- });
728
+ }, destroyer);
1515
729
  } else if ("onwheel" in el) {
1516
- exports.addListener(el, "wheel", function(e) {
730
+ addListener(el, "wheel", function(e) {
1517
731
  var factor = 0.35;
1518
732
  switch (e.deltaMode) {
1519
733
  case e.DOM_DELTA_PIXEL:
@@ -1528,9 +742,9 @@ exports.addMouseWheelListener = function(el, callback) {
1528
742
  }
1529
743
 
1530
744
  callback(e);
1531
- });
745
+ }, destroyer);
1532
746
  } else {
1533
- exports.addListener(el, "DOMMouseScroll", function(e) {
747
+ addListener(el, "DOMMouseScroll", function(e) {
1534
748
  if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
1535
749
  e.wheelX = (e.detail || 0) * 5;
1536
750
  e.wheelY = 0;
@@ -1539,11 +753,11 @@ exports.addMouseWheelListener = function(el, callback) {
1539
753
  e.wheelY = (e.detail || 0) * 5;
1540
754
  }
1541
755
  callback(e);
1542
- });
756
+ }, destroyer);
1543
757
  }
1544
758
  };
1545
759
 
1546
- exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) {
760
+ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) {
1547
761
  var clicks = 0;
1548
762
  var startX, startY, timer;
1549
763
  var eventNames = {
@@ -1585,30 +799,16 @@ exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, c
1585
799
  else if (clicks > 1)
1586
800
  return eventHandler[callbackName](eventNames[clicks], e);
1587
801
  }
1588
- function onDblclick(e) {
1589
- clicks = 2;
1590
- if (timer)
1591
- clearTimeout(timer);
1592
- timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600);
1593
- eventHandler[callbackName]("mousedown", e);
1594
- eventHandler[callbackName](eventNames[clicks], e);
1595
- }
1596
802
  if (!Array.isArray(elements))
1597
803
  elements = [elements];
1598
804
  elements.forEach(function(el) {
1599
- exports.addListener(el, "mousedown", onMousedown);
1600
- if (useragent.isOldIE)
1601
- exports.addListener(el, "dblclick", onDblclick);
805
+ addListener(el, "mousedown", onMousedown, destroyer);
1602
806
  });
1603
807
  };
1604
808
 
1605
- var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window)
1606
- ? function(e) {
1607
- return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
1608
- }
1609
- : function(e) {
1610
- return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
1611
- };
809
+ var getModifierHash = function(e) {
810
+ return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
811
+ };
1612
812
 
1613
813
  exports.getModifierString = function(e) {
1614
814
  return keys.KEY_MODS[getModifierHash(e)];
@@ -1642,9 +842,6 @@ function normalizeCommandKeys(callback, e, keyCode) {
1642
842
  if (keyCode in keys.MODIFIER_KEYS) {
1643
843
  keyCode = -1;
1644
844
  }
1645
- if (hashId & 8 && (keyCode >= 91 && keyCode <= 93)) {
1646
- keyCode = -1;
1647
- }
1648
845
 
1649
846
  if (!hashId && keyCode === 13) {
1650
847
  var location = "location" in e ? e.location : e.keyLocation;
@@ -1670,16 +867,15 @@ function normalizeCommandKeys(callback, e, keyCode) {
1670
867
  }
1671
868
 
1672
869
 
1673
- exports.addCommandKeyListener = function(el, callback) {
1674
- var addListener = exports.addListener;
870
+ exports.addCommandKeyListener = function(el, callback, destroyer) {
1675
871
  if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
1676
872
  var lastKeyDownKeyCode = null;
1677
873
  addListener(el, "keydown", function(e) {
1678
874
  lastKeyDownKeyCode = e.keyCode;
1679
- });
875
+ }, destroyer);
1680
876
  addListener(el, "keypress", function(e) {
1681
877
  return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
1682
- });
878
+ }, destroyer);
1683
879
  } else {
1684
880
  var lastDefaultPrevented = null;
1685
881
 
@@ -1688,18 +884,18 @@ exports.addCommandKeyListener = function(el, callback) {
1688
884
  var result = normalizeCommandKeys(callback, e, e.keyCode);
1689
885
  lastDefaultPrevented = e.defaultPrevented;
1690
886
  return result;
1691
- });
887
+ }, destroyer);
1692
888
 
1693
889
  addListener(el, "keypress", function(e) {
1694
890
  if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {
1695
891
  exports.stopEvent(e);
1696
892
  lastDefaultPrevented = null;
1697
893
  }
1698
- });
894
+ }, destroyer);
1699
895
 
1700
896
  addListener(el, "keyup", function(e) {
1701
897
  pressedKeys[e.keyCode] = null;
1702
- });
898
+ }, destroyer);
1703
899
 
1704
900
  if (!pressedKeys) {
1705
901
  resetPressedKeys();
@@ -1720,12 +916,12 @@ if (typeof window == "object" && window.postMessage && !useragent.isOldIE) {
1720
916
  var listener = function(e) {
1721
917
  if (e.data == messageName) {
1722
918
  exports.stopPropagation(e);
1723
- exports.removeListener(win, "message", listener);
919
+ removeListener(win, "message", listener);
1724
920
  callback();
1725
921
  }
1726
922
  };
1727
923
 
1728
- exports.addListener(win, "message", listener);
924
+ addListener(win, "message", listener);
1729
925
  win.postMessage(messageName, "*");
1730
926
  };
1731
927
  }
@@ -2193,13 +1389,32 @@ exports.delayedCall = function(fcn, defaultTimeout) {
2193
1389
  };
2194
1390
  });
2195
1391
 
2196
- define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/lib/keys"], function(require, exports, module) {
1392
+ define("ace/clipboard",["require","exports","module"], function(require, exports, module) {
1393
+ "use strict";
1394
+
1395
+ var $cancelT;
1396
+ module.exports = {
1397
+ lineMode: false,
1398
+ pasteCancelled: function() {
1399
+ if ($cancelT && $cancelT > Date.now() - 50)
1400
+ return true;
1401
+ return $cancelT = false;
1402
+ },
1403
+ cancel: function() {
1404
+ $cancelT = Date.now();
1405
+ }
1406
+ };
1407
+
1408
+ });
1409
+
1410
+ define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"], function(require, exports, module) {
2197
1411
  "use strict";
2198
1412
 
2199
1413
  var event = require("../lib/event");
2200
1414
  var useragent = require("../lib/useragent");
2201
1415
  var dom = require("../lib/dom");
2202
1416
  var lang = require("../lib/lang");
1417
+ var clipboard = require("../clipboard");
2203
1418
  var BROKEN_SETDATA = useragent.isChrome < 18;
2204
1419
  var USE_IE_MIME_TYPE = useragent.isIE;
2205
1420
  var HAS_FOCUS_ARGS = useragent.isChrome > 63;
@@ -2209,6 +1424,7 @@ var KEYS = require("../lib/keys");
2209
1424
  var MODS = KEYS.KEY_MODS;
2210
1425
  var isIOS = useragent.isIOS;
2211
1426
  var valueResetRegex = isIOS ? /\s/ : /\n/;
1427
+ var isMobile = useragent.isMobile;
2212
1428
 
2213
1429
  var TextInput = function(parentNode, host) {
2214
1430
  var text = dom.createElement("textarea");
@@ -2227,10 +1443,8 @@ var TextInput = function(parentNode, host) {
2227
1443
  var inComposition = false;
2228
1444
  var sendingText = false;
2229
1445
  var tempStyle = '';
2230
- var isSelectionEmpty = true;
2231
- var copyWithEmptySelection = false;
2232
1446
 
2233
- if (!useragent.isMobile)
1447
+ if (!isMobile)
2234
1448
  text.style.fontSize = "1px";
2235
1449
 
2236
1450
  var commandMode = false;
@@ -2239,13 +1453,14 @@ var TextInput = function(parentNode, host) {
2239
1453
  var lastValue = "";
2240
1454
  var lastSelectionStart = 0;
2241
1455
  var lastSelectionEnd = 0;
1456
+ var lastRestoreEnd = 0;
2242
1457
  try { var isFocused = document.activeElement === text; } catch(e) {}
2243
1458
 
2244
1459
  event.addListener(text, "blur", function(e) {
2245
1460
  if (ignoreFocusEvents) return;
2246
1461
  host.onBlur(e);
2247
1462
  isFocused = false;
2248
- });
1463
+ }, host);
2249
1464
  event.addListener(text, "focus", function(e) {
2250
1465
  if (ignoreFocusEvents) return;
2251
1466
  isFocused = true;
@@ -2260,7 +1475,7 @@ var TextInput = function(parentNode, host) {
2260
1475
  setTimeout(resetSelection);
2261
1476
  else
2262
1477
  resetSelection();
2263
- });
1478
+ }, host);
2264
1479
  this.$focusScroll = false;
2265
1480
  this.focus = function() {
2266
1481
  if (tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser")
@@ -2306,9 +1521,12 @@ var TextInput = function(parentNode, host) {
2306
1521
  };
2307
1522
 
2308
1523
  host.on("beforeEndOperation", function() {
2309
- if (host.curOp && host.curOp.command.name == "insertstring")
1524
+ var curOp = host.curOp;
1525
+ var commandName = curOp && curOp.command && curOp.command.name;
1526
+ if (commandName == "insertstring")
2310
1527
  return;
2311
- if (inComposition) {
1528
+ var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged);
1529
+ if (inComposition && isUserAction) {
2312
1530
  lastValue = text.value = "";
2313
1531
  onCompositionEnd();
2314
1532
  }
@@ -2317,7 +1535,7 @@ var TextInput = function(parentNode, host) {
2317
1535
 
2318
1536
  var resetSelection = isIOS
2319
1537
  ? function(value) {
2320
- if (!isFocused || (copied && !value)) return;
1538
+ if (!isFocused || (copied && !value) || sendingText) return;
2321
1539
  if (!value)
2322
1540
  value = "";
2323
1541
  var newValue = "\n ab" + value + "cde fg\n";
@@ -2340,33 +1558,49 @@ var TextInput = function(parentNode, host) {
2340
1558
  return;
2341
1559
  inComposition = true;
2342
1560
 
2343
- var selection = host.selection;
2344
- var range = selection.getRange();
2345
- var row = selection.cursor.row;
2346
- var selectionStart = range.start.column;
2347
- var selectionEnd = range.end.column;
2348
- var line = host.session.getLine(row);
2349
-
2350
- if (range.start.row != row) {
2351
- var prevLine = host.session.getLine(row - 1);
2352
- selectionStart = range.start.row < row - 1 ? 0 : selectionStart;
2353
- selectionEnd += prevLine.length + 1;
2354
- line = prevLine + "\n" + line;
2355
- }
2356
- else if (range.end.row != row) {
2357
- var nextLine = host.session.getLine(row + 1);
2358
- selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd;
2359
- selectionEnd += line.length + 1;
2360
- line = line + "\n" + nextLine;
2361
- }
2362
-
2363
- if (line.length > MAX_LINE_LENGTH) {
2364
- if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) {
2365
- line = line.slice(0, MAX_LINE_LENGTH);
2366
- } else {
2367
- line = "\n";
2368
- selectionStart = 0;
2369
- selectionEnd = 1;
1561
+ var selectionStart = 0;
1562
+ var selectionEnd = 0;
1563
+ var line = "";
1564
+
1565
+ if (host.session) {
1566
+ var selection = host.selection;
1567
+ var range = selection.getRange();
1568
+ var row = selection.cursor.row;
1569
+ selectionStart = range.start.column;
1570
+ selectionEnd = range.end.column;
1571
+ line = host.session.getLine(row);
1572
+
1573
+ if (range.start.row != row) {
1574
+ var prevLine = host.session.getLine(row - 1);
1575
+ selectionStart = range.start.row < row - 1 ? 0 : selectionStart;
1576
+ selectionEnd += prevLine.length + 1;
1577
+ line = prevLine + "\n" + line;
1578
+ }
1579
+ else if (range.end.row != row) {
1580
+ var nextLine = host.session.getLine(row + 1);
1581
+ selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd;
1582
+ selectionEnd += line.length + 1;
1583
+ line = line + "\n" + nextLine;
1584
+ }
1585
+ else if (isMobile && row > 0) {
1586
+ line = "\n" + line;
1587
+ selectionEnd += 1;
1588
+ selectionStart += 1;
1589
+ }
1590
+
1591
+ if (line.length > MAX_LINE_LENGTH) {
1592
+ if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) {
1593
+ line = line.slice(0, MAX_LINE_LENGTH);
1594
+ } else {
1595
+ line = "\n";
1596
+ if (selectionStart == selectionEnd) {
1597
+ selectionStart = selectionEnd = 0;
1598
+ }
1599
+ else {
1600
+ selectionStart = 0;
1601
+ selectionEnd = 1;
1602
+ }
1603
+ }
2370
1604
  }
2371
1605
  }
2372
1606
 
@@ -2392,6 +1626,7 @@ var TextInput = function(parentNode, host) {
2392
1626
  }
2393
1627
  inComposition = false;
2394
1628
  };
1629
+ this.resetSelection = resetSelection;
2395
1630
 
2396
1631
  if (isFocused)
2397
1632
  host.onFocus();
@@ -2411,6 +1646,8 @@ var TextInput = function(parentNode, host) {
2411
1646
  } else if (isAllSelected(text)) {
2412
1647
  host.selectAll();
2413
1648
  resetSelection();
1649
+ } else if (isMobile && text.selectionStart != lastSelectionStart) {
1650
+ resetSelection();
2414
1651
  }
2415
1652
  };
2416
1653
 
@@ -2452,11 +1689,21 @@ var TextInput = function(parentNode, host) {
2452
1689
  }
2453
1690
  restoreStart -= i-1;
2454
1691
  restoreEnd -= i-1;
2455
- inserted = inserted.slice(0, inserted.length - i+1);
2456
- if (!fromInput && restoreStart == inserted.length && !extendLeft && !extendRight && !restoreEnd)
1692
+ var endIndex = inserted.length - i + 1;
1693
+ if (endIndex < 0) {
1694
+ extendLeft = -endIndex;
1695
+ endIndex = 0;
1696
+ }
1697
+ inserted = inserted.slice(0, endIndex);
1698
+ if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd)
2457
1699
  return "";
2458
-
2459
1700
  sendingText = true;
1701
+ var shouldReset = false;
1702
+ if (useragent.isAndroid && inserted == ". ") {
1703
+ inserted = " ";
1704
+ shouldReset = true;
1705
+ }
1706
+
2460
1707
  if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) {
2461
1708
  host.onTextInput(inserted);
2462
1709
  } else {
@@ -2472,16 +1719,26 @@ var TextInput = function(parentNode, host) {
2472
1719
  lastValue = value;
2473
1720
  lastSelectionStart = selectionStart;
2474
1721
  lastSelectionEnd = selectionEnd;
2475
- return inserted;
1722
+ lastRestoreEnd = restoreEnd;
1723
+ return shouldReset ? "\n" : inserted;
2476
1724
  }
2477
1725
  };
2478
1726
  var onInput = function(e) {
2479
1727
  if (inComposition)
2480
1728
  return onCompositionUpdate();
1729
+ if (e && e.inputType) {
1730
+ if (e.inputType == "historyUndo") return host.execCommand("undo");
1731
+ if (e.inputType == "historyRedo") return host.execCommand("redo");
1732
+ }
2481
1733
  var data = text.value;
2482
1734
  var inserted = sendText(data, true);
2483
- if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted))
1735
+ if (
1736
+ data.length > MAX_LINE_LENGTH + 100
1737
+ || valueResetRegex.test(inserted)
1738
+ || isMobile && lastSelectionStart < 1 && lastSelectionStart == lastSelectionEnd
1739
+ ) {
2484
1740
  resetSelection();
1741
+ }
2485
1742
  };
2486
1743
 
2487
1744
  var handleClipboardData = function(e, data, forceIEMime) {
@@ -2538,6 +1795,8 @@ var TextInput = function(parentNode, host) {
2538
1795
 
2539
1796
  var onPaste = function(e) {
2540
1797
  var data = handleClipboardData(e);
1798
+ if (clipboard.pasteCancelled())
1799
+ return;
2541
1800
  if (typeof data == "string") {
2542
1801
  if (data)
2543
1802
  host.onPaste(data, e);
@@ -2551,14 +1810,14 @@ var TextInput = function(parentNode, host) {
2551
1810
  }
2552
1811
  };
2553
1812
 
2554
- event.addCommandKeyListener(text, host.onCommandKey.bind(host));
1813
+ event.addCommandKeyListener(text, host.onCommandKey.bind(host), host);
2555
1814
 
2556
- event.addListener(text, "select", onSelect);
2557
- event.addListener(text, "input", onInput);
1815
+ event.addListener(text, "select", onSelect, host);
1816
+ event.addListener(text, "input", onInput, host);
2558
1817
 
2559
- event.addListener(text, "cut", onCut);
2560
- event.addListener(text, "copy", onCopy);
2561
- event.addListener(text, "paste", onPaste);
1818
+ event.addListener(text, "cut", onCut, host);
1819
+ event.addListener(text, "copy", onCopy, host);
1820
+ event.addListener(text, "paste", onPaste, host);
2562
1821
  if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) {
2563
1822
  event.addListener(parentNode, "keydown", function(e) {
2564
1823
  if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
@@ -2575,7 +1834,7 @@ var TextInput = function(parentNode, host) {
2575
1834
  onCut(e);
2576
1835
  break;
2577
1836
  }
2578
- });
1837
+ }, host);
2579
1838
  }
2580
1839
  var onCompositionStart = function(e) {
2581
1840
  if (inComposition || !host.onCompositionStart || host.$readOnly)
@@ -2586,7 +1845,11 @@ var TextInput = function(parentNode, host) {
2586
1845
  if (commandMode)
2587
1846
  return;
2588
1847
 
1848
+ if (e.data)
1849
+ inComposition.useTextareaForIME = false;
1850
+
2589
1851
  setTimeout(onCompositionUpdate, 0);
1852
+ host._signal("compositionStart");
2590
1853
  host.on("mousedown", cancelComposition);
2591
1854
 
2592
1855
  var range = host.getSelectionRange();
@@ -2597,8 +1860,7 @@ var TextInput = function(parentNode, host) {
2597
1860
  host.onCompositionStart(inComposition);
2598
1861
 
2599
1862
  if (inComposition.useTextareaForIME) {
2600
- text.value = "";
2601
- lastValue = "";
1863
+ lastValue = text.value = "";
2602
1864
  lastSelectionStart = 0;
2603
1865
  lastSelectionEnd = 0;
2604
1866
  }
@@ -2628,7 +1890,7 @@ var TextInput = function(parentNode, host) {
2628
1890
  = inComposition.context.compositionStartOffset;
2629
1891
  }
2630
1892
  inComposition.markerRange.end.column = inComposition.markerRange.start.column
2631
- + lastSelectionEnd - inComposition.selectionStart;
1893
+ + lastSelectionEnd - inComposition.selectionStart + lastRestoreEnd;
2632
1894
  }
2633
1895
  }
2634
1896
  };
@@ -2661,11 +1923,11 @@ var TextInput = function(parentNode, host) {
2661
1923
  syncComposition();
2662
1924
  }
2663
1925
 
2664
- event.addListener(text, "compositionstart", onCompositionStart);
2665
- event.addListener(text, "compositionupdate", onCompositionUpdate);
2666
- event.addListener(text, "keyup", onKeyup);
2667
- event.addListener(text, "keydown", syncComposition);
2668
- event.addListener(text, "compositionend", onCompositionEnd);
1926
+ event.addListener(text, "compositionstart", onCompositionStart, host);
1927
+ event.addListener(text, "compositionupdate", onCompositionUpdate, host);
1928
+ event.addListener(text, "keyup", onKeyup, host);
1929
+ event.addListener(text, "keydown", syncComposition, host);
1930
+ event.addListener(text, "compositionend", onCompositionEnd, host);
2669
1931
 
2670
1932
  this.getElement = function() {
2671
1933
  return text;
@@ -2681,7 +1943,6 @@ var TextInput = function(parentNode, host) {
2681
1943
  };
2682
1944
 
2683
1945
  this.setCopyWithEmptySelection = function(value) {
2684
- copyWithEmptySelection = value;
2685
1946
  };
2686
1947
 
2687
1948
  this.onContextMenu = function(e) {
@@ -2704,16 +1965,14 @@ var TextInput = function(parentNode, host) {
2704
1965
  var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
2705
1966
  var maxTop = rect.bottom - top - text.clientHeight -2;
2706
1967
  var move = function(e) {
2707
- text.style.left = e.clientX - left - 2 + "px";
2708
- text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
1968
+ dom.translate(text, e.clientX - left - 2, Math.min(e.clientY - top - 2, maxTop));
2709
1969
  };
2710
1970
  move(e);
2711
1971
 
2712
1972
  if (e.type != "mousedown")
2713
1973
  return;
2714
1974
 
2715
- if (host.renderer.$keepTextAreaAtCursor)
2716
- host.renderer.$keepTextAreaAtCursor = null;
1975
+ host.renderer.$isMousePressed = true;
2717
1976
 
2718
1977
  clearTimeout(closeTimeout);
2719
1978
  if (useragent.isWin)
@@ -2729,10 +1988,9 @@ var TextInput = function(parentNode, host) {
2729
1988
  text.style.cssText = tempStyle;
2730
1989
  tempStyle = '';
2731
1990
  }
2732
- if (host.renderer.$keepTextAreaAtCursor == null) {
2733
- host.renderer.$keepTextAreaAtCursor = true;
1991
+ host.renderer.$isMousePressed = false;
1992
+ if (host.renderer.$keepTextAreaAtCursor)
2734
1993
  host.renderer.$moveTextAreaToCursor();
2735
- }
2736
1994
  }, 0);
2737
1995
  }
2738
1996
 
@@ -2740,13 +1998,13 @@ var TextInput = function(parentNode, host) {
2740
1998
  host.textInput.onContextMenu(e);
2741
1999
  onContextMenuClose();
2742
2000
  };
2743
- event.addListener(text, "mouseup", onContextMenu);
2001
+ event.addListener(text, "mouseup", onContextMenu, host);
2744
2002
  event.addListener(text, "mousedown", function(e) {
2745
2003
  e.preventDefault();
2746
2004
  onContextMenuClose();
2747
- });
2748
- event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
2749
- event.addListener(text, "contextmenu", onContextMenu);
2005
+ }, host);
2006
+ event.addListener(host.renderer.scroller, "contextmenu", onContextMenu, host);
2007
+ event.addListener(text, "contextmenu", onContextMenu, host);
2750
2008
 
2751
2009
  if (isIOS)
2752
2010
  addIosSelectionHandler(parentNode, host, text);
@@ -2767,7 +2025,7 @@ var TextInput = function(parentNode, host) {
2767
2025
  }, true);
2768
2026
  var detectArrowKeys = function(e) {
2769
2027
  if (document.activeElement !== text) return;
2770
- if (typing || inComposition) return;
2028
+ if (typing || inComposition || host.$mouseHandler.isMousePressed) return;
2771
2029
 
2772
2030
  if (copied) {
2773
2031
  return;
@@ -2777,7 +2035,6 @@ var TextInput = function(parentNode, host) {
2777
2035
 
2778
2036
  var key = null;
2779
2037
  var modifier = 0;
2780
- console.log(selectionStart, selectionEnd);
2781
2038
  if (selectionStart == 0) {
2782
2039
  key = KEYS.up;
2783
2040
  } else if (selectionStart == 1) {
@@ -2816,7 +2073,13 @@ var TextInput = function(parentNode, host) {
2816
2073
  modifier |= MODS.shift;
2817
2074
 
2818
2075
  if (key) {
2819
- host.onCommandKey(null, modifier, key);
2076
+ var result = host.onCommandKey({}, modifier, key);
2077
+ if (!result && host.commands) {
2078
+ key = KEYS.keyCodeToString(key);
2079
+ var command = host.commands.findKeyCommand(modifier, key);
2080
+ if (command)
2081
+ host.execCommand(command);
2082
+ }
2820
2083
  lastSelectionStart = selectionStart;
2821
2084
  lastSelectionEnd = selectionEnd;
2822
2085
  resetSelection("");
@@ -2827,10 +2090,13 @@ var TextInput = function(parentNode, host) {
2827
2090
  document.removeEventListener("selectionchange", detectArrowKeys);
2828
2091
  });
2829
2092
  }
2830
-
2831
2093
  };
2832
2094
 
2833
2095
  exports.TextInput = TextInput;
2096
+ exports.$setUserAgentForTests = function(_isMobile, _isIOS) {
2097
+ isMobile = _isMobile;
2098
+ isIOS = _isIOS;
2099
+ };
2834
2100
  });
2835
2101
 
2836
2102
  define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"], function(require, exports, module) {
@@ -2850,7 +2116,6 @@ function DefaultHandlers(mouseHandler) {
2850
2116
  editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
2851
2117
  editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
2852
2118
  editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler));
2853
- editor.setDefaultHandler("touchmove", this.onTouchMove.bind(mouseHandler));
2854
2119
 
2855
2120
  var exports = ["select", "startSelect", "selectEnd", "selectAllEnd", "selectByWordsEnd",
2856
2121
  "selectByLinesEnd", "dragWait", "dragWaitEnd", "focusWait"];
@@ -3084,10 +2349,6 @@ function DefaultHandlers(mouseHandler) {
3084
2349
  return ev.stop();
3085
2350
  }
3086
2351
  };
3087
-
3088
- this.onTouchMove = function(ev) {
3089
- this.editor._emit("mousewheel", ev);
3090
- };
3091
2352
 
3092
2353
  }).call(DefaultHandlers.prototype);
3093
2354
 
@@ -3265,7 +2526,7 @@ function GutterHandler(mouseHandler) {
3265
2526
  tooltip.hide();
3266
2527
  tooltipAnnotation = null;
3267
2528
  editor._signal("hideGutterTooltip", tooltip);
3268
- editor.removeEventListener("mousewheel", hideTooltip);
2529
+ editor.off("mousewheel", hideTooltip);
3269
2530
  }
3270
2531
  }
3271
2532
 
@@ -3302,7 +2563,7 @@ function GutterHandler(mouseHandler) {
3302
2563
  tooltipTimeout = null;
3303
2564
  hideTooltip();
3304
2565
  }, 50);
3305
- });
2566
+ }, editor);
3306
2567
 
3307
2568
  editor.on("changeSession", hideTooltip);
3308
2569
  }
@@ -3437,7 +2698,7 @@ function DragdropHandler(mouseHandler) {
3437
2698
  exports.forEach(function(x) {
3438
2699
  mouseHandler[x] = this[x];
3439
2700
  }, this);
3440
- editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler));
2701
+ editor.on("mousedown", this.onMouseDown.bind(mouseHandler));
3441
2702
 
3442
2703
 
3443
2704
  var mouseTarget = editor.container;
@@ -3486,7 +2747,7 @@ function DragdropHandler(mouseHandler) {
3486
2747
  var dropEffect = e.dataTransfer.dropEffect;
3487
2748
  if (!dragOperation && dropEffect == "move")
3488
2749
  editor.session.remove(editor.getSelectionRange());
3489
- editor.renderer.$cursorLayer.setBlinking(true);
2750
+ editor.$resetCursorStyle();
3490
2751
  }
3491
2752
  this.editor.unsetStyle("ace_dragging");
3492
2753
  this.editor.renderer.setCursorStyle("");
@@ -3562,12 +2823,12 @@ function DragdropHandler(mouseHandler) {
3562
2823
  return event.preventDefault(e);
3563
2824
  };
3564
2825
 
3565
- event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler));
3566
- event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler));
3567
- event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler));
3568
- event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler));
3569
- event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler));
3570
- event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler));
2826
+ event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor);
2827
+ event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor);
2828
+ event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor);
2829
+ event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor);
2830
+ event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor);
2831
+ event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor);
3571
2832
 
3572
2833
  function scrollCursorIntoView(cursor, prevCursor) {
3573
2834
  var now = Date.now();
@@ -3651,7 +2912,7 @@ function DragdropHandler(mouseHandler) {
3651
2912
  dragSelectionMarker = null;
3652
2913
  editor.selection.fromOrientedRange(range);
3653
2914
  if (editor.isFocused() && !isInternal)
3654
- editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
2915
+ editor.$resetCursorStyle();
3655
2916
  range = null;
3656
2917
  dragCursor = null;
3657
2918
  counter = 0;
@@ -3714,7 +2975,7 @@ function DragdropHandler(mouseHandler) {
3714
2975
  };
3715
2976
 
3716
2977
  this.dragReadyEnd = function(e) {
3717
- this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
2978
+ this.editor.$resetCursorStyle();
3718
2979
  this.editor.unsetStyle("ace_dragging");
3719
2980
  this.editor.renderer.setCursorStyle("");
3720
2981
  this.dragWaitEnd();
@@ -3790,6 +3051,323 @@ exports.DragdropHandler = DragdropHandler;
3790
3051
 
3791
3052
  });
3792
3053
 
3054
+ define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"], function(require, exports, module) {
3055
+ "use strict";
3056
+
3057
+ var MouseEvent = require("./mouse_event").MouseEvent;
3058
+ var event = require("../lib/event");
3059
+ var dom = require("../lib/dom");
3060
+
3061
+ exports.addTouchListeners = function(el, editor) {
3062
+ var mode = "scroll";
3063
+ var startX;
3064
+ var startY;
3065
+ var touchStartT;
3066
+ var lastT;
3067
+ var longTouchTimer;
3068
+ var animationTimer;
3069
+ var animationSteps = 0;
3070
+ var pos;
3071
+ var clickCount = 0;
3072
+ var vX = 0;
3073
+ var vY = 0;
3074
+ var pressed;
3075
+ var contextMenu;
3076
+
3077
+ function createContextMenu() {
3078
+ var clipboard = window.navigator && window.navigator.clipboard;
3079
+ var isOpen = false;
3080
+ var updateMenu = function() {
3081
+ var selected = editor.getCopyText();
3082
+ var hasUndo = editor.session.getUndoManager().hasUndo();
3083
+ contextMenu.replaceChild(
3084
+ dom.buildDom(isOpen ? ["span",
3085
+ !selected && ["span", { class: "ace_mobile-button", action: "selectall" }, "Select All"],
3086
+ selected && ["span", { class: "ace_mobile-button", action: "copy" }, "Copy"],
3087
+ selected && ["span", { class: "ace_mobile-button", action: "cut" }, "Cut"],
3088
+ clipboard && ["span", { class: "ace_mobile-button", action: "paste" }, "Paste"],
3089
+ hasUndo && ["span", { class: "ace_mobile-button", action: "undo" }, "Undo"],
3090
+ ["span", { class: "ace_mobile-button", action: "find" }, "Find"],
3091
+ ["span", { class: "ace_mobile-button", action: "openCommandPallete" }, "Pallete"]
3092
+ ] : ["span"]),
3093
+ contextMenu.firstChild
3094
+ );
3095
+ };
3096
+ var handleClick = function(e) {
3097
+ var action = e.target.getAttribute("action");
3098
+
3099
+ if (action == "more" || !isOpen) {
3100
+ isOpen = !isOpen;
3101
+ return updateMenu();
3102
+ }
3103
+ if (action == "paste") {
3104
+ clipboard.readText().then(function (text) {
3105
+ editor.execCommand(action, text);
3106
+ });
3107
+ }
3108
+ else if (action) {
3109
+ if (action == "cut" || action == "copy") {
3110
+ if (clipboard)
3111
+ clipboard.writeText(editor.getCopyText());
3112
+ else
3113
+ document.execCommand("copy");
3114
+ }
3115
+ editor.execCommand(action);
3116
+ }
3117
+ contextMenu.firstChild.style.display = "none";
3118
+ isOpen = false;
3119
+ if (action != "openCommandPallete")
3120
+ editor.focus();
3121
+ };
3122
+ contextMenu = dom.buildDom(["div",
3123
+ {
3124
+ class: "ace_mobile-menu",
3125
+ ontouchstart: function(e) {
3126
+ mode = "menu";
3127
+ e.stopPropagation();
3128
+ e.preventDefault();
3129
+ editor.textInput.focus();
3130
+ },
3131
+ ontouchend: function(e) {
3132
+ e.stopPropagation();
3133
+ e.preventDefault();
3134
+ handleClick(e);
3135
+ },
3136
+ onclick: handleClick
3137
+ },
3138
+ ["span"],
3139
+ ["span", { class: "ace_mobile-button", action: "more" }, "..."]
3140
+ ], editor.container);
3141
+ }
3142
+ function showContextMenu() {
3143
+ if (!contextMenu) createContextMenu();
3144
+ var cursor = editor.selection.cursor;
3145
+ var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column);
3146
+ var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX;
3147
+ var scrollLeft = editor.renderer.scrollLeft;
3148
+ var rect = editor.container.getBoundingClientRect();
3149
+ contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px";
3150
+ if (pagePos.pageX - rect.left < rect.width - 70) {
3151
+ contextMenu.style.left = "";
3152
+ contextMenu.style.right = "10px";
3153
+ } else {
3154
+ contextMenu.style.right = "";
3155
+ contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px";
3156
+ }
3157
+ contextMenu.style.display = "";
3158
+ contextMenu.firstChild.style.display = "none";
3159
+ editor.on("input", hideContextMenu);
3160
+ }
3161
+ function hideContextMenu(e) {
3162
+ if (contextMenu)
3163
+ contextMenu.style.display = "none";
3164
+ editor.off("input", hideContextMenu);
3165
+ }
3166
+
3167
+ function handleLongTap() {
3168
+ longTouchTimer = null;
3169
+ clearTimeout(longTouchTimer);
3170
+ var range = editor.selection.getRange();
3171
+ var inSelection = range.contains(pos.row, pos.column);
3172
+ if (range.isEmpty() || !inSelection) {
3173
+ editor.selection.moveToPosition(pos);
3174
+ editor.selection.selectWord();
3175
+ }
3176
+ mode = "wait";
3177
+ showContextMenu();
3178
+ }
3179
+ function switchToSelectionMode() {
3180
+ longTouchTimer = null;
3181
+ clearTimeout(longTouchTimer);
3182
+ editor.selection.moveToPosition(pos);
3183
+ var range = clickCount >= 2
3184
+ ? editor.selection.getLineRange(pos.row)
3185
+ : editor.session.getBracketRange(pos);
3186
+ if (range && !range.isEmpty()) {
3187
+ editor.selection.setRange(range);
3188
+ } else {
3189
+ editor.selection.selectWord();
3190
+ }
3191
+ mode = "wait";
3192
+ }
3193
+ event.addListener(el, "contextmenu", function(e) {
3194
+ if (!pressed) return;
3195
+ var textarea = editor.textInput.getElement();
3196
+ textarea.focus();
3197
+ }, editor);
3198
+ event.addListener(el, "touchstart", function (e) {
3199
+ var touches = e.touches;
3200
+ if (longTouchTimer || touches.length > 1) {
3201
+ clearTimeout(longTouchTimer);
3202
+ longTouchTimer = null;
3203
+ touchStartT = -1;
3204
+ mode = "zoom";
3205
+ return;
3206
+ }
3207
+
3208
+ pressed = editor.$mouseHandler.isMousePressed = true;
3209
+ var h = editor.renderer.layerConfig.lineHeight;
3210
+ var w = editor.renderer.layerConfig.lineHeight;
3211
+ var t = e.timeStamp;
3212
+ lastT = t;
3213
+ var touchObj = touches[0];
3214
+ var x = touchObj.clientX;
3215
+ var y = touchObj.clientY;
3216
+ if (Math.abs(startX - x) + Math.abs(startY - y) > h)
3217
+ touchStartT = -1;
3218
+
3219
+ startX = e.clientX = x;
3220
+ startY = e.clientY = y;
3221
+ vX = vY = 0;
3222
+
3223
+ var ev = new MouseEvent(e, editor);
3224
+ pos = ev.getDocumentPosition();
3225
+
3226
+ if (t - touchStartT < 500 && touches.length == 1 && !animationSteps) {
3227
+ clickCount++;
3228
+ e.preventDefault();
3229
+ e.button = 0;
3230
+ switchToSelectionMode();
3231
+ } else {
3232
+ clickCount = 0;
3233
+ var cursor = editor.selection.cursor;
3234
+ var anchor = editor.selection.isEmpty() ? cursor : editor.selection.anchor;
3235
+
3236
+ var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true);
3237
+ var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true);
3238
+ var rect = editor.renderer.scroller.getBoundingClientRect();
3239
+ var offsetTop = editor.renderer.layerConfig.offset;
3240
+ var offsetLeft = editor.renderer.scrollLeft;
3241
+ var weightedDistance = function(x, y) {
3242
+ x = x / w;
3243
+ y = y / h - 0.75;
3244
+ return x * x + y * y;
3245
+ };
3246
+
3247
+ if (e.clientX < rect.left) {
3248
+ mode = "zoom";
3249
+ return;
3250
+ }
3251
+
3252
+ var diff1 = weightedDistance(
3253
+ e.clientX - rect.left - cursorPos.left + offsetLeft,
3254
+ e.clientY - rect.top - cursorPos.top + offsetTop
3255
+ );
3256
+ var diff2 = weightedDistance(
3257
+ e.clientX - rect.left - anchorPos.left + offsetLeft,
3258
+ e.clientY - rect.top - anchorPos.top + offsetTop
3259
+ );
3260
+ if (diff1 < 3.5 && diff2 < 3.5)
3261
+ mode = diff1 > diff2 ? "cursor" : "anchor";
3262
+
3263
+ if (diff2 < 3.5)
3264
+ mode = "anchor";
3265
+ else if (diff1 < 3.5)
3266
+ mode = "cursor";
3267
+ else
3268
+ mode = "scroll";
3269
+ longTouchTimer = setTimeout(handleLongTap, 450);
3270
+ }
3271
+ touchStartT = t;
3272
+ }, editor);
3273
+
3274
+ event.addListener(el, "touchend", function (e) {
3275
+ pressed = editor.$mouseHandler.isMousePressed = false;
3276
+ if (animationTimer) clearInterval(animationTimer);
3277
+ if (mode == "zoom") {
3278
+ mode = "";
3279
+ animationSteps = 0;
3280
+ } else if (longTouchTimer) {
3281
+ editor.selection.moveToPosition(pos);
3282
+ animationSteps = 0;
3283
+ showContextMenu();
3284
+ } else if (mode == "scroll") {
3285
+ animate();
3286
+ hideContextMenu();
3287
+ } else {
3288
+ showContextMenu();
3289
+ }
3290
+ clearTimeout(longTouchTimer);
3291
+ longTouchTimer = null;
3292
+ }, editor);
3293
+ event.addListener(el, "touchmove", function (e) {
3294
+ if (longTouchTimer) {
3295
+ clearTimeout(longTouchTimer);
3296
+ longTouchTimer = null;
3297
+ }
3298
+ var touches = e.touches;
3299
+ if (touches.length > 1 || mode == "zoom") return;
3300
+
3301
+ var touchObj = touches[0];
3302
+
3303
+ var wheelX = startX - touchObj.clientX;
3304
+ var wheelY = startY - touchObj.clientY;
3305
+
3306
+ if (mode == "wait") {
3307
+ if (wheelX * wheelX + wheelY * wheelY > 4)
3308
+ mode = "cursor";
3309
+ else
3310
+ return e.preventDefault();
3311
+ }
3312
+
3313
+ startX = touchObj.clientX;
3314
+ startY = touchObj.clientY;
3315
+
3316
+ e.clientX = touchObj.clientX;
3317
+ e.clientY = touchObj.clientY;
3318
+
3319
+ var t = e.timeStamp;
3320
+ var dt = t - lastT;
3321
+ lastT = t;
3322
+ if (mode == "scroll") {
3323
+ var mouseEvent = new MouseEvent(e, editor);
3324
+ mouseEvent.speed = 1;
3325
+ mouseEvent.wheelX = wheelX;
3326
+ mouseEvent.wheelY = wheelY;
3327
+ if (10 * Math.abs(wheelX) < Math.abs(wheelY)) wheelX = 0;
3328
+ if (10 * Math.abs(wheelY) < Math.abs(wheelX)) wheelY = 0;
3329
+ if (dt != 0) {
3330
+ vX = wheelX / dt;
3331
+ vY = wheelY / dt;
3332
+ }
3333
+ editor._emit("mousewheel", mouseEvent);
3334
+ if (!mouseEvent.propagationStopped) {
3335
+ vX = vY = 0;
3336
+ }
3337
+ }
3338
+ else {
3339
+ var ev = new MouseEvent(e, editor);
3340
+ var pos = ev.getDocumentPosition();
3341
+ if (mode == "cursor")
3342
+ editor.selection.moveCursorToPosition(pos);
3343
+ else if (mode == "anchor")
3344
+ editor.selection.setSelectionAnchor(pos.row, pos.column);
3345
+ editor.renderer.scrollCursorIntoView(pos);
3346
+ e.preventDefault();
3347
+ }
3348
+ }, editor);
3349
+
3350
+ function animate() {
3351
+ animationSteps += 60;
3352
+ animationTimer = setInterval(function() {
3353
+ if (animationSteps-- <= 0) {
3354
+ clearInterval(animationTimer);
3355
+ animationTimer = null;
3356
+ }
3357
+ if (Math.abs(vX) < 0.01) vX = 0;
3358
+ if (Math.abs(vY) < 0.01) vY = 0;
3359
+ if (animationSteps < 20) vX = 0.9 * vX;
3360
+ if (animationSteps < 20) vY = 0.9 * vY;
3361
+ var oldScrollTop = editor.session.getScrollTop();
3362
+ editor.renderer.scrollBy(10 * vX, 10 * vY);
3363
+ if (oldScrollTop == editor.session.getScrollTop())
3364
+ animationSteps = 0;
3365
+ }, 10);
3366
+ }
3367
+ };
3368
+
3369
+ });
3370
+
3793
3371
  define("ace/lib/net",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
3794
3372
  "use strict";
3795
3373
  var dom = require("./dom");
@@ -3878,8 +3456,8 @@ EventEmitter._signal = function(eventName, e) {
3878
3456
 
3879
3457
  EventEmitter.once = function(eventName, callback) {
3880
3458
  var _self = this;
3881
- this.addEventListener(eventName, function newCallback() {
3882
- _self.removeEventListener(eventName, newCallback);
3459
+ this.on(eventName, function newCallback() {
3460
+ _self.off(eventName, newCallback);
3883
3461
  callback.apply(null, arguments);
3884
3462
  });
3885
3463
  if (!callback) {
@@ -3951,7 +3529,9 @@ EventEmitter.removeEventListener = function(eventName, callback) {
3951
3529
  };
3952
3530
 
3953
3531
  EventEmitter.removeAllListeners = function(eventName) {
3954
- if (this._eventRegistry) this._eventRegistry[eventName] = [];
3532
+ if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
3533
+ if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
3534
+ if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
3955
3535
  };
3956
3536
 
3957
3537
  exports.EventEmitter = EventEmitter;
@@ -4059,6 +3639,13 @@ var AppConfig = function() {
4059
3639
  };
4060
3640
 
4061
3641
  this.setDefaultValue = function(path, name, value) {
3642
+ if (!path) {
3643
+ for (path in this.$defaultOptions)
3644
+ if (this.$defaultOptions[path][name])
3645
+ break;
3646
+ if (!this.$defaultOptions[path][name])
3647
+ return false;
3648
+ }
4062
3649
  var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});
4063
3650
  if (opts[name]) {
4064
3651
  if (opts.forwardTo)
@@ -4105,7 +3692,8 @@ var options = {
4105
3692
  basePath: "",
4106
3693
  suffix: ".js",
4107
3694
  $moduleUrls: {},
4108
- loadWorkerFromBlob: true
3695
+ loadWorkerFromBlob: true,
3696
+ sharedPopups: false
4109
3697
  };
4110
3698
 
4111
3699
  exports.get = function(key) {
@@ -4116,10 +3704,10 @@ exports.get = function(key) {
4116
3704
  };
4117
3705
 
4118
3706
  exports.set = function(key, value) {
4119
- if (!options.hasOwnProperty(key))
3707
+ if (options.hasOwnProperty(key))
3708
+ options[key] = value;
3709
+ else if (this.setDefaultValue("", key, value) == false)
4120
3710
  throw new Error("Unknown config key: " + key);
4121
-
4122
- options[key] = value;
4123
3711
  };
4124
3712
 
4125
3713
  exports.all = function() {
@@ -4266,9 +3854,11 @@ function deHyphenate(str) {
4266
3854
  return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
4267
3855
  }
4268
3856
 
3857
+ exports.version = "1.4.12";
3858
+
4269
3859
  });
4270
3860
 
4271
- 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) {
3861
+ 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/mouse/touch_handler","ace/config"], function(require, exports, module) {
4272
3862
  "use strict";
4273
3863
 
4274
3864
  var event = require("../lib/event");
@@ -4277,6 +3867,7 @@ var DefaultHandlers = require("./default_handlers").DefaultHandlers;
4277
3867
  var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
4278
3868
  var MouseEvent = require("./mouse_event").MouseEvent;
4279
3869
  var DragdropHandler = require("./dragdrop_handler").DragdropHandler;
3870
+ var addTouchListeners = require("./touch_handler").addTouchListeners;
4280
3871
  var config = require("../config");
4281
3872
 
4282
3873
  var MouseHandler = function(editor) {
@@ -4296,28 +3887,28 @@ var MouseHandler = function(editor) {
4296
3887
  };
4297
3888
 
4298
3889
  var mouseTarget = editor.renderer.getMouseEventTarget();
4299
- event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
4300
- event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
3890
+ event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor);
3891
+ event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor);
4301
3892
  event.addMultiMouseDownListener([
4302
3893
  mouseTarget,
4303
3894
  editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner,
4304
3895
  editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner,
4305
3896
  editor.textInput && editor.textInput.getElement()
4306
- ].filter(Boolean), [400, 300, 250], this, "onMouseEvent");
4307
- event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
4308
- event.addTouchMoveListener(editor.container, this.onTouchMove.bind(this, "touchmove"));
3897
+ ].filter(Boolean), [400, 300, 250], this, "onMouseEvent", editor);
3898
+ event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"), editor);
3899
+ addTouchListeners(editor.container, editor);
4309
3900
 
4310
3901
  var gutterEl = editor.renderer.$gutter;
4311
- event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"));
4312
- event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"));
4313
- event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"));
4314
- event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"));
3902
+ event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor);
3903
+ event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor);
3904
+ event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor);
3905
+ event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor);
4315
3906
 
4316
- event.addListener(mouseTarget, "mousedown", focusEditor);
4317
- event.addListener(gutterEl, "mousedown", focusEditor);
3907
+ event.addListener(mouseTarget, "mousedown", focusEditor, editor);
3908
+ event.addListener(gutterEl, "mousedown", focusEditor, editor);
4318
3909
  if (useragent.isIE && editor.renderer.scrollBarV) {
4319
- event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor);
4320
- event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor);
3910
+ event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor, editor);
3911
+ event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor, editor);
4321
3912
  }
4322
3913
 
4323
3914
  editor.on("mousemove", function(e){
@@ -4333,7 +3924,7 @@ var MouseHandler = function(editor) {
4333
3924
  } else {
4334
3925
  renderer.setCursorStyle("");
4335
3926
  }
4336
- });
3927
+ }, editor);
4337
3928
  };
4338
3929
 
4339
3930
  (function() {
@@ -4358,14 +3949,6 @@ var MouseHandler = function(editor) {
4358
3949
  this.editor._emit(name, mouseEvent);
4359
3950
  };
4360
3951
 
4361
- this.onTouchMove = function (name, e) {
4362
- var mouseEvent = new MouseEvent(e, this.editor);
4363
- mouseEvent.speed = 1;//this.$scrollSpeed * 2;
4364
- mouseEvent.wheelX = e.wheelX;
4365
- mouseEvent.wheelY = e.wheelY;
4366
- this.editor._emit(name, mouseEvent);
4367
- };
4368
-
4369
3952
  this.setState = function(state) {
4370
3953
  this.state = state;
4371
3954
  };
@@ -4377,8 +3960,7 @@ var MouseHandler = function(editor) {
4377
3960
  this.isMousePressed = true;
4378
3961
  var editor = this.editor;
4379
3962
  var renderer = this.editor.renderer;
4380
- if (renderer.$keepTextAreaAtCursor)
4381
- renderer.$keepTextAreaAtCursor = null;
3963
+ renderer.$isMousePressed = true;
4382
3964
 
4383
3965
  var self = this;
4384
3966
  var onMouseMove = function(e) {
@@ -4399,11 +3981,9 @@ var MouseHandler = function(editor) {
4399
3981
  onCaptureInterval();
4400
3982
  self[self.state + "End"] && self[self.state + "End"](e);
4401
3983
  self.state = "";
4402
- if (renderer.$keepTextAreaAtCursor == null) {
4403
- renderer.$keepTextAreaAtCursor = true;
3984
+ self.isMousePressed = renderer.$isMousePressed = false;
3985
+ if (renderer.$keepTextAreaAtCursor)
4404
3986
  renderer.$moveTextAreaToCursor();
4405
- }
4406
- self.isMousePressed = false;
4407
3987
  self.$onCaptureMouseMove = self.releaseMouse = null;
4408
3988
  e && self.onMouseEvent("mouseup", e);
4409
3989
  editor.endOperation();
@@ -4446,6 +4026,9 @@ var MouseHandler = function(editor) {
4446
4026
  setTimeout(stop, 10);
4447
4027
  this.editor.on("nativecontextmenu", stop);
4448
4028
  };
4029
+ this.destroy = function() {
4030
+ if (this.releaseMouse) this.releaseMouse();
4031
+ };
4449
4032
  }).call(MouseHandler.prototype);
4450
4033
 
4451
4034
  config.defineOptions(MouseHandler.prototype, "mouseHandler", {
@@ -4482,7 +4065,7 @@ function FoldHandler(editor) {
4482
4065
  var target = e.domEvent && e.domEvent.target;
4483
4066
  if (target && dom.hasCssClass(target, "ace_inline_button")) {
4484
4067
  if (dom.hasCssClass(target, "ace_toggle_wrap")) {
4485
- session.setOption("wrap", true);
4068
+ session.setOption("wrap", !session.getUseWrapMode());
4486
4069
  editor.renderer.scrollCursorIntoView();
4487
4070
  }
4488
4071
  }
@@ -4639,11 +4222,11 @@ var KeyBinding = function(editor) {
4639
4222
 
4640
4223
  this.onCommandKey = function(e, hashId, keyCode) {
4641
4224
  var keyString = keyUtil.keyCodeToString(keyCode);
4642
- this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
4225
+ return this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
4643
4226
  };
4644
4227
 
4645
4228
  this.onTextInput = function(text) {
4646
- this.$callKeyboardHandlers(-1, text);
4229
+ return this.$callKeyboardHandlers(-1, text);
4647
4230
  };
4648
4231
 
4649
4232
  }).call(KeyBinding.prototype);
@@ -5374,6 +4957,8 @@ var Selection = function(session) {
5374
4957
  };
5375
4958
 
5376
4959
  this.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) {
4960
+ if (this.$silent)
4961
+ return;
5377
4962
  var wasEmpty = this.$isEmpty;
5378
4963
  var wasMultiselect = this.inMultiSelectMode;
5379
4964
  this.$silent = true;
@@ -5767,14 +5352,19 @@ var Selection = function(session) {
5767
5352
  else
5768
5353
  this.$desiredColumn = screenPos.column;
5769
5354
  }
5770
-
5355
+
5356
+ if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) {
5357
+ var widget = this.session.lineWidgets[this.lead.row];
5358
+ if (rows < 0)
5359
+ rows -= widget.rowsAbove || 0;
5360
+ else if (rows > 0)
5361
+ rows += widget.rowCount - (widget.rowsAbove || 0);
5362
+ }
5363
+
5771
5364
  var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);
5772
5365
 
5773
5366
  if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
5774
- if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
5775
- if (docPos.row > 0 || rows > 0)
5776
- docPos.row++;
5777
- }
5367
+
5778
5368
  }
5779
5369
  this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
5780
5370
  };
@@ -5861,7 +5451,7 @@ var Selection = function(session) {
5861
5451
 
5862
5452
  this.fromJSON = function(data) {
5863
5453
  if (data.start == undefined) {
5864
- if (this.rangeList) {
5454
+ if (this.rangeList && data.length > 1) {
5865
5455
  this.toSingleRange(data[0]);
5866
5456
  for (var i = data.length; i--; ) {
5867
5457
  var r = Range.fromPoints(data[i].start, data[i].end);
@@ -6179,7 +5769,7 @@ var Tokenizer = function(rules) {
6179
5769
  if (token.type)
6180
5770
  tokens.push(token);
6181
5771
  token = {
6182
- value: line.substring(lastIndex, lastIndex += 2000),
5772
+ value: line.substring(lastIndex, lastIndex += 500),
6183
5773
  type: "overflow"
6184
5774
  };
6185
5775
  }
@@ -6384,18 +5974,18 @@ var TextHighlightRules = function() {
6384
5974
 
6385
5975
  this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
6386
5976
  var keywords = Object.create(null);
5977
+ this.$keywordList = [];
6387
5978
  Object.keys(map).forEach(function(className) {
6388
5979
  var a = map[className];
6389
- if (ignoreCase)
6390
- a = a.toLowerCase();
6391
5980
  var list = a.split(splitChar || "|");
6392
- for (var i = list.length; i--; )
6393
- keywords[list[i]] = className;
6394
- });
6395
- if (Object.getPrototypeOf(keywords)) {
6396
- keywords.__proto__ = null;
6397
- }
6398
- this.$keywordList = Object.keys(keywords);
5981
+ for (var i = list.length; i--; ) {
5982
+ var word = list[i];
5983
+ this.$keywordList.push(word);
5984
+ if (ignoreCase)
5985
+ word = word.toLowerCase();
5986
+ keywords[word] = className;
5987
+ }
5988
+ }, this);
6399
5989
  map = null;
6400
5990
  return ignoreCase
6401
5991
  ? function(value) {return keywords[value.toLowerCase()] || defaultToken; }
@@ -6564,9 +6154,9 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
6564
6154
  var lang = require("../../lib/lang");
6565
6155
 
6566
6156
  var SAFE_INSERT_IN_TOKENS =
6567
- ["text", "paren.rparen", "punctuation.operator"];
6157
+ ["text", "paren.rparen", "rparen", "paren", "punctuation.operator"];
6568
6158
  var SAFE_INSERT_BEFORE_TOKENS =
6569
- ["text", "paren.rparen", "punctuation.operator", "comment"];
6159
+ ["text", "paren.rparen", "rparen", "paren", "punctuation.operator", "comment"];
6570
6160
 
6571
6161
  var context;
6572
6162
  var contextCache = {};
@@ -6822,6 +6412,9 @@ var CstyleBehaviour = function(options) {
6822
6412
  return null; // before or after alphanumeric
6823
6413
  if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
6824
6414
  return null; // there is rightChar and it isn't closing
6415
+ var charBefore = line[cursor.column - 2];
6416
+ if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore)))
6417
+ return null;
6825
6418
  pair = true;
6826
6419
  }
6827
6420
  return {
@@ -6854,6 +6447,8 @@ CstyleBehaviour.isSaneInsertion = function(editor, session) {
6854
6447
  var cursor = editor.getCursorPosition();
6855
6448
  var iterator = new TokenIterator(session, cursor.row, cursor.column);
6856
6449
  if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
6450
+ if (/[)}\]]/.test(editor.session.getLine(cursor.row)[cursor.column]))
6451
+ return true;
6857
6452
  var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
6858
6453
  if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
6859
6454
  return false;
@@ -7453,7 +7048,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
7453
7048
  });
7454
7049
  };
7455
7050
  this.detach = function() {
7456
- this.document.removeEventListener("change", this.$onChange);
7051
+ this.document.off("change", this.$onChange);
7457
7052
  };
7458
7053
  this.attach = function(doc) {
7459
7054
  this.document = doc || this.document;
@@ -7785,6 +7380,16 @@ var Document = function(textOrLines) {
7785
7380
  }
7786
7381
  };
7787
7382
 
7383
+ this.$safeApplyDelta = function(delta) {
7384
+ var docLength = this.$lines.length;
7385
+ if (
7386
+ delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
7387
+ || delta.action == "insert" && delta.start.row <= docLength
7388
+ ) {
7389
+ this.applyDelta(delta);
7390
+ }
7391
+ };
7392
+
7788
7393
  this.$splitAndapplyLargeDelta = function(delta, MAX) {
7789
7394
  var lines = delta.lines;
7790
7395
  var l = lines.length - MAX + 1;
@@ -7807,7 +7412,7 @@ var Document = function(textOrLines) {
7807
7412
  this.applyDelta(delta, true);
7808
7413
  };
7809
7414
  this.revertDelta = function(delta) {
7810
- this.applyDelta({
7415
+ this.$safeApplyDelta({
7811
7416
  start: this.clonePos(delta.start),
7812
7417
  end: this.clonePos(delta.end),
7813
7418
  action: (delta.action == "insert" ? "remove" : "insert"),
@@ -8265,6 +7870,7 @@ var comparePoints = Range.comparePoints;
8265
7870
 
8266
7871
  var RangeList = function() {
8267
7872
  this.ranges = [];
7873
+ this.$bias = 1;
8268
7874
  };
8269
7875
 
8270
7876
  (function() {
@@ -8429,14 +8035,14 @@ var RangeList = function() {
8429
8035
  break;
8430
8036
 
8431
8037
  if (r.start.row == startRow && r.start.column >= start.column) {
8432
- if (r.start.column == start.column && this.$insertRight) {
8038
+ if (r.start.column == start.column && this.$bias <= 0) {
8433
8039
  } else {
8434
8040
  r.start.column += colDiff;
8435
8041
  r.start.row += lineDif;
8436
8042
  }
8437
8043
  }
8438
8044
  if (r.end.row == startRow && r.end.column >= start.column) {
8439
- if (r.end.column == start.column && this.$insertRight) {
8045
+ if (r.end.column == start.column && this.$bias < 0) {
8440
8046
  continue;
8441
8047
  }
8442
8048
  if (r.end.column == start.column && colDiff > 0 && i < n - 1) {
@@ -8522,10 +8128,9 @@ var RangeList = function() {
8522
8128
  exports.RangeList = RangeList;
8523
8129
  });
8524
8130
 
8525
- define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"], function(require, exports, module) {
8131
+ define("ace/edit_session/fold",["require","exports","module","ace/range_list","ace/lib/oop"], function(require, exports, module) {
8526
8132
  "use strict";
8527
8133
 
8528
- var Range = require("../range").Range;
8529
8134
  var RangeList = require("../range_list").RangeList;
8530
8135
  var oop = require("../lib/oop");
8531
8136
  var Fold = exports.Fold = function(range, placeholder) {
@@ -8567,9 +8172,6 @@ oop.inherits(Fold, RangeList);
8567
8172
  this.addSubFold = function(fold) {
8568
8173
  if (this.range.isEqual(fold))
8569
8174
  return;
8570
-
8571
- if (!this.range.containsRange(fold))
8572
- throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
8573
8175
  consumeRange(fold, this.start);
8574
8176
 
8575
8177
  var row = fold.start.row, column = fold.start.column;
@@ -8579,21 +8181,26 @@ oop.inherits(Fold, RangeList);
8579
8181
  break;
8580
8182
  }
8581
8183
  var afterStart = this.subFolds[i];
8184
+ var firstConsumed = 0;
8582
8185
 
8583
- if (cmp == 0)
8584
- return afterStart.addSubFold(fold);
8186
+ if (cmp == 0) {
8187
+ if (afterStart.range.containsRange(fold))
8188
+ return afterStart.addSubFold(fold);
8189
+ else
8190
+ firstConsumed = 1;
8191
+ }
8585
8192
  var row = fold.range.end.row, column = fold.range.end.column;
8586
8193
  for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
8587
8194
  cmp = this.subFolds[j].range.compare(row, column);
8588
8195
  if (cmp != 1)
8589
8196
  break;
8590
8197
  }
8591
- var afterEnd = this.subFolds[j];
8592
-
8593
- if (cmp == 0)
8594
- throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
8595
-
8198
+ if (cmp == 0) j++;
8596
8199
  var consumedFolds = this.subFolds.splice(i, j - i, fold);
8200
+ var last = cmp == 0 ? consumedFolds.length - 1 : consumedFolds.length;
8201
+ for (var k = firstConsumed; k < last; k++) {
8202
+ fold.addSubFold(consumedFolds[k]);
8203
+ }
8597
8204
  fold.setFoldLine(this.foldLine);
8598
8205
 
8599
8206
  return fold;
@@ -8642,14 +8249,14 @@ function Folding() {
8642
8249
 
8643
8250
  var folds = foldLine.folds;
8644
8251
  for (var i = 0; i < folds.length; i++) {
8645
- var fold = folds[i];
8646
- if (fold.range.contains(row, column)) {
8647
- if (side == 1 && fold.range.isEnd(row, column)) {
8252
+ var range = folds[i].range;
8253
+ if (range.contains(row, column)) {
8254
+ if (side == 1 && range.isEnd(row, column) && !range.isEmpty()) {
8648
8255
  continue;
8649
- } else if (side == -1 && fold.range.isStart(row, column)) {
8256
+ } else if (side == -1 && range.isStart(row, column) && !range.isEmpty()) {
8650
8257
  continue;
8651
8258
  }
8652
- return fold;
8259
+ return folds[i];
8653
8260
  }
8654
8261
  }
8655
8262
  };
@@ -8828,9 +8435,6 @@ function Folding() {
8828
8435
  var startColumn = fold.start.column;
8829
8436
  var endRow = fold.end.row;
8830
8437
  var endColumn = fold.end.column;
8831
- if (!(startRow < endRow ||
8832
- startRow == endRow && startColumn <= endColumn - 2))
8833
- throw new Error("The range has to be at least 2 characters width");
8834
8438
 
8835
8439
  var startFold = this.getFoldAt(startRow, startColumn, 1);
8836
8440
  var endFold = this.getFoldAt(endRow, endColumn, -1);
@@ -8845,9 +8449,11 @@ function Folding() {
8845
8449
  var folds = this.getFoldsInRange(fold.range);
8846
8450
  if (folds.length > 0) {
8847
8451
  this.removeFolds(folds);
8848
- folds.forEach(function(subFold) {
8849
- fold.addSubFold(subFold);
8850
- });
8452
+ if (!fold.collapseChildren) {
8453
+ folds.forEach(function(subFold) {
8454
+ fold.addSubFold(subFold);
8455
+ });
8456
+ }
8851
8457
  }
8852
8458
 
8853
8459
  for (var i = 0; i < foldData.length; i++) {
@@ -8966,7 +8572,7 @@ function Folding() {
8966
8572
  var range, folds;
8967
8573
  if (location == null) {
8968
8574
  range = new Range(0, 0, this.getLength(), 0);
8969
- expandInner = true;
8575
+ if (expandInner == null) expandInner = true;
8970
8576
  } else if (typeof location == "number")
8971
8577
  range = new Range(location, 0, location, this.getLine(location).length);
8972
8578
  else if ("row" in location)
@@ -8975,14 +8581,10 @@ function Folding() {
8975
8581
  range = location;
8976
8582
 
8977
8583
  folds = this.getFoldsInRangeList(range);
8978
- if (expandInner) {
8584
+ if (expandInner != false) {
8979
8585
  this.removeFolds(folds);
8980
8586
  } else {
8981
- var subFolds = folds;
8982
- while (subFolds.length) {
8983
- this.expandFolds(subFolds);
8984
- subFolds = this.getFoldsInRangeList(range);
8985
- }
8587
+ this.expandFolds(folds);
8986
8588
  }
8987
8589
  if (folds.length)
8988
8590
  return folds;
@@ -9119,7 +8721,7 @@ function Folding() {
9119
8721
  this.getCommentFoldRange = function(row, column, dir) {
9120
8722
  var iterator = new TokenIterator(this, row, column);
9121
8723
  var token = iterator.getCurrentToken();
9122
- var type = token.type;
8724
+ var type = token && token.type;
9123
8725
  if (token && /^comment|string/.test(type)) {
9124
8726
  type = type.match(/comment|string/)[0];
9125
8727
  if (type == "comment")
@@ -9160,7 +8762,7 @@ function Folding() {
9160
8762
  }
9161
8763
  };
9162
8764
 
9163
- this.foldAll = function(startRow, endRow, depth) {
8765
+ this.foldAll = function(startRow, endRow, depth, test) {
9164
8766
  if (depth == undefined)
9165
8767
  depth = 100000; // JSON.stringify doesn't hanle Infinity
9166
8768
  var foldWidgets = this.foldWidgets;
@@ -9173,6 +8775,8 @@ function Folding() {
9173
8775
  foldWidgets[row] = this.getFoldWidget(row);
9174
8776
  if (foldWidgets[row] != "start")
9175
8777
  continue;
8778
+
8779
+ if (test && !test(row)) continue;
9176
8780
 
9177
8781
  var range = this.getFoldWidgetRange(row);
9178
8782
  if (range && range.isMultiLine()
@@ -9180,14 +8784,32 @@ function Folding() {
9180
8784
  && range.start.row >= startRow
9181
8785
  ) {
9182
8786
  row = range.end.row;
9183
- try {
9184
- var fold = this.addFold("...", range);
9185
- if (fold)
9186
- fold.collapseChildren = depth;
9187
- } catch(e) {}
8787
+ range.collapseChildren = depth;
8788
+ this.addFold("...", range);
9188
8789
  }
9189
8790
  }
9190
8791
  };
8792
+
8793
+ this.foldToLevel = function(level) {
8794
+ this.foldAll();
8795
+ while (level-- > 0)
8796
+ this.unfold(null, false);
8797
+ };
8798
+
8799
+ this.foldAllComments = function() {
8800
+ var session = this;
8801
+ this.foldAll(null, null, null, function(row) {
8802
+ var tokens = session.getTokens(row);
8803
+ for (var i = 0; i < tokens.length; i++) {
8804
+ var token = tokens[i];
8805
+ if (token.type == "text" && /^\s+$/.test(token.value))
8806
+ continue;
8807
+ if (/comment/.test(token.type))
8808
+ return true;
8809
+ return false;
8810
+ }
8811
+ });
8812
+ };
9191
8813
  this.$foldStyles = {
9192
8814
  "manual": 1,
9193
8815
  "markbegin": 1,
@@ -9403,7 +9025,7 @@ function BracketMatch() {
9403
9025
  var line = this.getLine(pos.row);
9404
9026
  var before = true, range;
9405
9027
 
9406
- var chr = line.charAt(pos.column-1);
9028
+ var chr = line.charAt(pos.column - 1);
9407
9029
  var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
9408
9030
  if (!match) {
9409
9031
  chr = line.charAt(pos.column);
@@ -9438,6 +9060,29 @@ function BracketMatch() {
9438
9060
 
9439
9061
  return range;
9440
9062
  };
9063
+ this.getMatchingBracketRanges = function(pos) {
9064
+ var line = this.getLine(pos.row);
9065
+
9066
+ var chr = line.charAt(pos.column - 1);
9067
+ var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
9068
+ if (!match) {
9069
+ chr = line.charAt(pos.column);
9070
+ pos = {row: pos.row, column: pos.column + 1};
9071
+ match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
9072
+ }
9073
+
9074
+ if (!match)
9075
+ return null;
9076
+
9077
+ var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column);
9078
+ var bracketPos = match[1] ? this.$findClosingBracket(match[1], pos)
9079
+ : this.$findOpeningBracket(match[2], pos);
9080
+ if (!bracketPos)
9081
+ return [startRange];
9082
+ var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1);
9083
+
9084
+ return [startRange, endRange];
9085
+ };
9441
9086
 
9442
9087
  this.$brackets = {
9443
9088
  ")": "(",
@@ -9759,6 +9404,8 @@ EditSession.$uid = 0;
9759
9404
  this.$defaultUndoManager = {
9760
9405
  undo: function() {},
9761
9406
  redo: function() {},
9407
+ hasUndo: function() {},
9408
+ hasRedo: function() {},
9762
9409
  reset: function() {},
9763
9410
  add: function() {},
9764
9411
  addSelection: function() {},
@@ -10034,7 +9681,8 @@ EditSession.$uid = 0;
10034
9681
  this.$modeId = mode.$id;
10035
9682
  if (this.$mode === mode)
10036
9683
  return;
10037
-
9684
+
9685
+ var oldMode = this.$mode;
10038
9686
  this.$mode = mode;
10039
9687
 
10040
9688
  this.$stopWorker();
@@ -10044,15 +9692,15 @@ EditSession.$uid = 0;
10044
9692
 
10045
9693
  var tokenizer = mode.getTokenizer();
10046
9694
 
10047
- if(tokenizer.addEventListener !== undefined) {
9695
+ if(tokenizer.on !== undefined) {
10048
9696
  var onReloadTokenizer = this.onReloadTokenizer.bind(this);
10049
- tokenizer.addEventListener("update", onReloadTokenizer);
9697
+ tokenizer.on("update", onReloadTokenizer);
10050
9698
  }
10051
9699
 
10052
9700
  if (!this.bgTokenizer) {
10053
9701
  this.bgTokenizer = new BackgroundTokenizer(tokenizer);
10054
9702
  var _self = this;
10055
- this.bgTokenizer.addEventListener("update", function(e) {
9703
+ this.bgTokenizer.on("update", function(e) {
10056
9704
  _self._signal("tokenizerUpdate", e);
10057
9705
  });
10058
9706
  } else {
@@ -10071,7 +9719,7 @@ EditSession.$uid = 0;
10071
9719
  this.$options.wrapMethod.set.call(this, this.$wrapMethod);
10072
9720
  this.$setFolding(mode.foldingRules);
10073
9721
  this.bgTokenizer.start(0);
10074
- this._emit("changeMode");
9722
+ this._emit("changeMode", {oldMode: oldMode, mode: mode});
10075
9723
  }
10076
9724
  };
10077
9725
 
@@ -10217,7 +9865,7 @@ EditSession.$uid = 0;
10217
9865
  for (var i = 0; i < deltas.length; i++) {
10218
9866
  var delta = deltas[i];
10219
9867
  if (delta.action == "insert" || delta.action == "remove") {
10220
- this.doc.applyDelta(delta);
9868
+ this.doc.$safeApplyDelta(delta);
10221
9869
  }
10222
9870
  }
10223
9871
 
@@ -10239,7 +9887,6 @@ EditSession.$uid = 0;
10239
9887
  }
10240
9888
 
10241
9889
  var range, point;
10242
- var lastDeltaIsInsert;
10243
9890
 
10244
9891
  for (var i = 0; i < deltas.length; i++) {
10245
9892
  var delta = deltas[i];
@@ -10247,10 +9894,8 @@ EditSession.$uid = 0;
10247
9894
  if (!range) {
10248
9895
  if (isInsert(delta)) {
10249
9896
  range = Range.fromPoints(delta.start, delta.end);
10250
- lastDeltaIsInsert = true;
10251
9897
  } else {
10252
9898
  range = Range.fromPoints(delta.start, delta.start);
10253
- lastDeltaIsInsert = false;
10254
9899
  }
10255
9900
  continue;
10256
9901
  }
@@ -10264,13 +9909,11 @@ EditSession.$uid = 0;
10264
9909
  if (range.compare(point.row, point.column) == 1) {
10265
9910
  range.setEnd(point);
10266
9911
  }
10267
- lastDeltaIsInsert = true;
10268
9912
  } else {
10269
9913
  point = delta.start;
10270
9914
  if (range.compare(point.row, point.column) == -1) {
10271
9915
  range = Range.fromPoints(delta.start, delta.start);
10272
9916
  }
10273
- lastDeltaIsInsert = false;
10274
9917
  }
10275
9918
  }
10276
9919
  return range;
@@ -10838,15 +10481,14 @@ EditSession.$uid = 0;
10838
10481
 
10839
10482
  this.lineWidgets = null;
10840
10483
  this.getRowLength = function(row) {
10484
+ var h = 1;
10841
10485
  if (this.lineWidgets)
10842
- var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
10843
- else
10844
- h = 0;
10845
- if (!this.$useWrapMode || !this.$wrapData[row]) {
10846
- return 1 + h;
10847
- } else {
10848
- return this.$wrapData[row].length + 1 + h;
10849
- }
10486
+ h += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
10487
+
10488
+ if (!this.$useWrapMode || !this.$wrapData[row])
10489
+ return h;
10490
+ else
10491
+ return this.$wrapData[row].length + h;
10850
10492
  };
10851
10493
  this.getRowLineCount = function(row) {
10852
10494
  if (!this.$useWrapMode || !this.$wrapData[row]) {
@@ -10885,7 +10527,7 @@ EditSession.$uid = 0;
10885
10527
  }
10886
10528
  };
10887
10529
  this.getScreenTabSize = function(screenColumn) {
10888
- return this.$tabSize - screenColumn % this.$tabSize;
10530
+ return this.$tabSize - (screenColumn % this.$tabSize | 0);
10889
10531
  };
10890
10532
 
10891
10533
 
@@ -11058,6 +10700,9 @@ EditSession.$uid = 0;
11058
10700
  wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
11059
10701
  }
11060
10702
  }
10703
+
10704
+ if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove)
10705
+ screenRow += this.lineWidgets[row].rowsAbove;
11061
10706
 
11062
10707
  return {
11063
10708
  row: screenRow,
@@ -11134,6 +10779,8 @@ EditSession.$uid = 0;
11134
10779
  this.bgTokenizer = null;
11135
10780
  }
11136
10781
  this.$stopWorker();
10782
+ this.removeAllListeners();
10783
+ this.selection.detach();
11137
10784
  };
11138
10785
 
11139
10786
  this.isFullWidth = isFullWidth;
@@ -11257,12 +10904,12 @@ config.defineOptions(EditSession.prototype, "session", {
11257
10904
  tabSize: {
11258
10905
  set: function(tabSize) {
11259
10906
  tabSize = parseInt(tabSize);
11260
- if (isNaN(tabSize) || this.$tabSize === tabSize) return;
11261
-
11262
- this.$modified = true;
11263
- this.$rowLengthCache = [];
11264
- this.$tabSize = tabSize;
11265
- this._signal("changeTabSize");
10907
+ if (tabSize > 0 && this.$tabSize !== tabSize) {
10908
+ this.$modified = true;
10909
+ this.$rowLengthCache = [];
10910
+ this.$tabSize = tabSize;
10911
+ this._signal("changeTabSize");
10912
+ }
11266
10913
  },
11267
10914
  initialValue: 4,
11268
10915
  handlesSet: true
@@ -11875,7 +11522,7 @@ oop.inherits(CommandManager, MultiHashHandler);
11875
11522
  editor && editor._emit("changeStatus");
11876
11523
  if (this.recording) {
11877
11524
  this.macro.pop();
11878
- this.removeEventListener("exec", this.$addCommandToMacro);
11525
+ this.off("exec", this.$addCommandToMacro);
11879
11526
 
11880
11527
  if (!this.macro.length)
11881
11528
  this.macro = this.oldMacro;
@@ -11972,23 +11619,24 @@ exports.commands = [{
11972
11619
  readOnly: true
11973
11620
  }, {
11974
11621
  name: "selectall",
11622
+ description: "Select all",
11975
11623
  bindKey: bindKey("Ctrl-A", "Command-A"),
11976
11624
  exec: function(editor) { editor.selectAll(); },
11977
11625
  readOnly: true
11978
11626
  }, {
11979
11627
  name: "centerselection",
11628
+ description: "Center selection",
11980
11629
  bindKey: bindKey(null, "Ctrl-L"),
11981
11630
  exec: function(editor) { editor.centerSelection(); },
11982
11631
  readOnly: true
11983
11632
  }, {
11984
11633
  name: "gotoline",
11634
+ description: "Go to line...",
11985
11635
  bindKey: bindKey("Ctrl-L", "Command-L"),
11986
11636
  exec: function(editor, line) {
11987
- if (typeof line !== "number")
11988
- line = parseInt(prompt("Enter line number:"), 10);
11989
- if (!isNaN(line)) {
11637
+ if (typeof line === "number" && !isNaN(line))
11990
11638
  editor.gotoLine(line);
11991
- }
11639
+ editor.prompt({ $type: "gotoLine" });
11992
11640
  },
11993
11641
  readOnly: true
11994
11642
  }, {
@@ -12021,12 +11669,21 @@ exports.commands = [{
12021
11669
  readOnly: true
12022
11670
  }, {
12023
11671
  name: "foldall",
11672
+ description: "Fold all",
12024
11673
  bindKey: bindKey(null, "Ctrl-Command-Option-0"),
12025
11674
  exec: function(editor) { editor.session.foldAll(); },
12026
11675
  scrollIntoView: "center",
12027
11676
  readOnly: true
11677
+ }, {
11678
+ name: "foldAllComments",
11679
+ description: "Fold all comments",
11680
+ bindKey: bindKey(null, "Ctrl-Command-Option-0"),
11681
+ exec: function(editor) { editor.session.foldAllComments(); },
11682
+ scrollIntoView: "center",
11683
+ readOnly: true
12028
11684
  }, {
12029
11685
  name: "foldOther",
11686
+ description: "Fold other",
12030
11687
  bindKey: bindKey("Alt-0", "Command-Option-0"),
12031
11688
  exec: function(editor) {
12032
11689
  editor.session.foldAll();
@@ -12036,12 +11693,14 @@ exports.commands = [{
12036
11693
  readOnly: true
12037
11694
  }, {
12038
11695
  name: "unfoldall",
11696
+ description: "Unfold all",
12039
11697
  bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
12040
11698
  exec: function(editor) { editor.session.unfold(); },
12041
11699
  scrollIntoView: "center",
12042
11700
  readOnly: true
12043
11701
  }, {
12044
11702
  name: "findnext",
11703
+ description: "Find next",
12045
11704
  bindKey: bindKey("Ctrl-K", "Command-G"),
12046
11705
  exec: function(editor) { editor.findNext(); },
12047
11706
  multiSelectAction: "forEach",
@@ -12049,6 +11708,7 @@ exports.commands = [{
12049
11708
  readOnly: true
12050
11709
  }, {
12051
11710
  name: "findprevious",
11711
+ description: "Find previous",
12052
11712
  bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
12053
11713
  exec: function(editor) { editor.findPrevious(); },
12054
11714
  multiSelectAction: "forEach",
@@ -12056,6 +11716,7 @@ exports.commands = [{
12056
11716
  readOnly: true
12057
11717
  }, {
12058
11718
  name: "selectOrFindNext",
11719
+ description: "Select or find next",
12059
11720
  bindKey: bindKey("Alt-K", "Ctrl-G"),
12060
11721
  exec: function(editor) {
12061
11722
  if (editor.selection.isEmpty())
@@ -12066,6 +11727,7 @@ exports.commands = [{
12066
11727
  readOnly: true
12067
11728
  }, {
12068
11729
  name: "selectOrFindPrevious",
11730
+ description: "Select or find previous",
12069
11731
  bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
12070
11732
  exec: function(editor) {
12071
11733
  if (editor.selection.isEmpty())
@@ -12076,6 +11738,7 @@ exports.commands = [{
12076
11738
  readOnly: true
12077
11739
  }, {
12078
11740
  name: "find",
11741
+ description: "Find",
12079
11742
  bindKey: bindKey("Ctrl-F", "Command-F"),
12080
11743
  exec: function(editor) {
12081
11744
  config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor);});
@@ -12083,11 +11746,13 @@ exports.commands = [{
12083
11746
  readOnly: true
12084
11747
  }, {
12085
11748
  name: "overwrite",
11749
+ description: "Overwrite",
12086
11750
  bindKey: "Insert",
12087
11751
  exec: function(editor) { editor.toggleOverwrite(); },
12088
11752
  readOnly: true
12089
11753
  }, {
12090
11754
  name: "selecttostart",
11755
+ description: "Select to start",
12091
11756
  bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"),
12092
11757
  exec: function(editor) { editor.getSelection().selectFileStart(); },
12093
11758
  multiSelectAction: "forEach",
@@ -12096,6 +11761,7 @@ exports.commands = [{
12096
11761
  aceCommandGroup: "fileJump"
12097
11762
  }, {
12098
11763
  name: "gotostart",
11764
+ description: "Go to start",
12099
11765
  bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
12100
11766
  exec: function(editor) { editor.navigateFileStart(); },
12101
11767
  multiSelectAction: "forEach",
@@ -12104,6 +11770,7 @@ exports.commands = [{
12104
11770
  aceCommandGroup: "fileJump"
12105
11771
  }, {
12106
11772
  name: "selectup",
11773
+ description: "Select up",
12107
11774
  bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"),
12108
11775
  exec: function(editor) { editor.getSelection().selectUp(); },
12109
11776
  multiSelectAction: "forEach",
@@ -12111,6 +11778,7 @@ exports.commands = [{
12111
11778
  readOnly: true
12112
11779
  }, {
12113
11780
  name: "golineup",
11781
+ description: "Go line up",
12114
11782
  bindKey: bindKey("Up", "Up|Ctrl-P"),
12115
11783
  exec: function(editor, args) { editor.navigateUp(args.times); },
12116
11784
  multiSelectAction: "forEach",
@@ -12118,6 +11786,7 @@ exports.commands = [{
12118
11786
  readOnly: true
12119
11787
  }, {
12120
11788
  name: "selecttoend",
11789
+ description: "Select to end",
12121
11790
  bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"),
12122
11791
  exec: function(editor) { editor.getSelection().selectFileEnd(); },
12123
11792
  multiSelectAction: "forEach",
@@ -12126,6 +11795,7 @@ exports.commands = [{
12126
11795
  aceCommandGroup: "fileJump"
12127
11796
  }, {
12128
11797
  name: "gotoend",
11798
+ description: "Go to end",
12129
11799
  bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
12130
11800
  exec: function(editor) { editor.navigateFileEnd(); },
12131
11801
  multiSelectAction: "forEach",
@@ -12134,6 +11804,7 @@ exports.commands = [{
12134
11804
  aceCommandGroup: "fileJump"
12135
11805
  }, {
12136
11806
  name: "selectdown",
11807
+ description: "Select down",
12137
11808
  bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"),
12138
11809
  exec: function(editor) { editor.getSelection().selectDown(); },
12139
11810
  multiSelectAction: "forEach",
@@ -12141,6 +11812,7 @@ exports.commands = [{
12141
11812
  readOnly: true
12142
11813
  }, {
12143
11814
  name: "golinedown",
11815
+ description: "Go line down",
12144
11816
  bindKey: bindKey("Down", "Down|Ctrl-N"),
12145
11817
  exec: function(editor, args) { editor.navigateDown(args.times); },
12146
11818
  multiSelectAction: "forEach",
@@ -12148,6 +11820,7 @@ exports.commands = [{
12148
11820
  readOnly: true
12149
11821
  }, {
12150
11822
  name: "selectwordleft",
11823
+ description: "Select word left",
12151
11824
  bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
12152
11825
  exec: function(editor) { editor.getSelection().selectWordLeft(); },
12153
11826
  multiSelectAction: "forEach",
@@ -12155,6 +11828,7 @@ exports.commands = [{
12155
11828
  readOnly: true
12156
11829
  }, {
12157
11830
  name: "gotowordleft",
11831
+ description: "Go to word left",
12158
11832
  bindKey: bindKey("Ctrl-Left", "Option-Left"),
12159
11833
  exec: function(editor) { editor.navigateWordLeft(); },
12160
11834
  multiSelectAction: "forEach",
@@ -12162,6 +11836,7 @@ exports.commands = [{
12162
11836
  readOnly: true
12163
11837
  }, {
12164
11838
  name: "selecttolinestart",
11839
+ description: "Select to line start",
12165
11840
  bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"),
12166
11841
  exec: function(editor) { editor.getSelection().selectLineStart(); },
12167
11842
  multiSelectAction: "forEach",
@@ -12169,6 +11844,7 @@ exports.commands = [{
12169
11844
  readOnly: true
12170
11845
  }, {
12171
11846
  name: "gotolinestart",
11847
+ description: "Go to line start",
12172
11848
  bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
12173
11849
  exec: function(editor) { editor.navigateLineStart(); },
12174
11850
  multiSelectAction: "forEach",
@@ -12176,6 +11852,7 @@ exports.commands = [{
12176
11852
  readOnly: true
12177
11853
  }, {
12178
11854
  name: "selectleft",
11855
+ description: "Select left",
12179
11856
  bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"),
12180
11857
  exec: function(editor) { editor.getSelection().selectLeft(); },
12181
11858
  multiSelectAction: "forEach",
@@ -12183,6 +11860,7 @@ exports.commands = [{
12183
11860
  readOnly: true
12184
11861
  }, {
12185
11862
  name: "gotoleft",
11863
+ description: "Go to left",
12186
11864
  bindKey: bindKey("Left", "Left|Ctrl-B"),
12187
11865
  exec: function(editor, args) { editor.navigateLeft(args.times); },
12188
11866
  multiSelectAction: "forEach",
@@ -12190,6 +11868,7 @@ exports.commands = [{
12190
11868
  readOnly: true
12191
11869
  }, {
12192
11870
  name: "selectwordright",
11871
+ description: "Select word right",
12193
11872
  bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
12194
11873
  exec: function(editor) { editor.getSelection().selectWordRight(); },
12195
11874
  multiSelectAction: "forEach",
@@ -12197,6 +11876,7 @@ exports.commands = [{
12197
11876
  readOnly: true
12198
11877
  }, {
12199
11878
  name: "gotowordright",
11879
+ description: "Go to word right",
12200
11880
  bindKey: bindKey("Ctrl-Right", "Option-Right"),
12201
11881
  exec: function(editor) { editor.navigateWordRight(); },
12202
11882
  multiSelectAction: "forEach",
@@ -12204,6 +11884,7 @@ exports.commands = [{
12204
11884
  readOnly: true
12205
11885
  }, {
12206
11886
  name: "selecttolineend",
11887
+ description: "Select to line end",
12207
11888
  bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"),
12208
11889
  exec: function(editor) { editor.getSelection().selectLineEnd(); },
12209
11890
  multiSelectAction: "forEach",
@@ -12211,6 +11892,7 @@ exports.commands = [{
12211
11892
  readOnly: true
12212
11893
  }, {
12213
11894
  name: "gotolineend",
11895
+ description: "Go to line end",
12214
11896
  bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
12215
11897
  exec: function(editor) { editor.navigateLineEnd(); },
12216
11898
  multiSelectAction: "forEach",
@@ -12218,6 +11900,7 @@ exports.commands = [{
12218
11900
  readOnly: true
12219
11901
  }, {
12220
11902
  name: "selectright",
11903
+ description: "Select right",
12221
11904
  bindKey: bindKey("Shift-Right", "Shift-Right"),
12222
11905
  exec: function(editor) { editor.getSelection().selectRight(); },
12223
11906
  multiSelectAction: "forEach",
@@ -12225,6 +11908,7 @@ exports.commands = [{
12225
11908
  readOnly: true
12226
11909
  }, {
12227
11910
  name: "gotoright",
11911
+ description: "Go to right",
12228
11912
  bindKey: bindKey("Right", "Right|Ctrl-F"),
12229
11913
  exec: function(editor, args) { editor.navigateRight(args.times); },
12230
11914
  multiSelectAction: "forEach",
@@ -12232,46 +11916,55 @@ exports.commands = [{
12232
11916
  readOnly: true
12233
11917
  }, {
12234
11918
  name: "selectpagedown",
11919
+ description: "Select page down",
12235
11920
  bindKey: "Shift-PageDown",
12236
11921
  exec: function(editor) { editor.selectPageDown(); },
12237
11922
  readOnly: true
12238
11923
  }, {
12239
11924
  name: "pagedown",
11925
+ description: "Page down",
12240
11926
  bindKey: bindKey(null, "Option-PageDown"),
12241
11927
  exec: function(editor) { editor.scrollPageDown(); },
12242
11928
  readOnly: true
12243
11929
  }, {
12244
11930
  name: "gotopagedown",
11931
+ description: "Go to page down",
12245
11932
  bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
12246
11933
  exec: function(editor) { editor.gotoPageDown(); },
12247
11934
  readOnly: true
12248
11935
  }, {
12249
11936
  name: "selectpageup",
11937
+ description: "Select page up",
12250
11938
  bindKey: "Shift-PageUp",
12251
11939
  exec: function(editor) { editor.selectPageUp(); },
12252
11940
  readOnly: true
12253
11941
  }, {
12254
11942
  name: "pageup",
11943
+ description: "Page up",
12255
11944
  bindKey: bindKey(null, "Option-PageUp"),
12256
11945
  exec: function(editor) { editor.scrollPageUp(); },
12257
11946
  readOnly: true
12258
11947
  }, {
12259
11948
  name: "gotopageup",
11949
+ description: "Go to page up",
12260
11950
  bindKey: "PageUp",
12261
11951
  exec: function(editor) { editor.gotoPageUp(); },
12262
11952
  readOnly: true
12263
11953
  }, {
12264
11954
  name: "scrollup",
11955
+ description: "Scroll up",
12265
11956
  bindKey: bindKey("Ctrl-Up", null),
12266
11957
  exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
12267
11958
  readOnly: true
12268
11959
  }, {
12269
11960
  name: "scrolldown",
11961
+ description: "Scroll down",
12270
11962
  bindKey: bindKey("Ctrl-Down", null),
12271
11963
  exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
12272
11964
  readOnly: true
12273
11965
  }, {
12274
11966
  name: "selectlinestart",
11967
+ description: "Select line start",
12275
11968
  bindKey: "Shift-Home",
12276
11969
  exec: function(editor) { editor.getSelection().selectLineStart(); },
12277
11970
  multiSelectAction: "forEach",
@@ -12279,6 +11972,7 @@ exports.commands = [{
12279
11972
  readOnly: true
12280
11973
  }, {
12281
11974
  name: "selectlineend",
11975
+ description: "Select line end",
12282
11976
  bindKey: "Shift-End",
12283
11977
  exec: function(editor) { editor.getSelection().selectLineEnd(); },
12284
11978
  multiSelectAction: "forEach",
@@ -12286,30 +11980,35 @@ exports.commands = [{
12286
11980
  readOnly: true
12287
11981
  }, {
12288
11982
  name: "togglerecording",
11983
+ description: "Toggle recording",
12289
11984
  bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
12290
11985
  exec: function(editor) { editor.commands.toggleRecording(editor); },
12291
11986
  readOnly: true
12292
11987
  }, {
12293
11988
  name: "replaymacro",
11989
+ description: "Replay macro",
12294
11990
  bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
12295
11991
  exec: function(editor) { editor.commands.replay(editor); },
12296
11992
  readOnly: true
12297
11993
  }, {
12298
11994
  name: "jumptomatching",
12299
- bindKey: bindKey("Ctrl-P", "Ctrl-P"),
11995
+ description: "Jump to matching",
11996
+ bindKey: bindKey("Ctrl-\\|Ctrl-P", "Command-\\"),
12300
11997
  exec: function(editor) { editor.jumpToMatching(); },
12301
11998
  multiSelectAction: "forEach",
12302
11999
  scrollIntoView: "animate",
12303
12000
  readOnly: true
12304
12001
  }, {
12305
12002
  name: "selecttomatching",
12306
- bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
12003
+ description: "Select to matching",
12004
+ bindKey: bindKey("Ctrl-Shift-\\|Ctrl-Shift-P", "Command-Shift-\\"),
12307
12005
  exec: function(editor) { editor.jumpToMatching(true); },
12308
12006
  multiSelectAction: "forEach",
12309
12007
  scrollIntoView: "animate",
12310
12008
  readOnly: true
12311
12009
  }, {
12312
12010
  name: "expandToMatching",
12011
+ description: "Expand to matching",
12313
12012
  bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
12314
12013
  exec: function(editor) { editor.jumpToMatching(true, true); },
12315
12014
  multiSelectAction: "forEach",
@@ -12317,18 +12016,21 @@ exports.commands = [{
12317
12016
  readOnly: true
12318
12017
  }, {
12319
12018
  name: "passKeysToBrowser",
12019
+ description: "Pass keys to browser",
12320
12020
  bindKey: bindKey(null, null),
12321
12021
  exec: function() {},
12322
12022
  passEvent: true,
12323
12023
  readOnly: true
12324
12024
  }, {
12325
12025
  name: "copy",
12026
+ description: "Copy",
12326
12027
  exec: function(editor) {
12327
12028
  },
12328
12029
  readOnly: true
12329
12030
  },
12330
12031
  {
12331
12032
  name: "cut",
12033
+ description: "Cut",
12332
12034
  exec: function(editor) {
12333
12035
  var cutLine = editor.$copyWithEmptySelection && editor.selection.isEmpty();
12334
12036
  var range = cutLine ? editor.selection.getLineRange() : editor.selection.getRange();
@@ -12342,94 +12044,111 @@ exports.commands = [{
12342
12044
  multiSelectAction: "forEach"
12343
12045
  }, {
12344
12046
  name: "paste",
12047
+ description: "Paste",
12345
12048
  exec: function(editor, args) {
12346
12049
  editor.$handlePaste(args);
12347
12050
  },
12348
12051
  scrollIntoView: "cursor"
12349
12052
  }, {
12350
12053
  name: "removeline",
12054
+ description: "Remove line",
12351
12055
  bindKey: bindKey("Ctrl-D", "Command-D"),
12352
12056
  exec: function(editor) { editor.removeLines(); },
12353
12057
  scrollIntoView: "cursor",
12354
12058
  multiSelectAction: "forEachLine"
12355
12059
  }, {
12356
12060
  name: "duplicateSelection",
12061
+ description: "Duplicate selection",
12357
12062
  bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
12358
12063
  exec: function(editor) { editor.duplicateSelection(); },
12359
12064
  scrollIntoView: "cursor",
12360
12065
  multiSelectAction: "forEach"
12361
12066
  }, {
12362
12067
  name: "sortlines",
12068
+ description: "Sort lines",
12363
12069
  bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
12364
12070
  exec: function(editor) { editor.sortLines(); },
12365
12071
  scrollIntoView: "selection",
12366
12072
  multiSelectAction: "forEachLine"
12367
12073
  }, {
12368
12074
  name: "togglecomment",
12075
+ description: "Toggle comment",
12369
12076
  bindKey: bindKey("Ctrl-/", "Command-/"),
12370
12077
  exec: function(editor) { editor.toggleCommentLines(); },
12371
12078
  multiSelectAction: "forEachLine",
12372
12079
  scrollIntoView: "selectionPart"
12373
12080
  }, {
12374
12081
  name: "toggleBlockComment",
12082
+ description: "Toggle block comment",
12375
12083
  bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
12376
12084
  exec: function(editor) { editor.toggleBlockComment(); },
12377
12085
  multiSelectAction: "forEach",
12378
12086
  scrollIntoView: "selectionPart"
12379
12087
  }, {
12380
12088
  name: "modifyNumberUp",
12089
+ description: "Modify number up",
12381
12090
  bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
12382
12091
  exec: function(editor) { editor.modifyNumber(1); },
12383
12092
  scrollIntoView: "cursor",
12384
12093
  multiSelectAction: "forEach"
12385
12094
  }, {
12386
12095
  name: "modifyNumberDown",
12096
+ description: "Modify number down",
12387
12097
  bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
12388
12098
  exec: function(editor) { editor.modifyNumber(-1); },
12389
12099
  scrollIntoView: "cursor",
12390
12100
  multiSelectAction: "forEach"
12391
12101
  }, {
12392
12102
  name: "replace",
12103
+ description: "Replace",
12393
12104
  bindKey: bindKey("Ctrl-H", "Command-Option-F"),
12394
12105
  exec: function(editor) {
12395
12106
  config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true);});
12396
12107
  }
12397
12108
  }, {
12398
12109
  name: "undo",
12110
+ description: "Undo",
12399
12111
  bindKey: bindKey("Ctrl-Z", "Command-Z"),
12400
12112
  exec: function(editor) { editor.undo(); }
12401
12113
  }, {
12402
12114
  name: "redo",
12115
+ description: "Redo",
12403
12116
  bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
12404
12117
  exec: function(editor) { editor.redo(); }
12405
12118
  }, {
12406
12119
  name: "copylinesup",
12120
+ description: "Copy lines up",
12407
12121
  bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
12408
12122
  exec: function(editor) { editor.copyLinesUp(); },
12409
12123
  scrollIntoView: "cursor"
12410
12124
  }, {
12411
12125
  name: "movelinesup",
12126
+ description: "Move lines up",
12412
12127
  bindKey: bindKey("Alt-Up", "Option-Up"),
12413
12128
  exec: function(editor) { editor.moveLinesUp(); },
12414
12129
  scrollIntoView: "cursor"
12415
12130
  }, {
12416
12131
  name: "copylinesdown",
12132
+ description: "Copy lines down",
12417
12133
  bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
12418
12134
  exec: function(editor) { editor.copyLinesDown(); },
12419
12135
  scrollIntoView: "cursor"
12420
12136
  }, {
12421
12137
  name: "movelinesdown",
12138
+ description: "Move lines down",
12422
12139
  bindKey: bindKey("Alt-Down", "Option-Down"),
12423
12140
  exec: function(editor) { editor.moveLinesDown(); },
12424
12141
  scrollIntoView: "cursor"
12425
12142
  }, {
12426
12143
  name: "del",
12144
+ description: "Delete",
12427
12145
  bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
12428
12146
  exec: function(editor) { editor.remove("right"); },
12429
12147
  multiSelectAction: "forEach",
12430
12148
  scrollIntoView: "cursor"
12431
12149
  }, {
12432
12150
  name: "backspace",
12151
+ description: "Backspace",
12433
12152
  bindKey: bindKey(
12434
12153
  "Shift-Backspace|Backspace",
12435
12154
  "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
@@ -12439,6 +12158,7 @@ exports.commands = [{
12439
12158
  scrollIntoView: "cursor"
12440
12159
  }, {
12441
12160
  name: "cut_or_delete",
12161
+ description: "Cut or delete",
12442
12162
  bindKey: bindKey("Shift-Delete", null),
12443
12163
  exec: function(editor) {
12444
12164
  if (editor.selection.isEmpty()) {
@@ -12451,18 +12171,21 @@ exports.commands = [{
12451
12171
  scrollIntoView: "cursor"
12452
12172
  }, {
12453
12173
  name: "removetolinestart",
12174
+ description: "Remove to line start",
12454
12175
  bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
12455
12176
  exec: function(editor) { editor.removeToLineStart(); },
12456
12177
  multiSelectAction: "forEach",
12457
12178
  scrollIntoView: "cursor"
12458
12179
  }, {
12459
12180
  name: "removetolineend",
12181
+ description: "Remove to line end",
12460
12182
  bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"),
12461
12183
  exec: function(editor) { editor.removeToLineEnd(); },
12462
12184
  multiSelectAction: "forEach",
12463
12185
  scrollIntoView: "cursor"
12464
12186
  }, {
12465
12187
  name: "removetolinestarthard",
12188
+ description: "Remove to line start hard",
12466
12189
  bindKey: bindKey("Ctrl-Shift-Backspace", null),
12467
12190
  exec: function(editor) {
12468
12191
  var range = editor.selection.getRange();
@@ -12473,6 +12196,7 @@ exports.commands = [{
12473
12196
  scrollIntoView: "cursor"
12474
12197
  }, {
12475
12198
  name: "removetolineendhard",
12199
+ description: "Remove to line end hard",
12476
12200
  bindKey: bindKey("Ctrl-Shift-Delete", null),
12477
12201
  exec: function(editor) {
12478
12202
  var range = editor.selection.getRange();
@@ -12483,47 +12207,55 @@ exports.commands = [{
12483
12207
  scrollIntoView: "cursor"
12484
12208
  }, {
12485
12209
  name: "removewordleft",
12210
+ description: "Remove word left",
12486
12211
  bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
12487
12212
  exec: function(editor) { editor.removeWordLeft(); },
12488
12213
  multiSelectAction: "forEach",
12489
12214
  scrollIntoView: "cursor"
12490
12215
  }, {
12491
12216
  name: "removewordright",
12217
+ description: "Remove word right",
12492
12218
  bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
12493
12219
  exec: function(editor) { editor.removeWordRight(); },
12494
12220
  multiSelectAction: "forEach",
12495
12221
  scrollIntoView: "cursor"
12496
12222
  }, {
12497
12223
  name: "outdent",
12224
+ description: "Outdent",
12498
12225
  bindKey: bindKey("Shift-Tab", "Shift-Tab"),
12499
12226
  exec: function(editor) { editor.blockOutdent(); },
12500
12227
  multiSelectAction: "forEach",
12501
12228
  scrollIntoView: "selectionPart"
12502
12229
  }, {
12503
12230
  name: "indent",
12231
+ description: "Indent",
12504
12232
  bindKey: bindKey("Tab", "Tab"),
12505
12233
  exec: function(editor) { editor.indent(); },
12506
12234
  multiSelectAction: "forEach",
12507
12235
  scrollIntoView: "selectionPart"
12508
12236
  }, {
12509
12237
  name: "blockoutdent",
12238
+ description: "Block outdent",
12510
12239
  bindKey: bindKey("Ctrl-[", "Ctrl-["),
12511
12240
  exec: function(editor) { editor.blockOutdent(); },
12512
12241
  multiSelectAction: "forEachLine",
12513
12242
  scrollIntoView: "selectionPart"
12514
12243
  }, {
12515
12244
  name: "blockindent",
12245
+ description: "Block indent",
12516
12246
  bindKey: bindKey("Ctrl-]", "Ctrl-]"),
12517
12247
  exec: function(editor) { editor.blockIndent(); },
12518
12248
  multiSelectAction: "forEachLine",
12519
12249
  scrollIntoView: "selectionPart"
12520
12250
  }, {
12521
12251
  name: "insertstring",
12252
+ description: "Insert string",
12522
12253
  exec: function(editor, str) { editor.insert(str); },
12523
12254
  multiSelectAction: "forEach",
12524
12255
  scrollIntoView: "cursor"
12525
12256
  }, {
12526
12257
  name: "inserttext",
12258
+ description: "Insert text",
12527
12259
  exec: function(editor, args) {
12528
12260
  editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
12529
12261
  },
@@ -12531,30 +12263,42 @@ exports.commands = [{
12531
12263
  scrollIntoView: "cursor"
12532
12264
  }, {
12533
12265
  name: "splitline",
12266
+ description: "Split line",
12534
12267
  bindKey: bindKey(null, "Ctrl-O"),
12535
12268
  exec: function(editor) { editor.splitLine(); },
12536
12269
  multiSelectAction: "forEach",
12537
12270
  scrollIntoView: "cursor"
12538
12271
  }, {
12539
12272
  name: "transposeletters",
12273
+ description: "Transpose letters",
12540
12274
  bindKey: bindKey("Alt-Shift-X", "Ctrl-T"),
12541
12275
  exec: function(editor) { editor.transposeLetters(); },
12542
12276
  multiSelectAction: function(editor) {editor.transposeSelections(1); },
12543
12277
  scrollIntoView: "cursor"
12544
12278
  }, {
12545
12279
  name: "touppercase",
12280
+ description: "To uppercase",
12546
12281
  bindKey: bindKey("Ctrl-U", "Ctrl-U"),
12547
12282
  exec: function(editor) { editor.toUpperCase(); },
12548
12283
  multiSelectAction: "forEach",
12549
12284
  scrollIntoView: "cursor"
12550
12285
  }, {
12551
12286
  name: "tolowercase",
12287
+ description: "To lowercase",
12552
12288
  bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
12553
12289
  exec: function(editor) { editor.toLowerCase(); },
12554
12290
  multiSelectAction: "forEach",
12555
12291
  scrollIntoView: "cursor"
12292
+ }, {
12293
+ name: "autoindent",
12294
+ description: "Auto Indent",
12295
+ bindKey: bindKey(null, null),
12296
+ exec: function(editor) { editor.autoIndent(); },
12297
+ multiSelectAction: "forEachLine",
12298
+ scrollIntoView: "animate"
12556
12299
  }, {
12557
12300
  name: "expandtoline",
12301
+ description: "Expand to line",
12558
12302
  bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
12559
12303
  exec: function(editor) {
12560
12304
  var range = editor.selection.getRange();
@@ -12568,6 +12312,7 @@ exports.commands = [{
12568
12312
  readOnly: true
12569
12313
  }, {
12570
12314
  name: "joinlines",
12315
+ description: "Join lines",
12571
12316
  bindKey: bindKey(null, null),
12572
12317
  exec: function(editor) {
12573
12318
  var isBackwards = editor.selection.isBackwards();
@@ -12605,6 +12350,7 @@ exports.commands = [{
12605
12350
  readOnly: true
12606
12351
  }, {
12607
12352
  name: "invertSelection",
12353
+ description: "Invert selection",
12608
12354
  bindKey: bindKey(null, null),
12609
12355
  exec: function(editor) {
12610
12356
  var endRow = editor.session.doc.getLength() - 1;
@@ -12640,14 +12386,54 @@ exports.commands = [{
12640
12386
  },
12641
12387
  readOnly: true,
12642
12388
  scrollIntoView: "none"
12389
+ }, {
12390
+ name: "addLineAfter",
12391
+ exec: function(editor) {
12392
+ editor.selection.clearSelection();
12393
+ editor.navigateLineEnd();
12394
+ editor.insert("\n");
12395
+ },
12396
+ multiSelectAction: "forEach",
12397
+ scrollIntoView: "cursor"
12398
+ }, {
12399
+ name: "addLineBefore",
12400
+ exec: function(editor) {
12401
+ editor.selection.clearSelection();
12402
+ var cursor = editor.getCursorPosition();
12403
+ editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE);
12404
+ editor.insert("\n");
12405
+ if (cursor.row === 0) editor.navigateUp();
12406
+ },
12407
+ multiSelectAction: "forEach",
12408
+ scrollIntoView: "cursor"
12409
+ }, {
12410
+ name: "openCommandPallete",
12411
+ description: "Open command pallete",
12412
+ bindKey: bindKey("F1", "F1"),
12413
+ exec: function(editor) {
12414
+ editor.prompt({ $type: "commands" });
12415
+ },
12416
+ readOnly: true
12417
+ }, {
12418
+ name: "modeSelect",
12419
+ description: "Change language mode...",
12420
+ bindKey: bindKey(null, null),
12421
+ exec: function(editor) {
12422
+ editor.prompt({ $type: "modes" });
12423
+ },
12424
+ readOnly: true
12643
12425
  }];
12644
12426
 
12645
- });
12646
-
12647
- define("ace/clipboard",["require","exports","module"], function(require, exports, module) {
12648
- "use strict";
12649
-
12650
- module.exports = { lineMode: false };
12427
+ for (var i = 1; i < 9; i++) {
12428
+ exports.commands.push({
12429
+ name: "foldToLevel" + i,
12430
+ description: "Fold To Level " + i,
12431
+ level: i,
12432
+ exec: function(editor) { editor.session.foldToLevel(this.level); },
12433
+ scrollIntoView: "center",
12434
+ readOnly: true
12435
+ });
12436
+ }
12651
12437
 
12652
12438
  });
12653
12439
 
@@ -12675,6 +12461,7 @@ var TokenIterator = require("./token_iterator").TokenIterator;
12675
12461
 
12676
12462
  var clipboard = require("./clipboard");
12677
12463
  var Editor = function(renderer, session, options) {
12464
+ this.$toDestroy = [];
12678
12465
  var container = renderer.getContainerElement();
12679
12466
  this.container = container;
12680
12467
  this.renderer = renderer;
@@ -12767,8 +12554,8 @@ Editor.$uid = 0;
12767
12554
  };
12768
12555
 
12769
12556
  this.endOperation = function(e) {
12770
- if (this.curOp) {
12771
- if (e && e.returnValue === false)
12557
+ if (this.curOp && this.session) {
12558
+ if (e && e.returnValue === false || !this.session)
12772
12559
  return (this.curOp = null);
12773
12560
  if (e == true && this.curOp.command && this.curOp.command.name == "mouse")
12774
12561
  return;
@@ -13016,28 +12803,46 @@ Editor.$uid = 0;
13016
12803
  };
13017
12804
 
13018
12805
  this.$highlightBrackets = function() {
13019
- if (this.session.$bracketHighlight) {
13020
- this.session.removeMarker(this.session.$bracketHighlight);
13021
- this.session.$bracketHighlight = null;
13022
- }
13023
-
13024
12806
  if (this.$highlightPending) {
13025
12807
  return;
13026
12808
  }
13027
12809
  var self = this;
13028
12810
  this.$highlightPending = true;
13029
- setTimeout(function() {
12811
+ setTimeout(function () {
13030
12812
  self.$highlightPending = false;
13031
12813
  var session = self.session;
13032
12814
  if (!session || !session.bgTokenizer) return;
13033
- var pos = session.findMatchingBracket(self.getCursorPosition());
13034
- if (pos) {
13035
- var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
13036
- } else if (session.$mode.getMatching) {
13037
- var range = session.$mode.getMatching(self.session);
13038
- }
13039
- if (range)
13040
- session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
12815
+ if (session.$bracketHighlight) {
12816
+ session.$bracketHighlight.markerIds.forEach(function(id) {
12817
+ session.removeMarker(id);
12818
+ });
12819
+ session.$bracketHighlight = null;
12820
+ }
12821
+ var ranges = session.getMatchingBracketRanges(self.getCursorPosition());
12822
+ if (!ranges && session.$mode.getMatching)
12823
+ ranges = session.$mode.getMatching(self.session);
12824
+ if (!ranges)
12825
+ return;
12826
+
12827
+ var markerType = "ace_bracket";
12828
+ if (!Array.isArray(ranges)) {
12829
+ ranges = [ranges];
12830
+ } else if (ranges.length == 1) {
12831
+ markerType = "ace_error_bracket";
12832
+ }
12833
+ if (ranges.length == 2) {
12834
+ if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
12835
+ ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
12836
+ else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
12837
+ ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
12838
+ }
12839
+
12840
+ session.$bracketHighlight = {
12841
+ ranges: ranges,
12842
+ markerIds: ranges.map(function(range) {
12843
+ return session.addMarker(range, markerType, "text");
12844
+ })
12845
+ };
13041
12846
  }, 50);
13042
12847
  };
13043
12848
  this.$highlightTags = function() {
@@ -13061,25 +12866,33 @@ Editor.$uid = 0;
13061
12866
  return;
13062
12867
  }
13063
12868
 
13064
- if (token.type.indexOf("tag-open") != -1) {
12869
+ if (token.type.indexOf("tag-open") !== -1) {
13065
12870
  token = iterator.stepForward();
13066
12871
  if (!token)
13067
12872
  return;
13068
12873
  }
13069
12874
 
13070
12875
  var tag = token.value;
12876
+ var currentTag = token.value;
13071
12877
  var depth = 0;
13072
12878
  var prevToken = iterator.stepBackward();
13073
12879
 
13074
- if (prevToken.value == '<'){
12880
+ if (prevToken.value === '<'){
13075
12881
  do {
13076
12882
  prevToken = token;
13077
12883
  token = iterator.stepForward();
13078
-
13079
- if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
13080
- if (prevToken.value === '<'){
13081
- depth++;
13082
- } else if (prevToken.value === '</'){
12884
+
12885
+ if (token) {
12886
+ if (token.type.indexOf('tag-name') !== -1) {
12887
+ currentTag = token.value;
12888
+ if (tag === currentTag) {
12889
+ if (prevToken.value === '<') {
12890
+ depth++;
12891
+ } else if (prevToken.value === '</') {
12892
+ depth--;
12893
+ }
12894
+ }
12895
+ } else if (tag === currentTag && token.value === '/>') { // self closing tag
13083
12896
  depth--;
13084
12897
  }
13085
12898
  }
@@ -13089,12 +12902,32 @@ Editor.$uid = 0;
13089
12902
  do {
13090
12903
  token = prevToken;
13091
12904
  prevToken = iterator.stepBackward();
13092
-
13093
- if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
13094
- if (prevToken.value === '<') {
13095
- depth++;
13096
- } else if (prevToken.value === '</') {
13097
- depth--;
12905
+
12906
+ if (token) {
12907
+ if (token.type.indexOf('tag-name') !== -1) {
12908
+ if (tag === token.value) {
12909
+ if (prevToken.value === '<') {
12910
+ depth++;
12911
+ } else if (prevToken.value === '</') {
12912
+ depth--;
12913
+ }
12914
+ }
12915
+ } else if (token.value === '/>') { // self closing tag
12916
+ var stepCount = 0;
12917
+ var tmpToken = prevToken;
12918
+ while (tmpToken) {
12919
+ if (tmpToken.type.indexOf('tag-name') !== -1 && tmpToken.value === tag) {
12920
+ depth--;
12921
+ break;
12922
+ } else if (tmpToken.value === '<') {
12923
+ break;
12924
+ }
12925
+ tmpToken = iterator.stepBackward();
12926
+ stepCount++;
12927
+ }
12928
+ for (var i = 0; i < stepCount; i++) {
12929
+ iterator.stepForward();
12930
+ }
13098
12931
  }
13099
12932
  }
13100
12933
  } while (prevToken && depth <= 0);
@@ -13153,6 +12986,9 @@ Editor.$uid = 0;
13153
12986
 
13154
12987
  this.$cursorChange = function() {
13155
12988
  this.renderer.updateCursor();
12989
+ this.$highlightBrackets();
12990
+ this.$highlightTags();
12991
+ this.$updateHighlightActiveLine();
13156
12992
  };
13157
12993
  this.onDocumentChange = function(delta) {
13158
12994
  var wrap = this.session.$useWrapMode;
@@ -13161,7 +12997,6 @@ Editor.$uid = 0;
13161
12997
 
13162
12998
  this._signal("change", delta);
13163
12999
  this.$cursorChange();
13164
- this.$updateHighlightActiveLine();
13165
13000
  };
13166
13001
 
13167
13002
  this.onTokenizerUpdate = function(e) {
@@ -13179,10 +13014,6 @@ Editor.$uid = 0;
13179
13014
  };
13180
13015
  this.onCursorChange = function() {
13181
13016
  this.$cursorChange();
13182
-
13183
- this.$highlightBrackets();
13184
- this.$highlightTags();
13185
- this.$updateHighlightActiveLine();
13186
13017
  this._signal("changeSelection");
13187
13018
  };
13188
13019
 
@@ -13356,7 +13187,8 @@ Editor.$uid = 0;
13356
13187
  var lines = text.split(/\r\n|\r|\n/);
13357
13188
  var ranges = this.selection.rangeList.ranges;
13358
13189
 
13359
- if (lines.length > ranges.length || lines.length < 2 || !lines[1])
13190
+ var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);
13191
+ if (lines.length != ranges.length || isFullLine)
13360
13192
  return this.commands.exec("insertstring", this, text);
13361
13193
 
13362
13194
  for (var i = ranges.length; i--;) {
@@ -13417,7 +13249,7 @@ Editor.$uid = 0;
13417
13249
  var lineState = session.getState(cursor.row);
13418
13250
  var line = session.getLine(cursor.row);
13419
13251
  var shouldOutdent = mode.checkOutdent(lineState, line, text);
13420
- var end = session.insert(cursor, text);
13252
+ session.insert(cursor, text);
13421
13253
 
13422
13254
  if (transform && transform.selection) {
13423
13255
  if (transform.selection.length == 2) { // Transform relative to the current column
@@ -13432,16 +13264,62 @@ Editor.$uid = 0;
13432
13264
  transform.selection[3]));
13433
13265
  }
13434
13266
  }
13267
+ if (this.$enableAutoIndent) {
13268
+ if (session.getDocument().isNewLine(text)) {
13269
+ var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
13270
+
13271
+ session.insert({row: cursor.row+1, column: 0}, lineIndent);
13272
+ }
13273
+ if (shouldOutdent)
13274
+ mode.autoOutdent(lineState, session, cursor.row);
13275
+ }
13276
+ };
13277
+
13278
+ this.autoIndent = function () {
13279
+ var session = this.session;
13280
+ var mode = session.getMode();
13281
+
13282
+ var startRow, endRow;
13283
+ if (this.selection.isEmpty()) {
13284
+ startRow = 0;
13285
+ endRow = session.doc.getLength() - 1;
13286
+ } else {
13287
+ var selectedRange = this.getSelectionRange();
13288
+
13289
+ startRow = selectedRange.start.row;
13290
+ endRow = selectedRange.end.row;
13291
+ }
13292
+
13293
+ var prevLineState = "";
13294
+ var prevLine = "";
13295
+ var lineIndent = "";
13296
+ var line, currIndent, range;
13297
+ var tab = session.getTabString();
13298
+
13299
+ for (var row = startRow; row <= endRow; row++) {
13300
+ if (row > 0) {
13301
+ prevLineState = session.getState(row - 1);
13302
+ prevLine = session.getLine(row - 1);
13303
+ lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab);
13304
+ }
13435
13305
 
13436
- if (session.getDocument().isNewLine(text)) {
13437
- var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
13306
+ line = session.getLine(row);
13307
+ currIndent = mode.$getIndent(line);
13308
+ if (lineIndent !== currIndent) {
13309
+ if (currIndent.length > 0) {
13310
+ range = new Range(row, 0, row, currIndent.length);
13311
+ session.remove(range);
13312
+ }
13313
+ if (lineIndent.length > 0) {
13314
+ session.insert({row: row, column: 0}, lineIndent);
13315
+ }
13316
+ }
13438
13317
 
13439
- session.insert({row: cursor.row+1, column: 0}, lineIndent);
13318
+ mode.autoOutdent(prevLineState, session, row);
13440
13319
  }
13441
- if (shouldOutdent)
13442
- mode.autoOutdent(lineState, session, cursor.row);
13443
13320
  };
13444
13321
 
13322
+
13445
13323
  this.onTextInput = function(text, composition) {
13446
13324
  if (!composition)
13447
13325
  return this.keyBinding.onTextInput(text);
@@ -13460,6 +13338,10 @@ Editor.$uid = 0;
13460
13338
  var r = this.selection.getRange();
13461
13339
  r.start.column -= composition.extendLeft;
13462
13340
  r.end.column += composition.extendRight;
13341
+ if (r.start.column < 0) {
13342
+ r.start.row--;
13343
+ r.start.column += this.session.getLine(r.start.row).length + 1;
13344
+ }
13463
13345
  this.selection.setRange(r);
13464
13346
  if (!text && !r.isEmpty())
13465
13347
  this.remove();
@@ -13475,7 +13357,7 @@ Editor.$uid = 0;
13475
13357
  };
13476
13358
 
13477
13359
  this.onCommandKey = function(e, hashId, keyCode) {
13478
- this.keyBinding.onCommandKey(e, hashId, keyCode);
13360
+ return this.keyBinding.onCommandKey(e, hashId, keyCode);
13479
13361
  };
13480
13362
  this.setOverwrite = function(overwrite) {
13481
13363
  this.session.setOverwrite(overwrite);
@@ -13859,6 +13741,7 @@ Editor.$uid = 0;
13859
13741
  ["up", "down"],
13860
13742
  ["before", "after"],
13861
13743
  ["even", "odd"],
13744
+ ["in", "out"],
13862
13745
  ["inside", "outside"],
13863
13746
  ["next", "previous"],
13864
13747
  ["increase", "decrease"],
@@ -14464,11 +14347,21 @@ Editor.$uid = 0;
14464
14347
  this.renderer.scrollCursorIntoView(null, 0.5);
14465
14348
  };
14466
14349
  this.destroy = function() {
14350
+ if (this.$toDestroy) {
14351
+ this.$toDestroy.forEach(function(el) {
14352
+ el.destroy();
14353
+ });
14354
+ this.$toDestroy = null;
14355
+ }
14356
+ if (this.$mouseHandler)
14357
+ this.$mouseHandler.destroy();
14467
14358
  this.renderer.destroy();
14468
14359
  this._signal("destroy", this);
14469
- if (this.session) {
14360
+ if (this.session)
14470
14361
  this.session.destroy();
14471
- }
14362
+ if (this._$emitInputEvent)
14363
+ this._$emitInputEvent.cancel();
14364
+ this.removeAllListeners();
14472
14365
  };
14473
14366
  this.setAutoScrollEditorIntoView = function(enable) {
14474
14367
  if (!enable)
@@ -14533,6 +14426,12 @@ Editor.$uid = 0;
14533
14426
  cursorLayer.isBlinking = !this.$readOnly && style != "wide";
14534
14427
  dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
14535
14428
  };
14429
+ this.prompt = function(message, options, callback) {
14430
+ var editor = this;
14431
+ config.loadModule("./ext/prompt", function (module) {
14432
+ module.prompt(editor, message, options, callback);
14433
+ });
14434
+ };
14536
14435
 
14537
14436
  }).call(Editor.prototype);
14538
14437
 
@@ -14578,6 +14477,7 @@ config.defineOptions(Editor.prototype, "editor", {
14578
14477
  },
14579
14478
  behavioursEnabled: {initialValue: true},
14580
14479
  wrapBehavioursEnabled: {initialValue: true},
14480
+ enableAutoIndent: {initialValue: true},
14581
14481
  autoScrollEditorIntoView: {
14582
14482
  set: function(val) {this.setAutoScrollEditorIntoView(val);}
14583
14483
  },
@@ -14618,6 +14518,33 @@ config.defineOptions(Editor.prototype, "editor", {
14618
14518
  relativeNumberRenderer.detach(this);
14619
14519
  }
14620
14520
  },
14521
+ placeholder: {
14522
+ set: function(message) {
14523
+ if (!this.$updatePlaceholder) {
14524
+ this.$updatePlaceholder = function() {
14525
+ var value = this.session && (this.renderer.$composition || this.getValue());
14526
+ if (value && this.renderer.placeholderNode) {
14527
+ this.renderer.off("afterRender", this.$updatePlaceholder);
14528
+ dom.removeCssClass(this.container, "ace_hasPlaceholder");
14529
+ this.renderer.placeholderNode.remove();
14530
+ this.renderer.placeholderNode = null;
14531
+ } else if (!value && !this.renderer.placeholderNode) {
14532
+ this.renderer.on("afterRender", this.$updatePlaceholder);
14533
+ dom.addCssClass(this.container, "ace_hasPlaceholder");
14534
+ var el = dom.createElement("div");
14535
+ el.className = "ace_placeholder";
14536
+ el.textContent = this.$placeholder || "";
14537
+ this.renderer.placeholderNode = el;
14538
+ this.renderer.content.appendChild(this.renderer.placeholderNode);
14539
+ } else if (!value && this.renderer.placeholderNode) {
14540
+ this.renderer.placeholderNode.textContent = this.$placeholder || "";
14541
+ }
14542
+ }.bind(this);
14543
+ this.on("input", this.$updatePlaceholder);
14544
+ }
14545
+ this.$updatePlaceholder();
14546
+ }
14547
+ },
14621
14548
 
14622
14549
  hScrollBarAlwaysVisible: "renderer",
14623
14550
  vScrollBarAlwaysVisible: "renderer",
@@ -14708,6 +14635,7 @@ var UndoManager = function() {
14708
14635
  this.add = function(delta, allowMerge, session) {
14709
14636
  if (this.$fromUndo) return;
14710
14637
  if (delta == this.$lastDelta) return;
14638
+ if (!this.$keepRedoStack) this.$redoStack.length = 0;
14711
14639
  if (allowMerge === false || !this.lastDeltas) {
14712
14640
  this.lastDeltas = [];
14713
14641
  this.$undoStack.push(this.lastDeltas);
@@ -14801,7 +14729,7 @@ var UndoManager = function() {
14801
14729
 
14802
14730
  var deltaSet = stack.pop();
14803
14731
  var undoSelectionRange = null;
14804
- if (deltaSet && deltaSet.length) {
14732
+ if (deltaSet) {
14805
14733
  undoSelectionRange = session.undoChanges(deltaSet, dontSelect);
14806
14734
  this.$redoStack.push(deltaSet);
14807
14735
  this.$syncRev();
@@ -15208,7 +15136,7 @@ var Lines = function(element, canvasHeight) {
15208
15136
  };
15209
15137
 
15210
15138
  this.computeLineHeight = function(row, config, session) {
15211
- return config.lineHeight * session.getRowLength(row);
15139
+ return config.lineHeight * session.getRowLineCount(row);
15212
15140
  };
15213
15141
 
15214
15142
  this.getLength = function() {
@@ -15235,10 +15163,10 @@ var Lines = function(element, canvasHeight) {
15235
15163
  fragment.appendChild(cell[i].element);
15236
15164
  }
15237
15165
  this.element.appendChild(fragment);
15238
- } else {
15166
+ } else {
15239
15167
  this.cells.push(cell);
15240
15168
  this.element.appendChild(cell.element);
15241
- }
15169
+ }
15242
15170
  };
15243
15171
 
15244
15172
  this.unshift = function(cell) {
@@ -15252,10 +15180,10 @@ var Lines = function(element, canvasHeight) {
15252
15180
  this.element.insertBefore(fragment, this.element.firstChild);
15253
15181
  else
15254
15182
  this.element.appendChild(fragment);
15255
- } else {
15183
+ } else {
15256
15184
  this.cells.unshift(cell);
15257
15185
  this.element.insertAdjacentElement("afterbegin", cell.element);
15258
- }
15186
+ }
15259
15187
  };
15260
15188
 
15261
15189
  this.last = function() {
@@ -15329,7 +15257,7 @@ var Gutter = function(parentEl) {
15329
15257
 
15330
15258
  this.setSession = function(session) {
15331
15259
  if (this.session)
15332
- this.session.removeEventListener("change", this.$updateAnnotations);
15260
+ this.session.off("change", this.$updateAnnotations);
15333
15261
  this.session = session;
15334
15262
  if (session)
15335
15263
  session.on("change", this.$updateAnnotations);
@@ -16018,11 +15946,21 @@ var Text = function(parentEl) {
16018
15946
  };
16019
15947
 
16020
15948
  this.showInvisibles = false;
15949
+ this.showSpaces = false;
15950
+ this.showTabs = false;
15951
+ this.showEOL = false;
16021
15952
  this.setShowInvisibles = function(showInvisibles) {
16022
15953
  if (this.showInvisibles == showInvisibles)
16023
15954
  return false;
16024
15955
 
16025
15956
  this.showInvisibles = showInvisibles;
15957
+ if (typeof showInvisibles == "string") {
15958
+ this.showSpaces = /tab/i.test(showInvisibles);
15959
+ this.showTabs = /space/i.test(showInvisibles);
15960
+ this.showEOL = /eol/i.test(showInvisibles);
15961
+ } else {
15962
+ this.showSpaces = this.showTabs = this.showEOL = showInvisibles;
15963
+ }
16026
15964
  this.$computeTabString();
16027
15965
  return true;
16028
15966
  };
@@ -16044,7 +15982,7 @@ var Text = function(parentEl) {
16044
15982
  this.tabSize = tabSize;
16045
15983
  var tabStr = this.$tabStrings = [0];
16046
15984
  for (var i = 1; i < tabSize + 1; i++) {
16047
- if (this.showInvisibles) {
15985
+ if (this.showTabs) {
16048
15986
  var span = this.dom.createElement("span");
16049
15987
  span.className = "ace_invisible ace_invisible_tab";
16050
15988
  span.textContent = lang.stringRepeat(this.TAB_CHAR, i);
@@ -16056,18 +15994,15 @@ var Text = function(parentEl) {
16056
15994
  if (this.displayIndentGuides) {
16057
15995
  this.$indentGuideRe = /\s\S| \t|\t |\s$/;
16058
15996
  var className = "ace_indent-guide";
16059
- var spaceClass = "";
16060
- var tabClass = "";
16061
- if (this.showInvisibles) {
16062
- className += " ace_invisible";
16063
- spaceClass = " ace_invisible_space";
16064
- tabClass = " ace_invisible_tab";
16065
- var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
16066
- var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize);
16067
- } else {
16068
- var spaceContent = lang.stringRepeat(" ", this.tabSize);
16069
- var tabContent = spaceContent;
16070
- }
15997
+ var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : "";
15998
+ var spaceContent = this.showSpaces
15999
+ ? lang.stringRepeat(this.SPACE_CHAR, this.tabSize)
16000
+ : lang.stringRepeat(" ", this.tabSize);
16001
+
16002
+ var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : "";
16003
+ var tabContent = this.showTabs
16004
+ ? lang.stringRepeat(this.TAB_CHAR, this.tabSize)
16005
+ : spaceContent;
16071
16006
 
16072
16007
  var span = this.dom.createElement("span");
16073
16008
  span.className = className + spaceClass;
@@ -16128,6 +16063,10 @@ var Text = function(parentEl) {
16128
16063
  this.$renderLine(
16129
16064
  lineElement, row, row == foldStart ? foldLine : false
16130
16065
  );
16066
+
16067
+ if (heightChanged)
16068
+ lineElement.style.top = this.$lines.computeLineTop(row, config, this.session) + "px";
16069
+
16131
16070
  var height = (config.lineHeight * this.session.getRowLength(row)) + "px";
16132
16071
  if (lineElement.style.height != height) {
16133
16072
  heightChanged = true;
@@ -16256,7 +16195,7 @@ var Text = function(parentEl) {
16256
16195
  var cjkSpace = m[4];
16257
16196
  var cjk = m[5];
16258
16197
 
16259
- if (!self.showInvisibles && simpleSpace)
16198
+ if (!self.showSpaces && simpleSpace)
16260
16199
  continue;
16261
16200
 
16262
16201
  var before = i != m.index ? value.slice(i, m.index) : "";
@@ -16272,7 +16211,7 @@ var Text = function(parentEl) {
16272
16211
  valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(true));
16273
16212
  screenColumn += tabSize - 1;
16274
16213
  } else if (simpleSpace) {
16275
- if (self.showInvisibles) {
16214
+ if (self.showSpaces) {
16276
16215
  var span = this.dom.createElement("span");
16277
16216
  span.className = "ace_invisible ace_invisible_space";
16278
16217
  span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length);
@@ -16286,17 +16225,16 @@ var Text = function(parentEl) {
16286
16225
  span.textContent = lang.stringRepeat(self.SPACE_CHAR, controlCharacter.length);
16287
16226
  valueFragment.appendChild(span);
16288
16227
  } else if (cjkSpace) {
16289
- var space = self.showInvisibles ? self.SPACE_CHAR : "";
16290
16228
  screenColumn += 1;
16291
16229
 
16292
16230
  var span = this.dom.createElement("span");
16293
16231
  span.style.width = (self.config.characterWidth * 2) + "px";
16294
- span.className = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
16295
- span.textContent = self.showInvisibles ? self.SPACE_CHAR : "";
16232
+ span.className = self.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
16233
+ span.textContent = self.showSpaces ? self.SPACE_CHAR : cjkSpace;
16296
16234
  valueFragment.appendChild(span);
16297
16235
  } else if (cjk) {
16298
16236
  screenColumn += 1;
16299
- var span = dom.createElement("span");
16237
+ var span = this.dom.createElement("span");
16300
16238
  span.style.width = (self.config.characterWidth * 2) + "px";
16301
16239
  span.className = "ace_cjk";
16302
16240
  span.textContent = cjk;
@@ -16401,6 +16339,9 @@ var Text = function(parentEl) {
16401
16339
  }
16402
16340
  }
16403
16341
  }
16342
+
16343
+ if (splits[splits.length - 1] > this.MAX_LINE_LENGTH)
16344
+ this.$renderOverflowMessage(lineEl, screenColumn, null, "", true);
16404
16345
  };
16405
16346
 
16406
16347
  this.$renderSimpleLine = function(parent, tokens) {
@@ -16420,15 +16361,13 @@ var Text = function(parentEl) {
16420
16361
  }
16421
16362
  };
16422
16363
 
16423
- this.$renderOverflowMessage = function(parent, screenColumn, token, value) {
16424
- this.$renderToken(parent, screenColumn, token,
16364
+ this.$renderOverflowMessage = function(parent, screenColumn, token, value, hide) {
16365
+ token && this.$renderToken(parent, screenColumn, token,
16425
16366
  value.slice(0, this.MAX_LINE_LENGTH - screenColumn));
16426
16367
 
16427
16368
  var overflowEl = this.dom.createElement("span");
16428
16369
  overflowEl.className = "ace_inline_button ace_keyword ace_toggle_wrap";
16429
- overflowEl.style.position = "absolute";
16430
- overflowEl.style.right = "0";
16431
- overflowEl.textContent = "<click to see more...>";
16370
+ overflowEl.textContent = hide ? "<hide>" : "<click to see more...>";
16432
16371
 
16433
16372
  parent.appendChild(overflowEl);
16434
16373
  };
@@ -16460,7 +16399,7 @@ var Text = function(parentEl) {
16460
16399
  parent.appendChild(lastLineEl);
16461
16400
  }
16462
16401
 
16463
- if (this.showInvisibles && lastLineEl) {
16402
+ if (this.showEOL && lastLineEl) {
16464
16403
  if (foldLine)
16465
16404
  row = foldLine.end.row;
16466
16405
 
@@ -16786,6 +16725,7 @@ var ScrollBar = function(parent) {
16786
16725
 
16787
16726
  this.inner = dom.createElement("div");
16788
16727
  this.inner.className = "ace_scrollbar-inner";
16728
+ this.inner.textContent = "\xa0";
16789
16729
  this.element.appendChild(this.inner);
16790
16730
 
16791
16731
  parent.appendChild(this.element);
@@ -16990,7 +16930,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) {
16990
16930
  this.el.appendChild(this.$measureNode);
16991
16931
  parentEl.appendChild(this.el);
16992
16932
 
16993
- this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT);
16933
+ this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT);
16994
16934
 
16995
16935
  this.$characterSize = {width: 0, height: 0};
16996
16936
 
@@ -17039,11 +16979,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) {
17039
16979
  this.$addObserver = function() {
17040
16980
  var self = this;
17041
16981
  this.$observer = new window.ResizeObserver(function(e) {
17042
- var rect = e[0].contentRect;
17043
- self.checkForSizeChanges({
17044
- height: rect.height,
17045
- width: rect.width / CHAR_COUNT
17046
- });
16982
+ self.checkForSizeChanges();
17047
16983
  });
17048
16984
  this.$observer.observe(this.$measureNode);
17049
16985
  };
@@ -17079,7 +17015,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) {
17079
17015
  };
17080
17016
 
17081
17017
  this.$measureCharWidth = function(ch) {
17082
- this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);
17018
+ this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT);
17083
17019
  var rect = this.$main.getBoundingClientRect();
17084
17020
  return rect.width / CHAR_COUNT;
17085
17021
  };
@@ -17102,7 +17038,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl) {
17102
17038
 
17103
17039
 
17104
17040
  this.$getZoom = function getZoom(element) {
17105
- if (!element) return 1;
17041
+ if (!element || !element.parentElement) return 1;
17106
17042
  return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement);
17107
17043
  };
17108
17044
  this.$initTransformMeasureNodes = function() {
@@ -17196,6 +17132,7 @@ var editorCss = "\
17196
17132
  .ace_editor {\
17197
17133
  position: relative;\
17198
17134
  overflow: hidden;\
17135
+ padding: 0;\
17199
17136
  font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
17200
17137
  direction: ltr;\
17201
17138
  text-align: left;\
@@ -17218,6 +17155,7 @@ position: absolute;\
17218
17155
  box-sizing: border-box;\
17219
17156
  min-width: 100%;\
17220
17157
  contain: style size layout;\
17158
+ font-variant-ligatures: no-common-ligatures;\
17221
17159
  }\
17222
17160
  .ace_dragging .ace_scroller:before{\
17223
17161
  position: absolute;\
@@ -17349,7 +17287,6 @@ margin-top: 1px;\
17349
17287
  [ace_nocontext=true] {\
17350
17288
  transform: none!important;\
17351
17289
  filter: none!important;\
17352
- perspective: none!important;\
17353
17290
  clip-path: none!important;\
17354
17291
  mask : none!important;\
17355
17292
  contain: none!important;\
@@ -17428,6 +17365,9 @@ border-bottom: 1px solid;\
17428
17365
  .ace_hidden-cursors .ace_cursor {\
17429
17366
  opacity: 0.2;\
17430
17367
  }\
17368
+ .ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\
17369
+ opacity: 0;\
17370
+ }\
17431
17371
  .ace_smooth-blinking .ace_cursor {\
17432
17372
  transition: opacity 0.18s;\
17433
17373
  }\
@@ -17464,6 +17404,11 @@ z-index: 5;\
17464
17404
  position: absolute;\
17465
17405
  z-index: 6;\
17466
17406
  }\
17407
+ .ace_marker-layer .ace_error_bracket {\
17408
+ position: absolute;\
17409
+ border-bottom: 1px solid #DE5555;\
17410
+ border-radius: 0;\
17411
+ }\
17467
17412
  .ace_marker-layer .ace_active-line {\
17468
17413
  position: absolute;\
17469
17414
  z-index: 2;\
@@ -17617,7 +17562,45 @@ background-color: rgba(255, 255, 0,0.2);\
17617
17562
  position: absolute;\
17618
17563
  z-index: 8;\
17619
17564
  }\
17620
- ";
17565
+ .ace_mobile-menu {\
17566
+ position: absolute;\
17567
+ line-height: 1.5;\
17568
+ border-radius: 4px;\
17569
+ -ms-user-select: none;\
17570
+ -moz-user-select: none;\
17571
+ -webkit-user-select: none;\
17572
+ user-select: none;\
17573
+ background: white;\
17574
+ box-shadow: 1px 3px 2px grey;\
17575
+ border: 1px solid #dcdcdc;\
17576
+ color: black;\
17577
+ }\
17578
+ .ace_dark > .ace_mobile-menu {\
17579
+ background: #333;\
17580
+ color: #ccc;\
17581
+ box-shadow: 1px 3px 2px grey;\
17582
+ border: 1px solid #444;\
17583
+ }\
17584
+ .ace_mobile-button {\
17585
+ padding: 2px;\
17586
+ cursor: pointer;\
17587
+ overflow: hidden;\
17588
+ }\
17589
+ .ace_mobile-button:hover {\
17590
+ background-color: #eee;\
17591
+ opacity:1;\
17592
+ }\
17593
+ .ace_mobile-button:active {\
17594
+ background-color: #ddd;\
17595
+ }\
17596
+ .ace_placeholder {\
17597
+ font-family: arial;\
17598
+ transform: scale(0.9);\
17599
+ transform-origin: left;\
17600
+ white-space: pre;\
17601
+ opacity: 0.7;\
17602
+ margin: 0 10px;\
17603
+ }";
17621
17604
 
17622
17605
  var useragent = require("./lib/useragent");
17623
17606
  var HIDE_TEXTAREA = useragent.isIE;
@@ -17665,11 +17648,11 @@ var VirtualRenderer = function(container, theme) {
17665
17648
  this.scrollBar =
17666
17649
  this.scrollBarV = new VScrollBar(this.container, this);
17667
17650
  this.scrollBarH = new HScrollBar(this.container, this);
17668
- this.scrollBarV.addEventListener("scroll", function(e) {
17651
+ this.scrollBarV.on("scroll", function(e) {
17669
17652
  if (!_self.$scrollAnimation)
17670
17653
  _self.session.setScrollTop(e.data - _self.scrollMargin.top);
17671
17654
  });
17672
- this.scrollBarH.addEventListener("scroll", function(e) {
17655
+ this.scrollBarH.on("scroll", function(e) {
17673
17656
  if (!_self.$scrollAnimation)
17674
17657
  _self.session.setScrollLeft(e.data - _self.scrollMargin.left);
17675
17658
  });
@@ -17684,7 +17667,7 @@ var VirtualRenderer = function(container, theme) {
17684
17667
 
17685
17668
  this.$fontMetrics = new FontMetrics(this.container);
17686
17669
  this.$textLayer.$setFontMetrics(this.$fontMetrics);
17687
- this.$textLayer.addEventListener("changeCharacterSize", function(e) {
17670
+ this.$textLayer.on("changeCharacterSize", function(e) {
17688
17671
  _self.updateCharacterSize();
17689
17672
  _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
17690
17673
  _self._signal("changeCharacterSize", e);
@@ -17742,7 +17725,7 @@ var VirtualRenderer = function(container, theme) {
17742
17725
  this.updateCharacterSize();
17743
17726
  this.setPadding(4);
17744
17727
  config.resetOptions(this);
17745
- config._emit("renderer", this);
17728
+ config._signal("renderer", this);
17746
17729
  };
17747
17730
 
17748
17731
  (function() {
@@ -17772,6 +17755,7 @@ var VirtualRenderer = function(container, theme) {
17772
17755
  this.layerConfig.lineHeight =
17773
17756
  this.lineHeight = this.$textLayer.getLineHeight();
17774
17757
  this.$updatePrintMargin();
17758
+ dom.setStyle(this.scroller.style, "line-height", this.lineHeight + "px");
17775
17759
  };
17776
17760
  this.setSession = function(session) {
17777
17761
  if (this.session)
@@ -18043,15 +18027,16 @@ var VirtualRenderer = function(container, theme) {
18043
18027
  return this.container;
18044
18028
  };
18045
18029
  this.$moveTextAreaToCursor = function() {
18030
+ if (this.$isMousePressed) return;
18046
18031
  var style = this.textarea.style;
18047
- if (!this.$keepTextAreaAtCursor) {
18032
+ var composition = this.$composition;
18033
+ if (!this.$keepTextAreaAtCursor && !composition) {
18048
18034
  dom.translate(this.textarea, -100, 0);
18049
18035
  return;
18050
18036
  }
18051
18037
  var pixelPos = this.$cursorLayer.$pixelPos;
18052
18038
  if (!pixelPos)
18053
18039
  return;
18054
- var composition = this.$composition;
18055
18040
  if (composition && composition.markerRange)
18056
18041
  pixelPos = this.$cursorLayer.getPixelPosition(composition.markerRange.start, true);
18057
18042
 
@@ -18067,6 +18052,7 @@ var VirtualRenderer = function(container, theme) {
18067
18052
  }
18068
18053
 
18069
18054
  var w = 1;
18055
+ var maxTop = this.$size.height - h;
18070
18056
  if (!composition) {
18071
18057
  posTop += this.lineHeight;
18072
18058
  }
@@ -18074,7 +18060,6 @@ var VirtualRenderer = function(container, theme) {
18074
18060
  if (composition.useTextareaForIME) {
18075
18061
  var val = this.textarea.value;
18076
18062
  w = this.characterWidth * (this.session.$getStringScreenWidth(val)[0]);
18077
- h += 2;
18078
18063
  }
18079
18064
  else {
18080
18065
  posTop += this.lineHeight + 2;
@@ -18089,7 +18074,7 @@ var VirtualRenderer = function(container, theme) {
18089
18074
 
18090
18075
  dom.setStyle(style, "height", h + "px");
18091
18076
  dom.setStyle(style, "width", w + "px");
18092
- dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, this.$size.height - h));
18077
+ dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, maxTop));
18093
18078
  };
18094
18079
  this.getFirstVisibleRow = function() {
18095
18080
  return this.layerConfig.firstRow;
@@ -18201,7 +18186,7 @@ var VirtualRenderer = function(container, theme) {
18201
18186
  this.$textLayer.checkForSizeChanges();
18202
18187
  }
18203
18188
 
18204
- this._signal("beforeRender");
18189
+ this._signal("beforeRender", changes);
18205
18190
 
18206
18191
  if (this.session && this.session.$bidiHandler)
18207
18192
  this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
@@ -18241,6 +18226,7 @@ var VirtualRenderer = function(container, theme) {
18241
18226
  this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
18242
18227
  }
18243
18228
  if (changes & this.CHANGE_FULL) {
18229
+ this.$changedLines = null;
18244
18230
  this.$textLayer.update(config);
18245
18231
  if (this.$showGutter)
18246
18232
  this.$gutterLayer.update(config);
@@ -18248,10 +18234,11 @@ var VirtualRenderer = function(container, theme) {
18248
18234
  this.$markerFront.update(config);
18249
18235
  this.$cursorLayer.update(config);
18250
18236
  this.$moveTextAreaToCursor();
18251
- this._signal("afterRender");
18237
+ this._signal("afterRender", changes);
18252
18238
  return;
18253
18239
  }
18254
18240
  if (changes & this.CHANGE_SCROLL) {
18241
+ this.$changedLines = null;
18255
18242
  if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
18256
18243
  this.$textLayer.update(config);
18257
18244
  else
@@ -18267,11 +18254,12 @@ var VirtualRenderer = function(container, theme) {
18267
18254
  this.$markerFront.update(config);
18268
18255
  this.$cursorLayer.update(config);
18269
18256
  this.$moveTextAreaToCursor();
18270
- this._signal("afterRender");
18257
+ this._signal("afterRender", changes);
18271
18258
  return;
18272
18259
  }
18273
18260
 
18274
18261
  if (changes & this.CHANGE_TEXT) {
18262
+ this.$changedLines = null;
18275
18263
  this.$textLayer.update(config);
18276
18264
  if (this.$showGutter)
18277
18265
  this.$gutterLayer.update(config);
@@ -18302,7 +18290,7 @@ var VirtualRenderer = function(container, theme) {
18302
18290
  this.$markerBack.update(config);
18303
18291
  }
18304
18292
 
18305
- this._signal("afterRender");
18293
+ this._signal("afterRender", changes);
18306
18294
  };
18307
18295
 
18308
18296
 
@@ -18405,7 +18393,7 @@ var VirtualRenderer = function(container, theme) {
18405
18393
  if (this.layerConfig.width != longestLine || hScrollChanged)
18406
18394
  changes = this.CHANGE_H_SCROLL;
18407
18395
  if (hScrollChanged || vScrollChanged) {
18408
- changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
18396
+ changes |= this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
18409
18397
  this._signal("scrollbarVisibilityChanged");
18410
18398
  if (vScrollChanged)
18411
18399
  longestLine = this.$getLongestLine();
@@ -18616,6 +18604,8 @@ var VirtualRenderer = function(container, theme) {
18616
18604
  _self.session.setScrollTop(steps.shift());
18617
18605
  _self.session.$scrollTop = toValue;
18618
18606
  this.$timer = setInterval(function() {
18607
+ if (!_self.session)
18608
+ return clearInterval(_self.$timer);
18619
18609
  if (steps.length) {
18620
18610
  _self.session.setScrollTop(steps.shift());
18621
18611
  _self.session.$scrollTop = toValue;
@@ -18725,18 +18715,17 @@ var VirtualRenderer = function(container, theme) {
18725
18715
  this.$composition = composition;
18726
18716
  if (!composition.cssText) {
18727
18717
  composition.cssText = this.textarea.style.cssText;
18728
- composition.keepTextAreaAtCursor = this.$keepTextAreaAtCursor;
18729
18718
  }
18730
- composition.useTextareaForIME = this.$useTextareaForIME;
18719
+ if (composition.useTextareaForIME == undefined)
18720
+ composition.useTextareaForIME = this.$useTextareaForIME;
18731
18721
 
18732
18722
  if (this.$useTextareaForIME) {
18733
- this.$keepTextAreaAtCursor = true;
18734
18723
  dom.addCssClass(this.textarea, "ace_composition");
18735
18724
  this.textarea.style.cssText = "";
18736
18725
  this.$moveTextAreaToCursor();
18737
18726
  this.$cursorLayer.element.style.display = "none";
18738
18727
  }
18739
- else {
18728
+ else {
18740
18729
  composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
18741
18730
  }
18742
18731
  };
@@ -18753,8 +18742,9 @@ var VirtualRenderer = function(container, theme) {
18753
18742
  this.session.removeMarker(this.$composition.markerId);
18754
18743
 
18755
18744
  dom.removeCssClass(this.textarea, "ace_composition");
18756
- this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;
18757
18745
  this.textarea.style.cssText = this.$composition.cssText;
18746
+ var cursor = this.session.selection.cursor;
18747
+ this.removeExtraToken(cursor.row, cursor.column);
18758
18748
  this.$composition = null;
18759
18749
  this.$cursorLayer.element.style.display = "";
18760
18750
  };
@@ -18783,6 +18773,10 @@ var VirtualRenderer = function(container, theme) {
18783
18773
  }
18784
18774
  this.updateLines(row, row);
18785
18775
  };
18776
+
18777
+ this.removeExtraToken = function(row, column) {
18778
+ this.updateLines(row, row);
18779
+ };
18786
18780
  this.setTheme = function(theme, cb) {
18787
18781
  var _self = this;
18788
18782
  this.$themeId = theme;
@@ -18850,8 +18844,11 @@ var VirtualRenderer = function(container, theme) {
18850
18844
  dom.importCssString(editorCss, "ace_editor.css", this.container);
18851
18845
  };
18852
18846
  this.destroy = function() {
18847
+ this.freeze();
18853
18848
  this.$fontMetrics.destroy();
18854
18849
  this.$cursorLayer.destroy();
18850
+ this.removeAllListeners();
18851
+ this.container.textContent = "";
18855
18852
  };
18856
18853
 
18857
18854
  }).call(VirtualRenderer.prototype);
@@ -19378,8 +19375,8 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
19378
19375
  this.detach = function() {
19379
19376
  this.session.removeMarker(this.pos && this.pos.markerId);
19380
19377
  this.hideOtherMarkers();
19381
- this.doc.removeEventListener("change", this.$onUpdate);
19382
- this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
19378
+ this.doc.off("change", this.$onUpdate);
19379
+ this.session.selection.off("changeCursor", this.$onCursorChange);
19383
19380
  this.session.setUndoSelect(true);
19384
19381
  this.session = null;
19385
19382
  };
@@ -19575,64 +19572,85 @@ exports.onMouseDown = onMouseDown;
19575
19572
  define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"], function(require, exports, module) {
19576
19573
  exports.defaultCommands = [{
19577
19574
  name: "addCursorAbove",
19575
+ description: "Add cursor above",
19578
19576
  exec: function(editor) { editor.selectMoreLines(-1); },
19579
19577
  bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
19580
19578
  scrollIntoView: "cursor",
19581
19579
  readOnly: true
19582
19580
  }, {
19583
19581
  name: "addCursorBelow",
19582
+ description: "Add cursor below",
19584
19583
  exec: function(editor) { editor.selectMoreLines(1); },
19585
19584
  bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
19586
19585
  scrollIntoView: "cursor",
19587
19586
  readOnly: true
19588
19587
  }, {
19589
19588
  name: "addCursorAboveSkipCurrent",
19589
+ description: "Add cursor above (skip current)",
19590
19590
  exec: function(editor) { editor.selectMoreLines(-1, true); },
19591
19591
  bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
19592
19592
  scrollIntoView: "cursor",
19593
19593
  readOnly: true
19594
19594
  }, {
19595
19595
  name: "addCursorBelowSkipCurrent",
19596
+ description: "Add cursor below (skip current)",
19596
19597
  exec: function(editor) { editor.selectMoreLines(1, true); },
19597
19598
  bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
19598
19599
  scrollIntoView: "cursor",
19599
19600
  readOnly: true
19600
19601
  }, {
19601
19602
  name: "selectMoreBefore",
19603
+ description: "Select more before",
19602
19604
  exec: function(editor) { editor.selectMore(-1); },
19603
19605
  bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
19604
19606
  scrollIntoView: "cursor",
19605
19607
  readOnly: true
19606
19608
  }, {
19607
19609
  name: "selectMoreAfter",
19610
+ description: "Select more after",
19608
19611
  exec: function(editor) { editor.selectMore(1); },
19609
19612
  bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
19610
19613
  scrollIntoView: "cursor",
19611
19614
  readOnly: true
19612
19615
  }, {
19613
19616
  name: "selectNextBefore",
19617
+ description: "Select next before",
19614
19618
  exec: function(editor) { editor.selectMore(-1, true); },
19615
19619
  bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
19616
19620
  scrollIntoView: "cursor",
19617
19621
  readOnly: true
19618
19622
  }, {
19619
19623
  name: "selectNextAfter",
19624
+ description: "Select next after",
19620
19625
  exec: function(editor) { editor.selectMore(1, true); },
19621
19626
  bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
19622
19627
  scrollIntoView: "cursor",
19623
19628
  readOnly: true
19624
19629
  }, {
19625
- name: "splitIntoLines",
19626
- exec: function(editor) { editor.multiSelect.splitIntoLines(); },
19630
+ name: "toggleSplitSelectionIntoLines",
19631
+ description: "Split into lines",
19632
+ exec: function(editor) {
19633
+ if (editor.multiSelect.rangeCount > 1)
19634
+ editor.multiSelect.joinSelections();
19635
+ else
19636
+ editor.multiSelect.splitIntoLines();
19637
+ },
19627
19638
  bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
19628
19639
  readOnly: true
19640
+ }, {
19641
+ name: "splitSelectionIntoLines",
19642
+ description: "Split into lines",
19643
+ exec: function(editor) { editor.multiSelect.splitIntoLines(); },
19644
+ readOnly: true
19629
19645
  }, {
19630
19646
  name: "alignCursors",
19647
+ description: "Align cursors",
19631
19648
  exec: function(editor) { editor.alignCursors(); },
19632
19649
  bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"},
19633
19650
  scrollIntoView: "cursor"
19634
19651
  }, {
19635
19652
  name: "findAll",
19653
+ description: "Find all",
19636
19654
  exec: function(editor) { editor.findAll(); },
19637
19655
  bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
19638
19656
  scrollIntoView: "cursor",
@@ -19640,6 +19658,7 @@ exports.defaultCommands = [{
19640
19658
  }];
19641
19659
  exports.multiSelectCommands = [{
19642
19660
  name: "singleSelection",
19661
+ description: "Single selection",
19643
19662
  bindKey: "esc",
19644
19663
  exec: function(editor) { editor.exitMultiSelectMode(); },
19645
19664
  scrollIntoView: "cursor",
@@ -19716,7 +19735,6 @@ var EditSession = require("./edit_session").EditSession;
19716
19735
 
19717
19736
  return $blockChangeEvents || this.fromOrientedRange(range);
19718
19737
  };
19719
-
19720
19738
  this.toSingleRange = function(range) {
19721
19739
  range = range || this.ranges[0];
19722
19740
  var removed = this.rangeList.removeAll();
@@ -19781,45 +19799,36 @@ var EditSession = require("./edit_session").EditSession;
19781
19799
  this.getAllRanges = function() {
19782
19800
  return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
19783
19801
  };
19784
-
19785
19802
  this.splitIntoLines = function () {
19786
- if (this.rangeCount > 1) {
19787
- var ranges = this.rangeList.ranges;
19788
- var lastRange = ranges[ranges.length - 1];
19789
- var range = Range.fromPoints(ranges[0].start, lastRange.end);
19790
-
19791
- this.toSingleRange();
19792
- this.setSelectionRange(range, lastRange.cursor == lastRange.start);
19793
- } else {
19794
- var range = this.getRange();
19795
- var isBackwards = this.isBackwards();
19796
- var startRow = range.start.row;
19803
+ var ranges = this.ranges.length ? this.ranges : [this.getRange()];
19804
+ var newRanges = [];
19805
+ for (var i = 0; i < ranges.length; i++) {
19806
+ var range = ranges[i];
19807
+ var row = range.start.row;
19797
19808
  var endRow = range.end.row;
19798
- if (startRow == endRow) {
19799
- if (isBackwards)
19800
- var start = range.end, end = range.start;
19801
- else
19802
- var start = range.start, end = range.end;
19803
-
19804
- this.addRange(Range.fromPoints(end, end));
19805
- this.addRange(Range.fromPoints(start, start));
19806
- return;
19809
+ if (row === endRow) {
19810
+ newRanges.push(range.clone());
19811
+ } else {
19812
+ newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length));
19813
+ while (++row < endRow)
19814
+ newRanges.push(this.getLineRange(row, true));
19815
+ newRanges.push(new Range(endRow, 0, endRow, range.end.column));
19807
19816
  }
19808
-
19809
- var rectSel = [];
19810
- var r = this.getLineRange(startRow, true);
19811
- r.start.column = range.start.column;
19812
- rectSel.push(r);
19813
-
19814
- for (var i = startRow + 1; i < endRow; i++)
19815
- rectSel.push(this.getLineRange(i, true));
19816
-
19817
- r = this.getLineRange(endRow, true);
19818
- r.end.column = range.end.column;
19819
- rectSel.push(r);
19820
-
19821
- rectSel.forEach(this.addRange, this);
19817
+ if (i == 0 && !this.isBackwards())
19818
+ newRanges = newRanges.reverse();
19822
19819
  }
19820
+ this.toSingleRange();
19821
+ for (var i = newRanges.length; i--;)
19822
+ this.addRange(newRanges[i]);
19823
+ };
19824
+
19825
+ this.joinSelections = function () {
19826
+ var ranges = this.rangeList.ranges;
19827
+ var lastRange = ranges[ranges.length - 1];
19828
+ var range = Range.fromPoints(ranges[0].start, lastRange.end);
19829
+
19830
+ this.toSingleRange();
19831
+ this.setSelectionRange(range, lastRange.cursor == lastRange.start);
19823
19832
  };
19824
19833
  this.toggleBlockSelection = function () {
19825
19834
  if (this.rangeCount > 1) {
@@ -20408,6 +20417,7 @@ function MultiSelect(editor) {
20408
20417
  }
20409
20418
 
20410
20419
  function addAltCursorListeners(editor){
20420
+ if (!editor.textInput) return;
20411
20421
  var el = editor.textInput.getElement();
20412
20422
  var altCursor = false;
20413
20423
  event.addListener(el, "keydown", function(e) {
@@ -20420,10 +20430,10 @@ function addAltCursorListeners(editor){
20420
20430
  } else if (altCursor) {
20421
20431
  reset();
20422
20432
  }
20423
- });
20433
+ }, editor);
20424
20434
 
20425
- event.addListener(el, "keyup", reset);
20426
- event.addListener(el, "blur", reset);
20435
+ event.addListener(el, "keyup", reset, editor);
20436
+ event.addListener(el, "blur", reset, editor);
20427
20437
  function reset(e) {
20428
20438
  if (altCursor) {
20429
20439
  editor.renderer.setMouseCursor("");
@@ -20505,8 +20515,11 @@ var FoldMode = exports.FoldMode = function() {};
20505
20515
  if (level == -1)
20506
20516
  continue;
20507
20517
 
20508
- if (level <= startLevel)
20509
- break;
20518
+ if (level <= startLevel) {
20519
+ var token = session.getTokenAt(row, 0);
20520
+ if (!token || token.type !== "string")
20521
+ break;
20522
+ }
20510
20523
 
20511
20524
  endRow = row;
20512
20525
  }
@@ -20681,13 +20694,10 @@ var dom = require("../lib/dom");
20681
20694
  dom.importCssString(exports.cssText, exports.cssClass);
20682
20695
  });
20683
20696
 
20684
- define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"], function(require, exports, module) {
20697
+ define("ace/line_widgets",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
20685
20698
  "use strict";
20686
20699
 
20687
- var oop = require("./lib/oop");
20688
20700
  var dom = require("./lib/dom");
20689
- var Range = require("./range").Range;
20690
-
20691
20701
 
20692
20702
  function LineWidgets(session) {
20693
20703
  this.session = session;
@@ -20801,14 +20811,21 @@ function LineWidgets(session) {
20801
20811
  var len = delta.end.row - startRow;
20802
20812
 
20803
20813
  if (len === 0) {
20804
- } else if (delta.action == 'remove') {
20814
+ } else if (delta.action == "remove") {
20805
20815
  var removed = lineWidgets.splice(startRow + 1, len);
20816
+ if (!lineWidgets[startRow] && removed[removed.length - 1]) {
20817
+ lineWidgets[startRow] = removed.pop();
20818
+ }
20806
20819
  removed.forEach(function(w) {
20807
20820
  w && this.removeLineWidget(w);
20808
20821
  }, this);
20809
20822
  this.$updateRows();
20810
20823
  } else {
20811
20824
  var args = new Array(len);
20825
+ if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {
20826
+ if (delta.start.column > lineWidgets[startRow].column)
20827
+ startRow++;
20828
+ }
20812
20829
  args.unshift(startRow, 0);
20813
20830
  lineWidgets.splice.apply(lineWidgets, args);
20814
20831
  this.$updateRows();
@@ -20833,7 +20850,7 @@ function LineWidgets(session) {
20833
20850
  this.session.lineWidgets = null;
20834
20851
  };
20835
20852
 
20836
- this.addLineWidget = function(w) {
20853
+ this.$registerLineWidget = function(w) {
20837
20854
  if (!this.session.lineWidgets)
20838
20855
  this.session.lineWidgets = new Array(this.session.getLength());
20839
20856
 
@@ -20847,9 +20864,15 @@ function LineWidgets(session) {
20847
20864
  }
20848
20865
 
20849
20866
  this.session.lineWidgets[w.row] = w;
20850
-
20867
+ return w;
20868
+ };
20869
+
20870
+ this.addLineWidget = function(w) {
20871
+ this.$registerLineWidget(w);
20851
20872
  w.session = this.session;
20852
20873
 
20874
+ if (!this.editor) return w;
20875
+
20853
20876
  var renderer = this.editor.renderer;
20854
20877
  if (w.html && !w.el) {
20855
20878
  w.el = dom.createElement("div");
@@ -20861,13 +20884,13 @@ function LineWidgets(session) {
20861
20884
  w.el.style.zIndex = 5;
20862
20885
  renderer.container.appendChild(w.el);
20863
20886
  w._inDocument = true;
20864
- }
20865
-
20866
- if (!w.coverGutter) {
20867
- w.el.style.zIndex = 3;
20868
- }
20869
- if (w.pixelHeight == null) {
20870
- w.pixelHeight = w.el.offsetHeight;
20887
+
20888
+ if (!w.coverGutter) {
20889
+ w.el.style.zIndex = 3;
20890
+ }
20891
+ if (w.pixelHeight == null) {
20892
+ w.pixelHeight = w.el.offsetHeight;
20893
+ }
20871
20894
  }
20872
20895
  if (w.rowCount == null) {
20873
20896
  w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
@@ -21295,7 +21318,7 @@ exports.Editor = Editor;
21295
21318
  exports.EditSession = EditSession;
21296
21319
  exports.UndoManager = UndoManager;
21297
21320
  exports.VirtualRenderer = Renderer;
21298
- exports.version = "1.4.3";
21321
+ exports.version = exports.config.version;
21299
21322
  }); (function() {
21300
21323
  window.require(["ace/ace"], function(a) {
21301
21324
  if (a) {