gollum 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gollum might be problematic. Click here for more details.

Files changed (911) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +4 -5
  3. data/gollum.gemspec +560 -28
  4. data/lib/gollum.rb +1 -1
  5. data/lib/gollum/app.rb +16 -10
  6. data/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +1 -1
  7. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ace.js +33 -11
  8. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/anchor.js +77 -80
  9. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +46 -0
  10. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/autocomplete.js +497 -0
  11. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/autocomplete/popup.js +341 -0
  12. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/autocomplete/text_completer.js +78 -0
  13. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/autocomplete/util.js +74 -0
  14. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +28 -32
  15. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +5 -5
  16. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +17 -20
  17. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +1 -1
  18. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +312 -58
  19. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/incremental_search_commands.js +232 -0
  20. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +17 -1
  21. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/commands/occur_commands.js +110 -0
  22. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/config.js +70 -7
  23. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/config_test.js +67 -3
  24. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +123 -69
  25. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/document.js +118 -71
  26. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +507 -392
  27. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +4 -2
  28. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +37 -5
  29. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +30 -29
  30. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +210 -102
  31. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +82 -8
  32. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor.js +1006 -465
  33. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +2 -2
  34. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +36 -34
  35. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/beautify.js +57 -0
  36. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/beautify/php_rules.js +366 -0
  37. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/chromevox.js +980 -0
  38. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/elastic_tabstops_lite.js +319 -0
  39. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/emmet.js +434 -0
  40. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/error_marker.js +214 -0
  41. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/keybinding_menu.js +86 -0
  42. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/language_tools.js +226 -0
  43. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/linking.js +78 -0
  44. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/add_editor_menu_options.js +109 -0
  45. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/element_generator.js +148 -0
  46. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/generate_settings_menu.js +264 -0
  47. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js +91 -0
  48. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/get_set_functions.js +141 -0
  49. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/overlay_page.js +116 -0
  50. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/menu_tools/settings_menu.css +48 -0
  51. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/modelist.js +195 -0
  52. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/old_ie.js +114 -0
  53. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/old_ie_test.js +77 -0
  54. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/searchbox.css +153 -0
  55. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/searchbox.js +308 -0
  56. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/settings_menu.js +76 -0
  57. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/spellcheck.js +69 -0
  58. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/{keyboard/vim/registers.js → ext/split.js} +8 -10
  59. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static.css +18 -9
  60. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +128 -26
  61. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +56 -36
  62. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/statusbar.js +48 -0
  63. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +112 -117
  64. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/themelist.js +100 -0
  65. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/whitespace.js +213 -0
  66. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/ext/whitespace_test.js +116 -0
  67. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/incremental_search.js +317 -0
  68. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/incremental_search_test.js +213 -0
  69. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +369 -92
  70. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs_test.js +151 -0
  71. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +109 -41
  72. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +35 -24
  73. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding_test.js +69 -0
  74. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +1 -2
  75. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/textarea.js +82 -0
  76. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +337 -208
  77. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +5987 -120
  78. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim_test.js +3866 -0
  79. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +48 -25
  80. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/font_metrics.js +176 -0
  81. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +110 -44
  82. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +29 -14
  83. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +69 -150
  84. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +11 -10
  85. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/app_config.js +157 -0
  86. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +33 -31
  87. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +284 -304
  88. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +147 -95
  89. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +64 -23
  90. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +35 -9
  91. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +30 -13
  92. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +21 -39
  93. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +12 -9
  94. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +8 -4
  95. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/line_widgets.js +297 -0
  96. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/Readme.md +9 -0
  97. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/highlight_rules_test.js +210 -0
  98. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_asciidoc.txt +111 -0
  99. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_coffee.txt +57 -0
  100. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_curly.txt +9 -0
  101. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_html.txt +10 -0
  102. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_javascript.txt +34 -0
  103. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_livescript.txt +1 -0
  104. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_lucene.txt +16 -0
  105. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_markdown.txt +22 -0
  106. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_php.txt +24 -0
  107. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_ruby.txt +34 -0
  108. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_xml.txt +7 -0
  109. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_abap.json +189 -0
  110. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_abc.json +2207 -0
  111. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_actionscript.json +263 -0
  112. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ada.json +39 -0
  113. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_asciidoc.json +422 -0
  114. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_assembly_x86.json +114 -0
  115. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_autohotkey.json +261 -0
  116. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_batchfile.json +70 -0
  117. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c9search.json +131 -175
  118. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c_cpp.json +190 -124
  119. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_cirru.json +267 -0
  120. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_clojure.json +162 -248
  121. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_cobol.json +4 -0
  122. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coffee.json +545 -188
  123. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coldfusion.json +26 -41
  124. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_csharp.json +31 -42
  125. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_css.json +148 -231
  126. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_curly.json +56 -0
  127. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_d.json +111 -0
  128. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_dart.json +368 -0
  129. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_diff.json +262 -732
  130. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_dot.json +2254 -0
  131. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_eiffel.json +141 -0
  132. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ejs.json +296 -0
  133. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_elixir.json +196 -0
  134. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_elm.json +198 -0
  135. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_erlang.json +166 -0
  136. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_forth.json +219 -0
  137. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ftl.json +341 -0
  138. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_gcode.json +296 -0
  139. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_gherkin.json +142 -0
  140. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_gitignore.json +33 -0
  141. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_glsl.json +127 -185
  142. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_golang.json +256 -362
  143. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_groovy.json +410 -529
  144. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haml.json +174 -0
  145. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_handlebars.json +81 -0
  146. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haskell.json +156 -0
  147. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haxe.json +143 -195
  148. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html.json +63 -150
  149. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html_ruby.json +257 -0
  150. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ini.json +23 -0
  151. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_io.json +49 -0
  152. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jack.json +1786 -0
  153. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jade.json +188 -0
  154. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_java.json +95 -139
  155. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_javascript.json +593 -555
  156. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_json.json +412 -611
  157. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsoniq.json +4 -0
  158. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsp.json +435 -0
  159. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsx.json +51 -79
  160. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_julia.json +111 -0
  161. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_latex.json +127 -196
  162. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_less.json +204 -292
  163. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_liquid.json +551 -698
  164. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lisp.json +248 -0
  165. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_livescript.json +6 -0
  166. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_logiql.json +190 -0
  167. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lsl.json +503 -0
  168. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lua.json +348 -451
  169. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_luapage.json +633 -824
  170. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lucene.json +92 -0
  171. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_markdown.json +114 -1202
  172. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_mask.json +302 -0
  173. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_matlab.json +90 -0
  174. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_mel.json +257 -0
  175. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_mushcode.json +790 -0
  176. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_mysql.json +4 -0
  177. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_nix.json +360 -0
  178. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_objectivec.json +793 -0
  179. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ocaml.json +200 -260
  180. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pascal.json +297 -0
  181. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_perl.json +227 -311
  182. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pgsql.json +889 -1020
  183. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_php.json +171 -238
  184. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_powershell.json +184 -255
  185. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_prolog.json +245 -0
  186. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_properties.json +68 -0
  187. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_protobuf.json +136 -0
  188. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_python.json +152 -205
  189. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_r.json +235 -0
  190. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_rdoc.json +441 -0
  191. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_rhtml.json +106 -0
  192. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ruby.json +242 -104
  193. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_rust.json +136 -0
  194. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sass.json +229 -0
  195. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scad.json +194 -267
  196. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scala.json +542 -748
  197. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scheme.json +216 -0
  198. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scss.json +123 -181
  199. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sh.json +334 -434
  200. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sjs.json +276 -0
  201. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_smarty.json +98 -0
  202. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_snippets.json +159 -0
  203. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_soy_template.json +286 -0
  204. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_space.json +322 -0
  205. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sql.json +54 -73
  206. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_stylus.json +271 -0
  207. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_svg.json +684 -931
  208. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tcl.json +385 -536
  209. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tex.json +130 -0
  210. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_text.json +29 -58
  211. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_textile.json +113 -195
  212. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_toml.json +131 -0
  213. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_twig.json +288 -0
  214. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_typescript.json +559 -0
  215. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_vala.json +158 -0
  216. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_vbscript.json +205 -0
  217. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_velocity.json +285 -0
  218. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_verilog.json +113 -0
  219. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_vhdl.json +271 -0
  220. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xml.json +43 -705
  221. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xquery.json +44 -64
  222. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_yaml.json +150 -260
  223. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abap.js +2 -2
  224. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abap_highlight_rules.js +7 -6
  225. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abc.js +58 -0
  226. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/abc_highlight_rules.js +114 -0
  227. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/actionscript.js +58 -0
  228. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/actionscript_highlight_rules.js +141 -0
  229. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ada.js +54 -0
  230. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ada_highlight_rules.js +93 -0
  231. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/apache_conf.js +62 -0
  232. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/apache_conf_highlight_rules.js +231 -0
  233. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/applescript.js +55 -0
  234. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/applescript_highlight_rules.js +139 -0
  235. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc.js +3 -3
  236. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc_highlight_rules.js +11 -11
  237. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/assembly_x86.js +56 -0
  238. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/assembly_x86_highlight_rules.js +114 -0
  239. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/autohotkey.js +57 -0
  240. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/autohotkey_highlight_rules.js +107 -0
  241. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/batchfile.js +61 -0
  242. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/batchfile_highlight_rules.js +97 -0
  243. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/behaviour_test.js +139 -0
  244. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/css.js +108 -0
  245. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +164 -137
  246. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +4 -48
  247. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +141 -44
  248. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +76 -52
  249. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +2 -2
  250. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +127 -4
  251. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +7 -30
  252. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +60 -51
  253. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/cirru.js +51 -0
  254. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/cirru_highlight_rules.js +125 -0
  255. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +62 -46
  256. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +4 -21
  257. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/cobol.js +53 -0
  258. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/cobol_highlight_rules.js +100 -0
  259. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +28 -7
  260. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +13 -7
  261. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +160 -4
  262. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +228 -108
  263. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +778 -670
  264. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +377 -347
  265. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +33 -6
  266. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +275 -135
  267. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +5 -4
  268. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +72 -167
  269. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +12 -24
  270. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +11 -14
  271. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +5 -84
  272. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +3 -3
  273. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js +7 -4
  274. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +13 -10
  275. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +7 -6
  276. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +2325 -1216
  277. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +72 -102
  278. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +2 -2
  279. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +11 -5
  280. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/curly.js +63 -0
  281. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/curly_highlight_rules.js +66 -0
  282. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/d.js +56 -0
  283. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/d_highlight_rules.js +334 -0
  284. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dart.js +8 -8
  285. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dart_highlight_rules.js +70 -76
  286. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +2 -2
  287. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +24 -18
  288. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/django.js +119 -0
  289. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +12 -19
  290. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dockerfile.js +52 -0
  291. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dockerfile_highlight_rules.js +57 -0
  292. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dot.js +55 -0
  293. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/dot_highlight_rules.js +126 -0
  294. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/eiffel.js +52 -0
  295. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/eiffel_highlight_rules.js +136 -0
  296. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ejs.js +109 -0
  297. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/elixir.js +58 -0
  298. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/elixir_highlight_rules.js +433 -0
  299. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/elm.js +58 -0
  300. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/elm_highlight_rules.js +162 -0
  301. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/erlang.js +57 -0
  302. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/erlang_highlight_rules.js +876 -0
  303. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +12 -6
  304. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/csharp.js +137 -0
  305. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +118 -6
  306. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +24 -0
  307. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +1 -1
  308. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +2 -33
  309. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +30 -6
  310. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/ini.js +80 -0
  311. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/latex.js +9 -9
  312. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/lua.js +4 -4
  313. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +2 -0
  314. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/velocity.js +120 -0
  315. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +110 -87
  316. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/forth.js +58 -0
  317. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/forth_highlight_rules.js +164 -0
  318. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ftl.js +49 -0
  319. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ftl_highlight_rules.js +195 -0
  320. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/gcode.js +51 -0
  321. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/gcode_highlight_rules.js +94 -0
  322. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/gherkin.js +80 -0
  323. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/gherkin_highlight_rules.js +113 -0
  324. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/gitignore.js +20 -0
  325. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/gitignore_highlight_rules.js +31 -0
  326. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/glsl.js +6 -2
  327. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +42 -67
  328. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +25 -39
  329. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js +2 -2
  330. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +0 -2
  331. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haml.js +5 -6
  332. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haml_highlight_rules.js +43 -43
  333. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/handlebars.js +29 -0
  334. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/handlebars_highlight_rules.js +72 -0
  335. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haskell.js +62 -0
  336. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haskell_highlight_rules.js +246 -0
  337. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +7 -4
  338. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +0 -2
  339. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +42 -12
  340. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html/saxparser.js +10430 -0
  341. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_completions.js +305 -0
  342. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +43 -85
  343. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_ruby.js +59 -0
  344. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_ruby_highlight_rules.js +84 -0
  345. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +3 -3
  346. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/{lib/browser_focus.js → mode/html_worker.js} +48 -51
  347. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ini.js +53 -0
  348. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ini_highlight_rules.js +112 -0
  349. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/io.js +58 -0
  350. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/io_highlight_rules.js +120 -0
  351. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jack.js +79 -0
  352. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jack_highlight_rules.js +142 -0
  353. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jade.js +4 -5
  354. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jade_highlight_rules.js +94 -100
  355. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/java.js +2 -3
  356. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +0 -5
  357. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +15 -40
  358. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript/jshint.js +10824 -4816
  359. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +113 -97
  360. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +61 -6
  361. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +5 -7
  362. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +11 -2
  363. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/js_regex_highlight_rules.js +94 -0
  364. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +5 -5
  365. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +3 -6
  366. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +6 -35
  367. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +12 -11
  368. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsoniq.js +203 -0
  369. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsp.js +2 -3
  370. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsp_highlight_rules.js +36 -30
  371. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js +26 -23
  372. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js +113 -115
  373. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/julia.js +62 -0
  374. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/julia_highlight_rules.js +170 -0
  375. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +5 -37
  376. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +44 -9
  377. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +8 -3
  378. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +2 -2
  379. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +4 -31
  380. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +15 -89
  381. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lisp.js +5 -9
  382. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lisp_highlight_rules.js +25 -28
  383. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/livescript.js +246 -0
  384. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/logiql.js +139 -0
  385. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/logiql_highlight_rules.js +119 -0
  386. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/logiql_test.js +98 -0
  387. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lsl.js +92 -0
  388. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lsl_highlight_rules.js +123 -0
  389. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +27 -6
  390. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua/luaparse.js +1989 -0
  391. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +55 -272
  392. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lua_worker.js +70 -0
  393. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js +6 -4
  394. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js +21 -14
  395. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene.js +5 -2
  396. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/makefile.js +6 -10
  397. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/makefile_highlight_rules.js +22 -22
  398. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +12 -11
  399. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +130 -89
  400. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mask.js +84 -0
  401. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mask_highlight_rules.js +309 -0
  402. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +1 -6
  403. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matlab.js +55 -0
  404. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/matlab_highlight_rules.js +262 -0
  405. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mel.js +56 -0
  406. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mel_highlight_rules.js +133 -0
  407. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mushcode.js +116 -0
  408. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mushcode_highlight_rules.js +569 -0
  409. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mysql.js +51 -0
  410. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/mysql_highlight_rules.js +122 -0
  411. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/nix.js +62 -0
  412. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/nix_highlight_rules.js +119 -0
  413. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec.js +4 -5
  414. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec_highlight_rules.js +137 -149
  415. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +4 -3
  416. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +0 -4
  417. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pascal.js +67 -0
  418. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pascal_highlight_rules.js +127 -0
  419. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +10 -30
  420. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +17 -7
  421. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +23 -51
  422. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +334 -302
  423. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +59 -38
  424. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php/php.js +5031 -0
  425. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +72 -52
  426. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php_test.js +65 -0
  427. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/php_worker.js +77 -0
  428. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/plain_text.js +55 -0
  429. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/{keyboard/vim/maps/aliases.js → mode/plain_text_test.js} +21 -59
  430. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js +7 -4
  431. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +0 -3
  432. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/{xquery/JSONParseTreeHandler.js → praat.js} +45 -53
  433. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/praat_highlight_rules.js +262 -0
  434. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/prolog.js +62 -0
  435. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/prolog_highlight_rules.js +238 -0
  436. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/properties.js +48 -0
  437. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/properties_highlight_rules.js +86 -0
  438. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/protobuf.js +63 -0
  439. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/protobuf_highlight_rules.js +66 -0
  440. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +5 -31
  441. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +50 -24
  442. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/r.js +37 -18
  443. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/r_highlight_rules.js +29 -11
  444. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc.js +36 -11
  445. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc_highlight_rules.js +27 -7
  446. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml.js +31 -11
  447. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml_highlight_rules.js +31 -14
  448. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +26 -36
  449. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +153 -33
  450. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/{css_highlight_rules_test.js → ruby_test.js} +24 -39
  451. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rust.js +58 -0
  452. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/rust_highlight_rules.js +158 -0
  453. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sass.js +52 -0
  454. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sass_highlight_rules.js +79 -0
  455. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +5 -30
  456. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +0 -4
  457. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js +2 -2
  458. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +1 -6
  459. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scheme.js +56 -0
  460. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scheme_highlight_rules.js +123 -0
  461. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +9 -4
  462. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +7 -8
  463. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +10 -31
  464. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +85 -11
  465. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sjs.js +56 -0
  466. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sjs_highlight_rules.js +233 -0
  467. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/smarty.js +51 -0
  468. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/smarty_highlight_rules.js +139 -0
  469. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/snippets.js +113 -0
  470. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/soy_template.js +60 -0
  471. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/soy_template_highlight_rules.js +356 -0
  472. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/space.js +21 -0
  473. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/space_highlight_rules.js +56 -0
  474. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +3 -30
  475. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +6 -1
  476. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/stylus.js +5 -5
  477. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/stylus_highlight_rules.js +32 -42
  478. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +3 -5
  479. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +3 -18
  480. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tcl.js +4 -30
  481. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tcl_highlight_rules.js +5 -13
  482. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tex.js +30 -10
  483. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/tex_highlight_rules.js +27 -7
  484. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +266 -29
  485. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +129 -15
  486. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +2 -2
  487. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +3 -2
  488. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/toml.js +56 -0
  489. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/toml_highlight_rules.js +103 -0
  490. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/twig.js +81 -0
  491. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/twig_highlight_rules.js +166 -0
  492. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/typescript.js +2 -8
  493. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/typescript_highlight_rules.js +16 -16
  494. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/vala.js +105 -0
  495. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/vala_highlight_rules.js +457 -0
  496. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/vbscript.js +60 -0
  497. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/vbscript_highlight_rules.js +246 -0
  498. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/velocity.js +58 -0
  499. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/velocity_highlight_rules.js +177 -0
  500. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/verilog.js +54 -0
  501. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/verilog_highlight_rules.js +101 -0
  502. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/vhdl.js +52 -0
  503. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/vhdl_highlight_rules.js +115 -0
  504. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +25 -8
  505. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml/dom-parser.js +260 -0
  506. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml/dom.js +1138 -0
  507. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml/sax.js +592 -0
  508. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +185 -45
  509. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +3 -3
  510. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_worker.js +92 -0
  511. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +107 -88
  512. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md +1 -6
  513. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/jsoniq_lexer.js +4453 -0
  514. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xqlint.js +78911 -0
  515. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery_lexer.js +4422 -0
  516. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +66 -29
  517. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +5 -3
  518. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +2 -13
  519. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +50 -28
  520. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +70 -137
  521. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop_handler.js +428 -0
  522. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +6 -23
  523. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +6 -9
  524. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +83 -39
  525. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/{mode/liquid_highlight_rules_test.js → mouse/mouse_handler_test.js} +27 -34
  526. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +94 -38
  527. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +192 -115
  528. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +124 -18
  529. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/occur.js +193 -0
  530. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/occur_test.js +154 -0
  531. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +9 -4
  532. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +2 -1
  533. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range.js +81 -102
  534. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_list.js +38 -21
  535. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +20 -1
  536. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/range_test.js +1 -1
  537. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +1 -1
  538. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +9 -8
  539. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/requirejs/text_build.js +60 -0
  540. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +163 -32
  541. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search.js +38 -19
  542. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +1 -3
  543. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/search_test.js +33 -0
  544. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/selection.js +167 -83
  545. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +22 -7
  546. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets.js +949 -0
  547. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/_.snippets +240 -0
  548. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/_all_modes.js +7 -0
  549. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/_all_modes.snippets +0 -0
  550. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/abap.js +7 -0
  551. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/abap.snippets +0 -0
  552. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/abc.js +7 -0
  553. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/abc.snippets +31 -0
  554. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/actionscript.js +7 -0
  555. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/actionscript.snippets +157 -0
  556. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ada.js +7 -0
  557. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ada.snippets +0 -0
  558. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/all_modes.js +7 -0
  559. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/all_modes.snippets +0 -0
  560. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/apache.snippets +35 -0
  561. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/apache_conf.js +7 -0
  562. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/apache_conf.snippets +0 -0
  563. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/applescript.js +7 -0
  564. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/applescript.snippets +0 -0
  565. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/asciidoc.js +7 -0
  566. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/asciidoc.snippets +0 -0
  567. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/assembly_x86.js +7 -0
  568. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/assembly_x86.snippets +0 -0
  569. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/autohotkey.js +7 -0
  570. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/autohotkey.snippets +0 -0
  571. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/autoit.snippets +66 -0
  572. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/batchfile.js +7 -0
  573. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/batchfile.snippets +0 -0
  574. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/c.snippets +235 -0
  575. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/c9search.js +7 -0
  576. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/c9search.snippets +0 -0
  577. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/c_cpp.js +7 -0
  578. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/c_cpp.snippets +131 -0
  579. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/chef.snippets +204 -0
  580. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/cirru.js +7 -0
  581. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/cirru.snippets +0 -0
  582. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/clojure.js +7 -0
  583. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/clojure.snippets +90 -0
  584. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/cmake.snippets +58 -0
  585. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/cobol.js +7 -0
  586. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/cobol.snippets +0 -0
  587. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/coffee.js +7 -0
  588. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/coffee.snippets +95 -0
  589. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/coldfusion.js +7 -0
  590. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/coldfusion.snippets +0 -0
  591. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/cs.snippets +374 -0
  592. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/csharp.js +7 -0
  593. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/csharp.snippets +0 -0
  594. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/css.js +7 -0
  595. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/css.snippets +967 -0
  596. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/curly.js +7 -0
  597. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/curly.snippets +0 -0
  598. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/d.js +7 -0
  599. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/d.snippets +0 -0
  600. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dart.js +7 -0
  601. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dart.snippets +83 -0
  602. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/diff.js +7 -0
  603. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/diff.snippets +11 -0
  604. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/django.js +7 -0
  605. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/django.snippets +108 -0
  606. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dockerfile.js +7 -0
  607. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dockerfile.snippets +0 -0
  608. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dot.js +7 -0
  609. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dot.snippets +0 -0
  610. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dummy.js +7 -0
  611. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/dummy_syntax.js +7 -0
  612. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/eiffel.js +7 -0
  613. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/eiffel.snippets +0 -0
  614. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ejs.js +7 -0
  615. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ejs.snippets +0 -0
  616. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/elixir.js +7 -0
  617. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/elixir.snippets +0 -0
  618. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/elm.js +7 -0
  619. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/elm.snippets +0 -0
  620. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/erlang.js +7 -0
  621. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/erlang.snippets +160 -0
  622. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/eruby.snippets +113 -0
  623. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/falcon.snippets +71 -0
  624. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/forth.js +7 -0
  625. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/forth.snippets +0 -0
  626. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ftl.js +7 -0
  627. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ftl.snippets +0 -0
  628. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/gcode.js +7 -0
  629. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/gcode.snippets +0 -0
  630. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/gherkin.js +7 -0
  631. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/gherkin.snippets +0 -0
  632. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/gitignore.js +7 -0
  633. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/gitignore.snippets +0 -0
  634. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/glsl.js +7 -0
  635. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/glsl.snippets +0 -0
  636. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/go.snippets +201 -0
  637. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/golang.js +7 -0
  638. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/golang.snippets +0 -0
  639. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/groovy.js +7 -0
  640. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/groovy.snippets +0 -0
  641. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/haml.js +7 -0
  642. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/haml.snippets +20 -0
  643. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/handlebars.js +7 -0
  644. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/handlebars.snippets +0 -0
  645. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/haskell.js +7 -0
  646. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/haskell.snippets +82 -0
  647. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/haxe.js +7 -0
  648. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/haxe.snippets +0 -0
  649. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/html.js +7 -0
  650. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/html.snippets +828 -0
  651. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/html_ruby.js +7 -0
  652. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/html_ruby.snippets +0 -0
  653. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/htmldjango.snippets +136 -0
  654. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/htmltornado.snippets +55 -0
  655. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ini.js +7 -0
  656. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ini.snippets +0 -0
  657. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/io.js +69 -0
  658. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/io.snippets +0 -0
  659. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jack.js +7 -0
  660. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jack.snippets +0 -0
  661. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jade.js +7 -0
  662. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jade.snippets +0 -0
  663. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/java.js +7 -0
  664. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/java.snippets +240 -0
  665. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/javascript-jquery.snippets +589 -0
  666. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/javascript.js +7 -0
  667. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/javascript.snippets +195 -0
  668. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/json.js +7 -0
  669. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/json.snippets +0 -0
  670. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jsoniq.js +7 -0
  671. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jsoniq.snippets +61 -0
  672. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jsp.js +7 -0
  673. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jsp.snippets +99 -0
  674. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jsx.js +7 -0
  675. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/jsx.snippets +0 -0
  676. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/julia.js +7 -0
  677. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/julia.snippets +0 -0
  678. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/latex.js +7 -0
  679. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/latex.snippets +0 -0
  680. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ledger.snippets +5 -0
  681. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/less.js +7 -0
  682. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/less.snippets +0 -0
  683. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/liquid.js +7 -0
  684. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/liquid.snippets +0 -0
  685. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lisp.js +7 -0
  686. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lisp.snippets +0 -0
  687. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/livescript.js +7 -0
  688. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/livescript.snippets +0 -0
  689. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/logiql.js +7 -0
  690. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/logiql.snippets +0 -0
  691. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lsl.js +7 -0
  692. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lsl.snippets +1066 -0
  693. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lua.js +7 -0
  694. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lua.snippets +21 -0
  695. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/luapage.js +7 -0
  696. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/luapage.snippets +0 -0
  697. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lucene.js +7 -0
  698. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/lucene.snippets +0 -0
  699. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/makefile.js +7 -0
  700. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/makefile.snippets +4 -0
  701. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mako.snippets +54 -0
  702. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/markdown.js +7 -0
  703. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/markdown.snippets +88 -0
  704. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/matlab.js +7 -0
  705. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/matlab.snippets +0 -0
  706. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mel.js +7 -0
  707. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mel.snippets +0 -0
  708. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mushcode.js +7 -0
  709. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mushcode.snippets +0 -0
  710. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mushcode_high_rules.js +7 -0
  711. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mushcode_high_rules.snippets +0 -0
  712. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mysql.js +7 -0
  713. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/mysql.snippets +0 -0
  714. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/nix.js +7 -0
  715. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/nix.snippets +0 -0
  716. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/objc.snippets +247 -0
  717. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/objectivec.js +7 -0
  718. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/objectivec.snippets +0 -0
  719. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ocaml.js +7 -0
  720. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ocaml.snippets +0 -0
  721. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/pascal.js +7 -0
  722. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/pascal.snippets +0 -0
  723. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/perl.js +7 -0
  724. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/perl.snippets +347 -0
  725. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/pgsql.js +7 -0
  726. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/pgsql.snippets +0 -0
  727. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/php.js +7 -0
  728. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/php.snippets +377 -0
  729. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/plain_text.js +7 -0
  730. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/plain_text.snippets +0 -0
  731. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/powershell.js +7 -0
  732. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/powershell.snippets +0 -0
  733. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/praat.js +7 -0
  734. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/praat.snippets +0 -0
  735. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/prolog.js +7 -0
  736. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/prolog.snippets +0 -0
  737. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/properties.js +7 -0
  738. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/properties.snippets +0 -0
  739. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/protobuf.js +7 -0
  740. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/protobuf.snippets +0 -0
  741. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/python.js +7 -0
  742. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/python.snippets +158 -0
  743. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/r.js +7 -0
  744. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/r.snippets +121 -0
  745. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rdoc.js +7 -0
  746. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rdoc.snippets +0 -0
  747. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rhtml.js +7 -0
  748. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rhtml.snippets +0 -0
  749. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rst.snippets +22 -0
  750. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ruby.js +7 -0
  751. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/ruby.snippets +928 -0
  752. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rust.js +7 -0
  753. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/rust.snippets +0 -0
  754. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sass.js +7 -0
  755. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sass.snippets +0 -0
  756. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scad.js +7 -0
  757. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scad.snippets +0 -0
  758. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scala.js +7 -0
  759. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scala.snippets +0 -0
  760. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scheme.js +7 -0
  761. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scheme.snippets +0 -0
  762. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scss.js +7 -0
  763. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/scss.snippets +0 -0
  764. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sh.js +7 -0
  765. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sh.snippets +83 -0
  766. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sjs.js +7 -0
  767. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sjs.snippets +0 -0
  768. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/smarty.js +7 -0
  769. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/smarty.snippets +0 -0
  770. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/snippets.js +7 -0
  771. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/snippets.snippets +9 -0
  772. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/soy_template.js +7 -0
  773. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/soy_template.snippets +0 -0
  774. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/space.js +7 -0
  775. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/space.snippets +0 -0
  776. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sql.js +7 -0
  777. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/sql.snippets +26 -0
  778. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/stylus.js +7 -0
  779. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/stylus.snippets +0 -0
  780. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/svg.js +7 -0
  781. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/svg.snippets +0 -0
  782. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/tcl.js +7 -0
  783. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/tcl.snippets +92 -0
  784. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/tex.js +7 -0
  785. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/tex.snippets +191 -0
  786. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/text.js +7 -0
  787. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/text.snippets +0 -0
  788. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/textile.js +7 -0
  789. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/textile.snippets +30 -0
  790. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/tmsnippet.snippets +0 -0
  791. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/toml.js +7 -0
  792. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/toml.snippets +0 -0
  793. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/twig.js +7 -0
  794. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/twig.snippets +0 -0
  795. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/typescript.js +7 -0
  796. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/typescript.snippets +0 -0
  797. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/vala.js +195 -0
  798. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/vala.snippets +0 -0
  799. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/vbscript.js +7 -0
  800. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/vbscript.snippets +0 -0
  801. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/velocity.js +8 -0
  802. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/velocity.snippets +28 -0
  803. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/verilog.js +7 -0
  804. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/verilog.snippets +0 -0
  805. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/vhdl.js +7 -0
  806. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/vhdl.snippets +0 -0
  807. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/xml.js +7 -0
  808. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/xml.snippets +0 -0
  809. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/xquery.js +7 -0
  810. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/xquery.snippets +61 -0
  811. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/xslt.snippets +97 -0
  812. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/yaml.js +7 -0
  813. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets/yaml.snippets +0 -0
  814. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/snippets_test.js +131 -0
  815. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/split.js +3 -3
  816. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +20 -7
  817. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js +2 -2
  818. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +8 -0
  819. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.css +6 -2
  820. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chaos.css +154 -0
  821. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chaos.js +33 -0
  822. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +5 -9
  823. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +3 -15
  824. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +1 -1
  825. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +4 -16
  826. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +1 -1
  827. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +16 -26
  828. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +1 -1
  829. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +2 -10
  830. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +10 -20
  831. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +1 -1
  832. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +9 -12
  833. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +16 -9
  834. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +3 -10
  835. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +5 -17
  836. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +1 -1
  837. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/katzenmilch.css +140 -0
  838. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/katzenmilch.js +39 -0
  839. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +9 -20
  840. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +1 -1
  841. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kuroir.css +67 -0
  842. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/kuroir.js +39 -0
  843. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +4 -16
  844. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +1 -1
  845. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +4 -16
  846. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +1 -1
  847. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +5 -17
  848. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +1 -1
  849. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +14 -20
  850. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +1 -1
  851. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +4 -16
  852. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +1 -1
  853. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +8 -20
  854. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +1 -1
  855. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +6 -18
  856. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +1 -1
  857. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/terminal.css +132 -0
  858. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/terminal.js +39 -0
  859. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +5 -9
  860. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +4 -15
  861. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +1 -1
  862. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +5 -16
  863. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +1 -1
  864. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +6 -17
  865. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +1 -1
  866. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +21 -16
  867. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +1 -1
  868. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +10 -17
  869. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +1 -1
  870. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +6 -16
  871. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +1 -1
  872. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +4 -12
  873. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +1 -1
  874. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.css +4 -12
  875. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.js +1 -1
  876. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +4 -3
  877. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +246 -78
  878. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer_dev.js +71 -93
  879. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tokenizer_test.js +97 -0
  880. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/tooltip.js +138 -0
  881. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +63 -30
  882. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +788 -403
  883. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js +9 -3
  884. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +92 -55
  885. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +90 -52
  886. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_test.js +125 -0
  887. data/lib/gollum/public/gollum/livepreview/js/livepreview.js +18 -12
  888. data/lib/gollum/public/gollum/livepreview/readme.md +1 -1
  889. data/lib/gollum/templates/layout.mustache +1 -1
  890. data/lib/gollum/{public/gollum/livepreview/index.html → templates/livepreview.mustache} +23 -1
  891. data/lib/gollum/views/livepreview.rb +13 -0
  892. metadata +569 -37
  893. data/lib/gollum/editing_auth.rb +0 -34
  894. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +0 -561
  895. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +0 -593
  896. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +0 -196
  897. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +0 -134
  898. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/_test/test_highlight_rules.js +0 -144
  899. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +0 -266
  900. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +0 -186
  901. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +0 -218
  902. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules_test.js +0 -99
  903. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules_test.js +0 -100
  904. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +0 -108
  905. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +0 -208
  906. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +0 -112
  907. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +0 -32982
  908. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/visitors/SyntaxHighlighter.js +0 -316
  909. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +0 -145
  910. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +0 -98
  911. data/lib/gollum/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js +0 -73
@@ -62,6 +62,7 @@ function createFoldTestSession() {
62
62
  }
63
63
 
64
64
  function assertArray(a, b) {
65
+ assert.equal(a+"", b+"");
65
66
  assert.ok(a.length == b.length);
66
67
  for (var i = 0; i < a.length; i++) {
67
68
  assert.equal(a[i], b[i]);
@@ -385,11 +386,12 @@ module.exports = {
385
386
  assert.ok(splits[i] == assertEqual[i]);
386
387
  }
387
388
  }
388
-
389
+
390
+ EditSession.prototype.$wrapAsCode = true;
389
391
  // Basic splitting.
390
392
  computeAndAssert("foo bar foo bar", [ 12 ]);
391
393
  computeAndAssert("foo bar f bar", [ 12 ]);
392
- computeAndAssert("foo bar f r", [ 14 ]);
394
+ computeAndAssert("foo bar f r", [ 12 ]); // 14 if we enable
393
395
  computeAndAssert("foo bar foo bar foo bara foo", [12, 25]);
394
396
 
395
397
  // Don't split if there is only whitespaces/tabs at the end of the line.
@@ -405,7 +407,7 @@ module.exports = {
405
407
  computeAndAssert("foo \t \tbar", [ 7 ]);
406
408
 
407
409
  // Ignore spaces/tabs at beginning of split.
408
- computeAndAssert("foo \t \t \t \t bar", [ 14 ]);
410
+ computeAndAssert("foo \t \t \t \t bar", [ 7 ]); // 14
409
411
 
410
412
  // Test wrapping for asian characters.
411
413
  computeAndAssert("ぁぁ", [1], 2);
@@ -417,6 +419,10 @@ module.exports = {
417
419
  computeAndAssert(" ab.c;ef++", [1, 3, 5, 7, 8], 2);
418
420
  computeAndAssert(" a.b", [1, 2, 3], 1);
419
421
  computeAndAssert("#>>", [1, 2], 1);
422
+
423
+ // Test wrapping for punctuation in
424
+ EditSession.prototype.$wrapAsCode = false;
425
+ computeAndAssert("ab cde, Juhu kinners", [3, 8, 13, 19], 6);
420
426
  },
421
427
 
422
428
  "test get longest line" : function() {
@@ -898,7 +904,27 @@ module.exports = {
898
904
 
899
905
  return session;
900
906
  },
901
-
907
+
908
+ "test delete fold with wrap enabled": function() {
909
+ var session = new EditSession("");
910
+ session.setValue([
911
+ "This is some placeholder text that will be folded inline.",
912
+ "This is some placeholder text that will be folded inline.",
913
+ "More text.",
914
+ "<p>The cursor in this paragraph text will be offset by 1 row.<p>",
915
+ "<p>Everything after this will be offset as well due to the folds in the row before too.</p>"
916
+ ].join("\n"));
917
+ session.addFold('...', new Range(0, 8, 0, 42));
918
+ session.addFold('...', new Range(1, 8, 1, 42));
919
+ session.addFold('...', new Range(3, 7, 3, 51));
920
+ session.setOption("wrap", 40);
921
+ session.remove(new Range(0,0, 2, 5));
922
+ // needed because adjustWrapLimit is called async from renderer
923
+ session.adjustWrapLimit(80);
924
+
925
+ assert.equal(session.$wrapData + "", [[], [], [40, 76]] + "");
926
+ },
927
+
902
928
  "test add fold": function() {
903
929
  var session = createFoldTestSession();
904
930
  var fold;
@@ -911,7 +937,7 @@ module.exports = {
911
937
  fail = true;
912
938
  }
913
939
  if (fail != shouldFail) {
914
- throw "Expected to get an exception";
940
+ throw new Error("Expected to get an exception");
915
941
  }
916
942
  }
917
943
 
@@ -980,7 +1006,8 @@ module.exports = {
980
1006
  assertArray(session.$docRowCache, [1,3,4]);
981
1007
  assertArray(session.$screenRowCache, [1,2,3]);
982
1008
 
983
- session.screenToDocumentPosition(0,0);
1009
+ var pos = session.screenToDocumentPosition(0,0);
1010
+ assert.equal(pos.row, 0);
984
1011
  assertArray(session.$docRowCache, [1,3,4]);
985
1012
  assertArray(session.$screenRowCache, [1,2,3]);
986
1013
 
@@ -991,11 +1018,58 @@ module.exports = {
991
1018
  session.$resetRowCache();
992
1019
  assertArray(session.$docRowCache, []);
993
1020
  assertArray(session.$screenRowCache, []);
1021
+
1022
+ session.screenToDocumentPosition(1,3);
1023
+ assertArray(session.$docRowCache, [1]);
1024
+ assertArray(session.$screenRowCache, [1]);
1025
+
1026
+ session.screenToDocumentPosition(5,3);
1027
+ assertArray(session.$docRowCache, [1,3,4]);
1028
+ assertArray(session.$screenRowCache, [1,2,3]);
1029
+
1030
+ session = new EditSession(new Array(30).join("\n"));
1031
+ session.documentToScreenPosition(2,0);
1032
+ session.documentToScreenPosition(2,0);
1033
+ assertArray(session.$docRowCache, [1,2]);
1034
+ assertArray(session.$screenRowCache, [1,2]);
1035
+ },
1036
+
1037
+ "test annotations": function() {
1038
+ var session = new EditSession([]),
1039
+ annotation = {row: 0, type: 'info', text: "This is a test."};
1040
+
1041
+ session.clearAnnotations();
1042
+ assertArray(session.getAnnotations(), []);
1043
+ session.setAnnotations([annotation]);
1044
+ assertArray(session.getAnnotations(), [annotation]);
1045
+ },
1046
+
1047
+ "test: mode loading" : function(next) {
1048
+ if (!require.undef) {
1049
+ console.log("Skipping test: This test only runs in the browser");
1050
+ next();
1051
+ return;
1052
+ }
1053
+ var session = new EditSession([]);
1054
+ session.setMode("ace/mode/javascript");
1055
+ assert.equal(session.$modeid, "ace/mode/javascript");
1056
+ session.on("changeMode", function() {
1057
+ assert.equal(session.$modeid, "ace/mode/javascript");
1058
+ });
1059
+ session.setMode("ace/mode/sh", function(mode) {
1060
+ assert.ok(!mode);
1061
+ });
1062
+ setTimeout(function() {
1063
+ session.setMode("ace/mode/javascript", function(mode) {
1064
+ session.setMode("ace/mode/javascript");
1065
+ assert.equal(session.$modeid, "ace/mode/javascript");
1066
+ next();
1067
+ });
1068
+ }, 0);
994
1069
  }
995
1070
  };
996
-
997
1071
  });
998
1072
 
999
1073
  if (typeof module !== "undefined" && module === require.main) {
1000
- require("asyncjs").test.testcase(module.exports).exec()
1074
+ require("asyncjs").test.testcase(module.exports).exec();
1001
1075
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Copyright (c) 2010, Ajax.org B.V.
5
5
  * All rights reserved.
6
- *
6
+ *
7
7
  * Redistribution and use in source and binary forms, with or without
8
8
  * modification, are permitted provided that the following conditions are met:
9
9
  * * Redistributions of source code must retain the above copyright
@@ -14,7 +14,7 @@
14
14
  * * Neither the name of Ajax.org B.V. nor the
15
15
  * names of its contributors may be used to endorse or promote products
16
16
  * derived from this software without specific prior written permission.
17
- *
17
+ *
18
18
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
19
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
20
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -34,6 +34,7 @@ define(function(require, exports, module) {
34
34
  require("./lib/fixoldbrowsers");
35
35
 
36
36
  var oop = require("./lib/oop");
37
+ var dom = require("./lib/dom");
37
38
  var lang = require("./lib/lang");
38
39
  var useragent = require("./lib/useragent");
39
40
  var TextInput = require("./keyboard/textinput").TextInput;
@@ -46,13 +47,13 @@ var Range = require("./range").Range;
46
47
  var EventEmitter = require("./lib/event_emitter").EventEmitter;
47
48
  var CommandManager = require("./commands/command_manager").CommandManager;
48
49
  var defaultCommands = require("./commands/default_commands").commands;
50
+ var config = require("./config");
51
+ var TokenIterator = require("./token_iterator").TokenIterator;
49
52
 
50
53
  /**
54
+ * The main entry point into the Ace functionality.
51
55
  *
52
- *
53
- * The main entry point into the Ace functionality.
54
- *
55
- * The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen.
56
+ * The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen.
56
57
  *
57
58
  * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
58
59
  * @class Editor
@@ -86,28 +87,174 @@ var Editor = function(renderer, session) {
86
87
  wrap: true
87
88
  });
88
89
 
90
+ this.$historyTracker = this.$historyTracker.bind(this);
91
+ this.commands.on("exec", this.$historyTracker);
92
+
93
+ this.$initOperationListeners();
94
+
95
+ this._$emitInputEvent = lang.delayedCall(function() {
96
+ this._signal("input", {});
97
+ if (this.session && this.session.bgTokenizer)
98
+ this.session.bgTokenizer.scheduleStart();
99
+ }.bind(this));
100
+
101
+ this.on("change", function(_, _self) {
102
+ _self._$emitInputEvent.schedule(31);
103
+ });
104
+
89
105
  this.setSession(session || new EditSession(""));
106
+ config.resetOptions(this);
107
+ config._signal("editor", this);
90
108
  };
91
109
 
92
110
  (function(){
93
111
 
94
112
  oop.implement(this, EventEmitter);
95
113
 
114
+ this.$initOperationListeners = function() {
115
+ function last(a) {return a[a.length - 1]}
116
+
117
+ this.selections = [];
118
+ this.commands.on("exec", this.startOperation.bind(this), true);
119
+ this.commands.on("afterExec", this.endOperation.bind(this), true);
120
+
121
+ this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
122
+
123
+ this.on("change", function() {
124
+ this.curOp || this.startOperation();
125
+ this.curOp.docChanged = true;
126
+ }.bind(this), true);
127
+
128
+ this.on("changeSelection", function() {
129
+ this.curOp || this.startOperation();
130
+ this.curOp.selectionChanged = true;
131
+ }.bind(this), true);
132
+ };
133
+
134
+ this.curOp = null;
135
+ this.prevOp = {};
136
+ this.startOperation = function(commadEvent) {
137
+ if (this.curOp) {
138
+ if (!commadEvent || this.curOp.command)
139
+ return;
140
+ this.prevOp = this.curOp;
141
+ }
142
+ if (!commadEvent) {
143
+ this.previousCommand = null;
144
+ commadEvent = {};
145
+ }
146
+
147
+ this.$opResetTimer.schedule();
148
+ this.curOp = {
149
+ command: commadEvent.command || {},
150
+ args: commadEvent.args,
151
+ scrollTop: this.renderer.scrollTop
152
+ };
153
+ if (this.curOp.command.name)
154
+ this.$blockScrolling++;
155
+ // this.selections.push(this.selection.toJSON());
156
+ };
157
+
158
+ this.endOperation = function(e) {
159
+ if (this.curOp) {
160
+ if (e && e.returnValue === false)
161
+ return this.curOp = null;
162
+ this._signal("beforeEndOperation");
163
+ var command = this.curOp.command;
164
+ if (command.name && this.$blockScrolling)
165
+ this.$blockScrolling--;
166
+ if (command && command.scrollIntoView) {
167
+ switch (command.scrollIntoView) {
168
+ case "center":
169
+ this.renderer.scrollCursorIntoView(null, 0.5);
170
+ break;
171
+ case "animate":
172
+ case "cursor":
173
+ this.renderer.scrollCursorIntoView();
174
+ break;
175
+ case "selectionPart":
176
+ var range = this.selection.getRange();
177
+ var config = this.renderer.layerConfig;
178
+ if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) {
179
+ this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
180
+ }
181
+ break;
182
+ default:
183
+ break;
184
+ }
185
+ if (command.scrollIntoView == "animate")
186
+ this.renderer.animateScrolling(this.curOp.scrollTop);
187
+ }
188
+
189
+ this.prevOp = this.curOp;
190
+ this.curOp = null;
191
+ }
192
+ };
193
+
194
+ // TODO use property on commands instead of this
195
+ this.$mergeableCommands = ["backspace", "del", "insertstring"];
196
+ this.$historyTracker = function(e) {
197
+ if (!this.$mergeUndoDeltas)
198
+ return;
199
+
200
+ var prev = this.prevOp;
201
+ var mergeableCommands = this.$mergeableCommands;
202
+ // previous command was the same
203
+ var shouldMerge = prev.command && (e.command.name == prev.command.name);
204
+ if (e.command.name == "insertstring") {
205
+ var text = e.args;
206
+ if (this.mergeNextCommand === undefined)
207
+ this.mergeNextCommand = true;
208
+
209
+ shouldMerge = shouldMerge
210
+ && this.mergeNextCommand // previous command allows to coalesce with
211
+ && (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type
212
+
213
+ this.mergeNextCommand = true;
214
+ } else {
215
+ shouldMerge = shouldMerge
216
+ && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable
217
+ }
218
+
219
+ if (
220
+ this.$mergeUndoDeltas != "always"
221
+ && Date.now() - this.sequenceStartTime > 2000
222
+ ) {
223
+ shouldMerge = false; // the sequence is too long
224
+ }
225
+
226
+ if (shouldMerge)
227
+ this.session.mergeUndoDeltas = true;
228
+ else if (mergeableCommands.indexOf(e.command.name) !== -1)
229
+ this.sequenceStartTime = Date.now();
230
+ };
231
+
96
232
  /**
97
233
  * Sets a new key handler, such as "vim" or "windows".
98
234
  * @param {String} keyboardHandler The new key handler
99
235
  *
100
- *
101
236
  **/
102
- this.setKeyboardHandler = function(keyboardHandler) {
103
- this.keyBinding.setKeyboardHandler(keyboardHandler);
237
+ this.setKeyboardHandler = function(keyboardHandler, cb) {
238
+ if (keyboardHandler && typeof keyboardHandler === "string") {
239
+ this.$keybindingId = keyboardHandler;
240
+ var _self = this;
241
+ config.loadModule(["keybinding", keyboardHandler], function(module) {
242
+ if (_self.$keybindingId == keyboardHandler)
243
+ _self.keyBinding.setKeyboardHandler(module && module.handler);
244
+ cb && cb();
245
+ });
246
+ } else {
247
+ this.$keybindingId = null;
248
+ this.keyBinding.setKeyboardHandler(keyboardHandler);
249
+ cb && cb();
250
+ }
104
251
  };
105
252
 
106
- /**
253
+ /**
107
254
  * Returns the keyboard handler, such as "vim" or "windows".
108
255
  *
109
256
  * @returns {String}
110
- *
257
+ *
111
258
  **/
112
259
  this.getKeyboardHandler = function() {
113
260
  return this.keyBinding.getKeyboardHandler();
@@ -119,20 +266,18 @@ var Editor = function(renderer, session) {
119
266
  * @event changeSession
120
267
  * @param {Object} e An object with two properties, `oldSession` and `session`, that represent the old and new [[EditSession]]s.
121
268
  *
122
- *
123
269
  **/
124
270
  /**
125
271
  * Sets a new editsession to use. This method also emits the `'changeSession'` event.
126
272
  * @param {EditSession} session The new session to use
127
273
  *
128
- *
129
274
  **/
130
275
  this.setSession = function(session) {
131
276
  if (this.session == session)
132
277
  return;
133
278
 
134
- if (this.session) {
135
- var oldSession = this.session;
279
+ var oldSession = this.session;
280
+ if (oldSession) {
136
281
  this.session.removeEventListener("change", this.$onDocumentChange);
137
282
  this.session.removeEventListener("changeMode", this.$onChangeMode);
138
283
  this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
@@ -146,7 +291,7 @@ var Editor = function(renderer, session) {
146
291
  this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
147
292
  this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
148
293
  this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
149
- this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange);
294
+ this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange);
150
295
 
151
296
  var selection = this.session.getSelection();
152
297
  selection.removeEventListener("changeCursor", this.$onCursorChange);
@@ -154,76 +299,83 @@ var Editor = function(renderer, session) {
154
299
  }
155
300
 
156
301
  this.session = session;
302
+ if (session) {
303
+ this.$onDocumentChange = this.onDocumentChange.bind(this);
304
+ session.addEventListener("change", this.$onDocumentChange);
305
+ this.renderer.setSession(session);
306
+
307
+ this.$onChangeMode = this.onChangeMode.bind(this);
308
+ session.addEventListener("changeMode", this.$onChangeMode);
309
+
310
+ this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
311
+ session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
312
+
313
+ this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
314
+ session.addEventListener("changeTabSize", this.$onChangeTabSize);
315
+
316
+ this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
317
+ session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
318
+
319
+ this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
320
+ session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
321
+
322
+ this.$onChangeFold = this.onChangeFold.bind(this);
323
+ session.addEventListener("changeFold", this.$onChangeFold);
324
+
325
+ this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
326
+ this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
327
+
328
+ this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
329
+ this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
330
+
331
+ this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
332
+ this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
333
+
334
+ this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
335
+ this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
336
+
337
+ this.$onCursorChange = this.onCursorChange.bind(this);
338
+ this.session.addEventListener("changeOverwrite", this.$onCursorChange);
339
+
340
+ this.$onScrollTopChange = this.onScrollTopChange.bind(this);
341
+ this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
342
+
343
+ this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
344
+ this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
345
+
346
+ this.selection = session.getSelection();
347
+ this.selection.addEventListener("changeCursor", this.$onCursorChange);
348
+
349
+ this.$onSelectionChange = this.onSelectionChange.bind(this);
350
+ this.selection.addEventListener("changeSelection", this.$onSelectionChange);
351
+
352
+ this.onChangeMode();
353
+
354
+ this.$blockScrolling += 1;
355
+ this.onCursorChange();
356
+ this.$blockScrolling -= 1;
357
+
358
+ this.onScrollTopChange();
359
+ this.onScrollLeftChange();
360
+ this.onSelectionChange();
361
+ this.onChangeFrontMarker();
362
+ this.onChangeBackMarker();
363
+ this.onChangeBreakpoint();
364
+ this.onChangeAnnotation();
365
+ this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
366
+ this.renderer.updateFull();
367
+ } else {
368
+ this.selection = null;
369
+ this.renderer.setSession(session);
370
+ }
157
371
 
158
- this.$onDocumentChange = this.onDocumentChange.bind(this);
159
- session.addEventListener("change", this.$onDocumentChange);
160
- this.renderer.setSession(session);
161
-
162
- this.$onChangeMode = this.onChangeMode.bind(this);
163
- session.addEventListener("changeMode", this.$onChangeMode);
164
-
165
- this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
166
- session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
167
-
168
- this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
169
- session.addEventListener("changeTabSize", this.$onChangeTabSize);
170
-
171
- this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
172
- session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
173
-
174
- this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
175
- session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
176
-
177
- this.$onChangeFold = this.onChangeFold.bind(this);
178
- session.addEventListener("changeFold", this.$onChangeFold);
179
-
180
- this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
181
- this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
182
-
183
- this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
184
- this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
185
-
186
- this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
187
- this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
188
-
189
- this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
190
- this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
191
-
192
- this.$onCursorChange = this.onCursorChange.bind(this);
193
- this.session.addEventListener("changeOverwrite", this.$onCursorChange);
194
-
195
- this.$onScrollTopChange = this.onScrollTopChange.bind(this);
196
- this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
197
-
198
- this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
199
- this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
200
-
201
- this.selection = session.getSelection();
202
- this.selection.addEventListener("changeCursor", this.$onCursorChange);
203
-
204
- this.$onSelectionChange = this.onSelectionChange.bind(this);
205
- this.selection.addEventListener("changeSelection", this.$onSelectionChange);
206
-
207
- this.onChangeMode();
208
-
209
- this.$blockScrolling += 1;
210
- this.onCursorChange();
211
- this.$blockScrolling -= 1;
212
-
213
- this.onScrollTopChange();
214
- this.onScrollLeftChange();
215
- this.onSelectionChange();
216
- this.onChangeFrontMarker();
217
- this.onChangeBackMarker();
218
- this.onChangeBreakpoint();
219
- this.onChangeAnnotation();
220
- this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
221
- this.renderer.updateFull();
222
-
223
- this._emit("changeSession", {
372
+ this._signal("changeSession", {
224
373
  session: session,
225
374
  oldSession: oldSession
226
375
  });
376
+
377
+ oldSession && oldSession._signal("changeEditor", {oldEditor: this});
378
+ session && session._signal("changeEditor", {editor: this});
227
379
  };
228
380
 
229
381
  /**
@@ -234,13 +386,11 @@ var Editor = function(renderer, session) {
234
386
  return this.session;
235
387
  };
236
388
 
237
- /**
389
+ /**
238
390
  * Sets the current document to `val`.
239
391
  * @param {String} val The new value to set for the document
240
392
  * @param {Number} cursorPos Where to set the new value. `undefined` or 0 is selectAll, -1 is at the document start, and 1 is at the end
241
393
  *
242
- *
243
- *
244
394
  * @returns {String} The current document value
245
395
  * @related Document.setValue
246
396
  **/
@@ -257,7 +407,7 @@ var Editor = function(renderer, session) {
257
407
  return val;
258
408
  };
259
409
 
260
- /**
410
+ /**
261
411
  * Returns the current session's content.
262
412
  *
263
413
  * @returns {String}
@@ -268,7 +418,7 @@ var Editor = function(renderer, session) {
268
418
  };
269
419
 
270
420
  /**
271
- *
421
+ *
272
422
  * Returns the currently highlighted selection.
273
423
  * @returns {String} The highlighted selection
274
424
  **/
@@ -276,11 +426,11 @@ var Editor = function(renderer, session) {
276
426
  return this.selection;
277
427
  };
278
428
 
279
- /**
429
+ /**
280
430
  * {:VirtualRenderer.onResize}
281
431
  * @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed
282
432
  *
283
- *
433
+ *
284
434
  * @related VirtualRenderer.onResize
285
435
  **/
286
436
  this.resize = function(force) {
@@ -290,16 +440,15 @@ var Editor = function(renderer, session) {
290
440
  /**
291
441
  * {:VirtualRenderer.setTheme}
292
442
  * @param {String} theme The path to a theme
293
- *
294
- *
443
+ * @param {Function} cb optional callback called when theme is loaded
295
444
  **/
296
- this.setTheme = function(theme) {
297
- this.renderer.setTheme(theme);
445
+ this.setTheme = function(theme, cb) {
446
+ this.renderer.setTheme(theme, cb);
298
447
  };
299
448
 
300
- /**
449
+ /**
301
450
  * {:VirtualRenderer.getTheme}
302
- *
451
+ *
303
452
  * @returns {String} The set theme
304
453
  * @related VirtualRenderer.getTheme
305
454
  **/
@@ -311,14 +460,14 @@ var Editor = function(renderer, session) {
311
460
  * {:VirtualRenderer.setStyle}
312
461
  * @param {String} style A class name
313
462
  *
314
- *
463
+ *
315
464
  * @related VirtualRenderer.setStyle
316
465
  **/
317
466
  this.setStyle = function(style) {
318
467
  this.renderer.setStyle(style);
319
468
  };
320
469
 
321
- /**
470
+ /**
322
471
  * {:VirtualRenderer.unsetStyle}
323
472
  * @related VirtualRenderer.unsetStyle
324
473
  **/
@@ -326,15 +475,22 @@ var Editor = function(renderer, session) {
326
475
  this.renderer.unsetStyle(style);
327
476
  };
328
477
 
478
+ /**
479
+ * Gets the current font size of the editor text.
480
+ */
481
+ this.getFontSize = function () {
482
+ return this.getOption("fontSize") ||
483
+ dom.computedStyle(this.container, "fontSize");
484
+ };
485
+
329
486
  /**
330
487
  * Set a new font size (in pixels) for the editor text.
331
- * @param {Number} size A font size
332
- *
333
- *
488
+ * @param {String} size A font size ( _e.g._ "12px")
489
+ *
490
+ *
334
491
  **/
335
492
  this.setFontSize = function(size) {
336
- this.container.style.fontSize = size;
337
- this.renderer.updateFontSize();
493
+ this.setOption("fontSize", size);
338
494
  };
339
495
 
340
496
  this.$highlightBrackets = function() {
@@ -352,17 +508,110 @@ var Editor = function(renderer, session) {
352
508
  this.$highlightPending = true;
353
509
  setTimeout(function() {
354
510
  self.$highlightPending = false;
355
-
356
- var pos = self.session.findMatchingBracket(self.getCursorPosition());
511
+ var session = self.session;
512
+ if (!session || !session.bgTokenizer) return;
513
+ var pos = session.findMatchingBracket(self.getCursorPosition());
357
514
  if (pos) {
358
- var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
359
- self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
515
+ var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
516
+ } else if (session.$mode.getMatching) {
517
+ var range = session.$mode.getMatching(self.session);
360
518
  }
519
+ if (range)
520
+ session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
521
+ }, 50);
522
+ };
523
+
524
+ // todo: move to mode.getMatching
525
+ this.$highlightTags = function() {
526
+ if (this.$highlightTagPending)
527
+ return;
528
+
529
+ // perform highlight async to not block the browser during navigation
530
+ var self = this;
531
+ this.$highlightTagPending = true;
532
+ setTimeout(function() {
533
+ self.$highlightTagPending = false;
534
+
535
+ var session = self.session;
536
+ if (!session || !session.bgTokenizer) return;
537
+
538
+ var pos = self.getCursorPosition();
539
+ var iterator = new TokenIterator(self.session, pos.row, pos.column);
540
+ var token = iterator.getCurrentToken();
541
+
542
+ if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) {
543
+ session.removeMarker(session.$tagHighlight);
544
+ session.$tagHighlight = null;
545
+ return;
546
+ }
547
+
548
+ if (token.type.indexOf("tag-open") != -1) {
549
+ token = iterator.stepForward();
550
+ if (!token)
551
+ return;
552
+ }
553
+
554
+ var tag = token.value;
555
+ var depth = 0;
556
+ var prevToken = iterator.stepBackward();
557
+
558
+ if (prevToken.value == '<'){
559
+ //find closing tag
560
+ do {
561
+ prevToken = token;
562
+ token = iterator.stepForward();
563
+
564
+ if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
565
+ if (prevToken.value === '<'){
566
+ depth++;
567
+ } else if (prevToken.value === '</'){
568
+ depth--;
569
+ }
570
+ }
571
+
572
+ } while (token && depth >= 0);
573
+ } else {
574
+ //find opening tag
575
+ do {
576
+ token = prevToken;
577
+ prevToken = iterator.stepBackward();
578
+
579
+ if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
580
+ if (prevToken.value === '<') {
581
+ depth++;
582
+ } else if (prevToken.value === '</') {
583
+ depth--;
584
+ }
585
+ }
586
+ } while (prevToken && depth <= 0);
587
+
588
+ //select tag again
589
+ iterator.stepForward();
590
+ }
591
+
592
+ if (!token) {
593
+ session.removeMarker(session.$tagHighlight);
594
+ session.$tagHighlight = null;
595
+ return;
596
+ }
597
+
598
+ var row = iterator.getCurrentTokenRow();
599
+ var column = iterator.getCurrentTokenColumn();
600
+ var range = new Range(row, column, row, column+token.value.length);
601
+
602
+ //remove range if different
603
+ if (session.$tagHighlight && range.compareRange(session.$backMarkers[session.$tagHighlight].range)!==0) {
604
+ session.removeMarker(session.$tagHighlight);
605
+ session.$tagHighlight = null;
606
+ }
607
+
608
+ if (range && !session.$tagHighlight)
609
+ session.$tagHighlight = session.addMarker(range, "ace_bracket", "text");
361
610
  }, 50);
362
611
  };
363
612
 
364
613
  /**
365
- *
614
+ *
366
615
  * Brings the current `textInput` into focus.
367
616
  **/
368
617
  this.focus = function() {
@@ -378,14 +627,14 @@ var Editor = function(renderer, session) {
378
627
 
379
628
  /**
380
629
  * Returns `true` if the current `textInput` is in focus.
381
- * @return Boolean
630
+ * @return {Boolean}
382
631
  **/
383
632
  this.isFocused = function() {
384
633
  return this.textInput.isFocused();
385
634
  };
386
635
 
387
636
  /**
388
- *
637
+ *
389
638
  * Blurs the current `textInput`.
390
639
  **/
391
640
  this.blur = function() {
@@ -394,32 +643,32 @@ var Editor = function(renderer, session) {
394
643
 
395
644
  /**
396
645
  * Emitted once the editor comes into focus.
397
- * @event focus
398
- *
399
- *
646
+ * @event focus
647
+ *
648
+ *
400
649
  **/
401
- this.onFocus = function() {
650
+ this.onFocus = function(e) {
402
651
  if (this.$isFocused)
403
652
  return;
404
653
  this.$isFocused = true;
405
654
  this.renderer.showCursor();
406
655
  this.renderer.visualizeFocus();
407
- this._emit("focus");
656
+ this._emit("focus", e);
408
657
  };
409
658
 
410
659
  /**
411
660
  * Emitted once the editor has been blurred.
412
661
  * @event blur
413
- *
414
- *
662
+ *
663
+ *
415
664
  **/
416
- this.onBlur = function() {
665
+ this.onBlur = function(e) {
417
666
  if (!this.$isFocused)
418
667
  return;
419
668
  this.$isFocused = false;
420
669
  this.renderer.hideCursor();
421
670
  this.renderer.visualizeBlur();
422
- this._emit("blur");
671
+ this._emit("blur", e);
423
672
  };
424
673
 
425
674
  this.$cursorChange = function() {
@@ -427,12 +676,12 @@ var Editor = function(renderer, session) {
427
676
  };
428
677
 
429
678
  /**
430
- * Emitted whenever the document is changed.
679
+ * Emitted whenever the document is changed.
431
680
  * @event change
432
681
  * @param {Object} e Contains a single property, `data`, which has the delta of changes
433
682
  *
434
683
  *
435
- *
684
+ *
436
685
  **/
437
686
  this.onDocumentChange = function(e) {
438
687
  var delta = e.data;
@@ -443,12 +692,13 @@ var Editor = function(renderer, session) {
443
692
  lastRow = range.end.row;
444
693
  else
445
694
  lastRow = Infinity;
446
- this.renderer.updateLines(range.start.row, lastRow);
695
+ this.renderer.updateLines(range.start.row, lastRow, this.session.$useWrapMode);
447
696
 
448
- this._emit("change", e);
697
+ this._signal("change", e);
449
698
 
450
699
  // update cursor because tab characters can influence the cursor position
451
700
  this.$cursorChange();
701
+ this.$updateHighlightActiveLine();
452
702
  };
453
703
 
454
704
  this.onTokenizerUpdate = function(e) {
@@ -460,25 +710,30 @@ var Editor = function(renderer, session) {
460
710
  this.onScrollTopChange = function() {
461
711
  this.renderer.scrollToY(this.session.getScrollTop());
462
712
  };
463
-
713
+
464
714
  this.onScrollLeftChange = function() {
465
715
  this.renderer.scrollToX(this.session.getScrollLeft());
466
716
  };
467
717
 
468
718
  /**
469
719
  * Emitted when the selection changes.
470
- *
720
+ *
471
721
  **/
472
722
  this.onCursorChange = function() {
473
723
  this.$cursorChange();
474
724
 
475
725
  if (!this.$blockScrolling) {
726
+ config.warn("Automatically scrolling cursor into view after selection change",
727
+ "this will be disabled in the next version",
728
+ "set editor.$blockScrolling = Infinity to disable this message"
729
+ );
476
730
  this.renderer.scrollCursorIntoView();
477
731
  }
478
732
 
479
733
  this.$highlightBrackets();
734
+ this.$highlightTags();
480
735
  this.$updateHighlightActiveLine();
481
- this._emit("changeSelection");
736
+ this._signal("changeSelection");
482
737
  };
483
738
 
484
739
  this.$updateHighlightActiveLine = function() {
@@ -488,17 +743,22 @@ var Editor = function(renderer, session) {
488
743
  if (this.$highlightActiveLine) {
489
744
  if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
490
745
  highlight = this.getCursorPosition();
746
+ if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))
747
+ highlight = false;
491
748
  }
492
749
 
493
750
  if (session.$highlightLineMarker && !highlight) {
494
751
  session.removeMarker(session.$highlightLineMarker.id);
495
- session.$highlightLineMarker = null;
752
+ session.$highlightLineMarker = null;
496
753
  } else if (!session.$highlightLineMarker && highlight) {
497
- session.$highlightLineMarker = session.highlightLines(highlight.row, highlight.row, "ace_active-line");
754
+ var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
755
+ range.id = session.addMarker(range, "ace_active-line", "screenLine");
756
+ session.$highlightLineMarker = range;
498
757
  } else if (highlight) {
499
758
  session.$highlightLineMarker.start.row = highlight.row;
500
759
  session.$highlightLineMarker.end.row = highlight.row;
501
- session._emit("changeBackMarker");
760
+ session.$highlightLineMarker.start.column = highlight.column;
761
+ session._signal("changeBackMarker");
502
762
  }
503
763
  };
504
764
 
@@ -518,10 +778,10 @@ var Editor = function(renderer, session) {
518
778
  this.$updateHighlightActiveLine();
519
779
  }
520
780
 
521
- var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
781
+ var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
522
782
  this.session.highlight(re);
523
-
524
- this._emit("changeSelection");
783
+
784
+ this._signal("changeSelection");
525
785
  };
526
786
 
527
787
  this.$getSelectionHighLightRegexp = function() {
@@ -575,8 +835,9 @@ var Editor = function(renderer, session) {
575
835
  };
576
836
 
577
837
 
578
- this.onChangeMode = function() {
838
+ this.onChangeMode = function(e) {
579
839
  this.renderer.updateText();
840
+ this._emit("changeMode", e);
580
841
  };
581
842
 
582
843
 
@@ -597,25 +858,29 @@ var Editor = function(renderer, session) {
597
858
  this.renderer.updateFull();
598
859
  };
599
860
 
861
+
862
+ /**
863
+ * Returns the string of text currently highlighted.
864
+ * @returns {String}
865
+ **/
866
+ this.getSelectedText = function() {
867
+ return this.session.getTextRange(this.getSelectionRange());
868
+ };
869
+
600
870
  /**
601
871
  * Emitted when text is copied.
602
- * @event copy
872
+ * @event copy
603
873
  * @param {String} text The copied text
604
874
  *
605
- *
606
875
  **/
607
876
  /**
608
- *
609
877
  * Returns the string of text currently highlighted.
610
878
  * @returns {String}
879
+ * @deprecated Use getSelectedText instead.
611
880
  **/
612
-
613
881
  this.getCopyText = function() {
614
- var text = "";
615
- if (!this.selection.isEmpty())
616
- text = this.session.getTextRange(this.getSelectionRange());
617
-
618
- this._emit("copy", text);
882
+ var text = this.getSelectedText();
883
+ this._signal("copy", text);
619
884
  return text;
620
885
  };
621
886
 
@@ -636,7 +901,7 @@ var Editor = function(renderer, session) {
636
901
  /**
637
902
  * Emitted when text is pasted.
638
903
  * @event paste
639
- * @param {String} text The pasted text
904
+ * @param {Object} an object which contains one property, `text`, that represents the text to be pasted. Editing this property will alter the text that is pasted.
640
905
  *
641
906
  *
642
907
  **/
@@ -648,40 +913,66 @@ var Editor = function(renderer, session) {
648
913
  **/
649
914
  this.onPaste = function(text) {
650
915
  // todo this should change when paste becomes a command
651
- if (this.$readOnly)
916
+ if (this.$readOnly)
652
917
  return;
653
- this._emit("paste", text);
654
- this.insert(text);
655
- };
656
918
 
919
+ var e = {text: text};
920
+ this._signal("paste", e);
921
+ text = e.text;
922
+ if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
923
+ this.insert(text);
924
+ } else {
925
+ var lines = text.split(/\r\n|\r|\n/);
926
+ var ranges = this.selection.rangeList.ranges;
927
+
928
+ if (lines.length > ranges.length || lines.length < 2 || !lines[1])
929
+ return this.commands.exec("insertstring", this, text);
930
+
931
+ for (var i = ranges.length; i--;) {
932
+ var range = ranges[i];
933
+ if (!range.isEmpty())
934
+ this.session.remove(range);
935
+
936
+ this.session.insert(range.start, lines[i]);
937
+ }
938
+ }
939
+ this.renderer.scrollCursorIntoView();
940
+ };
657
941
 
658
942
  this.execCommand = function(command, args) {
659
- this.commands.exec(command, this, args);
943
+ return this.commands.exec(command, this, args);
660
944
  };
661
945
 
662
946
  /**
663
947
  * Inserts `text` into wherever the cursor is pointing.
664
948
  * @param {String} text The new text to add
665
- *
666
- *
949
+ *
667
950
  **/
668
- this.insert = function(text) {
951
+ this.insert = function(text, pasted) {
669
952
  var session = this.session;
670
953
  var mode = session.getMode();
671
954
  var cursor = this.getCursorPosition();
672
955
 
673
- if (this.getBehavioursEnabled()) {
956
+ if (this.getBehavioursEnabled() && !pasted) {
674
957
  // Get a transform if the current mode wants one.
675
958
  var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
676
- if (transform)
959
+ if (transform) {
960
+ if (text !== transform.text) {
961
+ this.session.mergeUndoDeltas = false;
962
+ this.$mergeNextCommand = false;
963
+ }
677
964
  text = transform.text;
678
- }
679
965
 
680
- text = text.replace("\t", this.session.getTabString());
966
+ }
967
+ }
968
+
969
+ if (text == "\t")
970
+ text = this.session.getTabString();
681
971
 
682
972
  // remove selected text
683
973
  if (!this.selection.isEmpty()) {
684
- cursor = this.session.remove(this.getSelectionRange());
974
+ var range = this.getSelectionRange();
975
+ cursor = this.session.remove(range);
685
976
  this.clearSelection();
686
977
  }
687
978
  else if (this.session.getOverwrite()) {
@@ -690,6 +981,13 @@ var Editor = function(renderer, session) {
690
981
  this.session.remove(range);
691
982
  }
692
983
 
984
+ if (text == "\n" || text == "\r\n") {
985
+ var line = session.getLine(cursor.row);
986
+ if (cursor.column > line.search(/\S|$/)) {
987
+ var d = line.substr(cursor.column).search(/\S|$/);
988
+ session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);
989
+ }
990
+ }
693
991
  this.clearSelection();
694
992
 
695
993
  var start = cursor.column;
@@ -712,44 +1010,10 @@ var Editor = function(renderer, session) {
712
1010
  }
713
1011
  }
714
1012
 
715
- // TODO disabled multiline auto indent
716
- // possibly doing the indent before inserting the text
717
- // if (cursor.row !== end.row) {
718
1013
  if (session.getDocument().isNewLine(text)) {
719
1014
  var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
720
1015
 
721
- this.moveCursorTo(cursor.row+1, 0);
722
-
723
- var size = session.getTabSize();
724
- var minIndent = Number.MAX_VALUE;
725
-
726
- for (var row = cursor.row + 1; row <= end.row; ++row) {
727
- var indent = 0;
728
-
729
- line = session.getLine(row);
730
- for (var i = 0; i < line.length; ++i)
731
- if (line.charAt(i) == '\t')
732
- indent += size;
733
- else if (line.charAt(i) == ' ')
734
- indent += 1;
735
- else
736
- break;
737
- if (/[^\s]/.test(line))
738
- minIndent = Math.min(indent, minIndent);
739
- }
740
-
741
- for (var row = cursor.row + 1; row <= end.row; ++row) {
742
- var outdent = minIndent;
743
-
744
- line = session.getLine(row);
745
- for (var i = 0; i < line.length && outdent > 0; ++i)
746
- if (line.charAt(i) == '\t')
747
- outdent -= size;
748
- else if (line.charAt(i) == ' ')
749
- outdent -= 1;
750
- session.remove(new Range(row, 0, row, i));
751
- }
752
- session.indentRows(cursor.row + 1, end.row, lineIndent);
1016
+ session.insert({row: cursor.row+1, column: 0}, lineIndent);
753
1017
  }
754
1018
  if (shouldOutdent)
755
1019
  mode.autoOutdent(lineState, session, cursor.row);
@@ -763,10 +1027,10 @@ var Editor = function(renderer, session) {
763
1027
  this.keyBinding.onCommandKey(e, hashId, keyCode);
764
1028
  };
765
1029
 
766
- /**
1030
+ /**
767
1031
  * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
768
1032
  * @param {Boolean} overwrite Defines wheter or not to set overwrites
769
- *
1033
+ *
770
1034
  *
771
1035
  * @related EditSession.setOverwrite
772
1036
  **/
@@ -774,7 +1038,7 @@ var Editor = function(renderer, session) {
774
1038
  this.session.setOverwrite(overwrite);
775
1039
  };
776
1040
 
777
- /**
1041
+ /**
778
1042
  * Returns `true` if overwrites are enabled; `false` otherwise.
779
1043
  * @returns {Boolean}
780
1044
  * @related EditSession.getOverwrite
@@ -783,7 +1047,7 @@ var Editor = function(renderer, session) {
783
1047
  return this.session.getOverwrite();
784
1048
  };
785
1049
 
786
- /**
1050
+ /**
787
1051
  * Sets the value of overwrite to the opposite of whatever it currently is.
788
1052
  * @related EditSession.toggleOverwrite
789
1053
  **/
@@ -793,32 +1057,26 @@ var Editor = function(renderer, session) {
793
1057
 
794
1058
  /**
795
1059
  * Sets how fast the mouse scrolling should do.
796
- * @param {Number} speed A value indicating the new speed
797
- *
798
- *
799
- *
1060
+ * @param {Number} speed A value indicating the new speed (in milliseconds)
800
1061
  **/
801
1062
  this.setScrollSpeed = function(speed) {
802
- this.$mouseHandler.setScrollSpeed(speed);
1063
+ this.setOption("scrollSpeed", speed);
803
1064
  };
804
1065
 
805
1066
  /**
806
- * Returns the value indicating how fast the mouse scroll speed is.
1067
+ * Returns the value indicating how fast the mouse scroll speed is (in milliseconds).
807
1068
  * @returns {Number}
808
1069
  **/
809
1070
  this.getScrollSpeed = function() {
810
- return this.$mouseHandler.getScrollSpeed();
1071
+ return this.getOption("scrollSpeed");
811
1072
  };
812
1073
 
813
1074
  /**
814
1075
  * Sets the delay (in milliseconds) of the mouse drag.
815
1076
  * @param {Number} dragDelay A value indicating the new delay
816
- *
817
- *
818
- *
819
1077
  **/
820
1078
  this.setDragDelay = function(dragDelay) {
821
- this.$mouseHandler.setDragDelay(dragDelay);
1079
+ this.setOption("dragDelay", dragDelay);
822
1080
  };
823
1081
 
824
1082
  /**
@@ -826,34 +1084,21 @@ var Editor = function(renderer, session) {
826
1084
  * @returns {Number}
827
1085
  **/
828
1086
  this.getDragDelay = function() {
829
- return this.$mouseHandler.getDragDelay();
1087
+ return this.getOption("dragDelay");
830
1088
  };
831
1089
 
832
- this.$selectionStyle = "line";
833
-
834
1090
  /**
835
1091
  * Emitted when the selection style changes, via [[Editor.setSelectionStyle]].
836
1092
  * @event changeSelectionStyle
837
1093
  * @param {Object} data Contains one property, `data`, which indicates the new selection style
838
- *
839
- *
840
- *
841
1094
  **/
842
1095
  /**
843
- * Indicates how selections should occur.
844
- *
845
- * By default, selections are set to "line". This function also emits the `'changeSelectionStyle'` event.
1096
+ * Draw selection markers spanning whole line, or only over selected text. Default value is "line"
1097
+ * @param {String} style The new selection style "line"|"text"
846
1098
  *
847
- * @param {String} style The new selection style
848
- *
849
- *
850
1099
  **/
851
- this.setSelectionStyle = function(style) {
852
- if (this.$selectionStyle == style) return;
853
-
854
- this.$selectionStyle = style;
855
- this.onSelectionChange();
856
- this._emit("changeSelectionStyle", {data: style});
1100
+ this.setSelectionStyle = function(val) {
1101
+ this.setOption("selectionStyle", val);
857
1102
  };
858
1103
 
859
1104
  /**
@@ -861,60 +1106,38 @@ var Editor = function(renderer, session) {
861
1106
  * @returns {String}
862
1107
  **/
863
1108
  this.getSelectionStyle = function() {
864
- return this.$selectionStyle;
1109
+ return this.getOption("selectionStyle");
865
1110
  };
866
1111
 
867
- this.$highlightActiveLine = true;
868
-
869
1112
  /**
870
1113
  * Determines whether or not the current line should be highlighted.
871
1114
  * @param {Boolean} shouldHighlight Set to `true` to highlight the current line
872
- *
873
- *
874
- *
875
1115
  **/
876
1116
  this.setHighlightActiveLine = function(shouldHighlight) {
877
- if (this.$highlightActiveLine == shouldHighlight)
878
- return;
879
-
880
- this.$highlightActiveLine = shouldHighlight;
881
- this.$updateHighlightActiveLine();
1117
+ this.setOption("highlightActiveLine", shouldHighlight);
882
1118
  };
883
-
884
1119
  /**
885
1120
  * Returns `true` if current lines are always highlighted.
886
- * @return Boolean
1121
+ * @return {Boolean}
887
1122
  **/
888
1123
  this.getHighlightActiveLine = function() {
889
- return this.$highlightActiveLine;
1124
+ return this.getOption("highlightActiveLine");
890
1125
  };
891
-
892
- this.$highlightGutterLine = true;
893
1126
  this.setHighlightGutterLine = function(shouldHighlight) {
894
- if (this.$highlightGutterLine == shouldHighlight)
895
- return;
896
-
897
- this.renderer.setHighlightGutterLine(shouldHighlight);
898
- this.$highlightGutterLine = shouldHighlight;
1127
+ this.setOption("highlightGutterLine", shouldHighlight);
899
1128
  };
900
1129
 
901
1130
  this.getHighlightGutterLine = function() {
902
- return this.$highlightGutterLine;
1131
+ return this.getOption("highlightGutterLine");
903
1132
  };
904
1133
 
905
- this.$highlightSelectedWord = true;
906
1134
  /**
907
1135
  * Determines if the currently selected word should be highlighted.
908
1136
  * @param {Boolean} shouldHighlight Set to `true` to highlight the currently selected word
909
1137
  *
910
- *
911
1138
  **/
912
1139
  this.setHighlightSelectedWord = function(shouldHighlight) {
913
- if (this.$highlightSelectedWord == shouldHighlight)
914
- return;
915
-
916
- this.$highlightSelectedWord = shouldHighlight;
917
- this.$onSelectionChange();
1140
+ this.setOption("highlightSelectedWord", shouldHighlight);
918
1141
  };
919
1142
 
920
1143
  /**
@@ -934,10 +1157,9 @@ var Editor = function(renderer, session) {
934
1157
  };
935
1158
 
936
1159
  /**
937
- * If `showInvisibiles` is set to `true`, invisible characters&mdash;like spaces or new lines&mdash;are show in the editor.
1160
+ * If `showInvisibles` is set to `true`, invisible characters&mdash;like spaces or new lines&mdash;are show in the editor.
938
1161
  * @param {Boolean} showInvisibles Specifies whether or not to show invisible characters
939
- *
940
- *
1162
+ *
941
1163
  **/
942
1164
  this.setShowInvisibles = function(showInvisibles) {
943
1165
  this.renderer.setShowInvisibles(showInvisibles);
@@ -962,8 +1184,7 @@ var Editor = function(renderer, session) {
962
1184
  /**
963
1185
  * If `showPrintMargin` is set to `true`, the print margin is shown in the editor.
964
1186
  * @param {Boolean} showPrintMargin Specifies whether or not to show the print margin
965
- *
966
- *
1187
+ *
967
1188
  **/
968
1189
  this.setShowPrintMargin = function(showPrintMargin) {
969
1190
  this.renderer.setShowPrintMargin(showPrintMargin);
@@ -981,8 +1202,6 @@ var Editor = function(renderer, session) {
981
1202
  * Sets the column defining where the print margin should be.
982
1203
  * @param {Number} showPrintMargin Specifies the new print margin
983
1204
  *
984
- *
985
- *
986
1205
  **/
987
1206
  this.setPrintMarginColumn = function(showPrintMargin) {
988
1207
  this.renderer.setPrintMarginColumn(showPrintMargin);
@@ -996,15 +1215,13 @@ var Editor = function(renderer, session) {
996
1215
  return this.renderer.getPrintMarginColumn();
997
1216
  };
998
1217
 
999
- this.$readOnly = false;
1000
1218
  /**
1001
1219
  * If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change.
1002
1220
  * @param {Boolean} readOnly Specifies whether the editor can be modified or not
1003
- *
1004
- *
1221
+ *
1005
1222
  **/
1006
1223
  this.setReadOnly = function(readOnly) {
1007
- this.$readOnly = readOnly;
1224
+ this.setOption("readOnly", readOnly);
1008
1225
  };
1009
1226
 
1010
1227
  /**
@@ -1012,87 +1229,71 @@ var Editor = function(renderer, session) {
1012
1229
  * @returns {Boolean}
1013
1230
  **/
1014
1231
  this.getReadOnly = function() {
1015
- return this.$readOnly;
1232
+ return this.getOption("readOnly");
1016
1233
  };
1017
1234
 
1018
- this.$modeBehaviours = true;
1019
-
1020
1235
  /**
1021
1236
  * Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef}
1022
1237
  * @param {Boolean} enabled Enables or disables behaviors
1023
- *
1024
- *
1238
+ *
1025
1239
  **/
1026
1240
  this.setBehavioursEnabled = function (enabled) {
1027
- this.$modeBehaviours = enabled;
1241
+ this.setOption("behavioursEnabled", enabled);
1028
1242
  };
1029
1243
 
1030
1244
  /**
1031
1245
  * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef}
1032
- *
1246
+ *
1033
1247
  * @returns {Boolean}
1034
1248
  **/
1035
1249
  this.getBehavioursEnabled = function () {
1036
- return this.$modeBehaviours;
1250
+ return this.getOption("behavioursEnabled");
1037
1251
  };
1038
1252
 
1039
- this.$modeWrapBehaviours = true;
1040
-
1041
1253
  /**
1042
- * Editor.setWrapBehavioursEnabled(enabled)
1043
- * - enabled (Boolean): Enables or disables wrapping behaviors
1044
- *
1045
1254
  * Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets
1046
1255
  * when such a character is typed in.
1256
+ * @param {Boolean} enabled Enables or disables wrapping behaviors
1257
+ *
1047
1258
  **/
1048
1259
  this.setWrapBehavioursEnabled = function (enabled) {
1049
- this.$modeWrapBehaviours = enabled;
1260
+ this.setOption("wrapBehavioursEnabled", enabled);
1050
1261
  };
1051
1262
 
1052
1263
  /**
1053
1264
  * Returns `true` if the wrapping behaviors are currently enabled.
1054
1265
  **/
1055
1266
  this.getWrapBehavioursEnabled = function () {
1056
- return this.$modeWrapBehaviours;
1267
+ return this.getOption("wrapBehavioursEnabled");
1057
1268
  };
1058
1269
 
1059
1270
  /**
1060
- * Indicates whether the fold widgets are shown or not.
1271
+ * Indicates whether the fold widgets should be shown or not.
1061
1272
  * @param {Boolean} show Specifies whether the fold widgets are shown
1062
- *
1063
- *
1064
1273
  **/
1065
1274
  this.setShowFoldWidgets = function(show) {
1066
- var gutter = this.renderer.$gutterLayer;
1067
- if (gutter.getShowFoldWidgets() == show)
1068
- return;
1275
+ this.setOption("showFoldWidgets", show);
1069
1276
 
1070
- this.renderer.$gutterLayer.setShowFoldWidgets(show);
1071
- this.$showFoldWidgets = show;
1072
- this.renderer.updateFull();
1073
1277
  };
1074
-
1075
1278
  /**
1076
1279
  * Returns `true` if the fold widgets are shown.
1077
- * @return Boolean
1280
+ * @return {Boolean}
1078
1281
  **/
1079
1282
  this.getShowFoldWidgets = function() {
1080
- return this.renderer.$gutterLayer.getShowFoldWidgets();
1283
+ return this.getOption("showFoldWidgets");
1081
1284
  };
1082
1285
 
1083
- this.setFadeFoldWidgets = function(show) {
1084
- this.renderer.setFadeFoldWidgets(show);
1286
+ this.setFadeFoldWidgets = function(fade) {
1287
+ this.setOption("fadeFoldWidgets", fade);
1085
1288
  };
1086
1289
 
1087
1290
  this.getFadeFoldWidgets = function() {
1088
- return this.renderer.getFadeFoldWidgets();
1291
+ return this.getOption("fadeFoldWidgets");
1089
1292
  };
1090
1293
 
1091
1294
  /**
1092
- * Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
1295
+ * Removes the current selection or one character.
1093
1296
  * @param {String} dir The direction of the deletion to occur, either "left" or "right"
1094
- *
1095
- *
1096
1297
  *
1097
1298
  **/
1098
1299
  this.remove = function(dir) {
@@ -1108,6 +1309,16 @@ var Editor = function(renderer, session) {
1108
1309
  var session = this.session;
1109
1310
  var state = session.getState(range.start.row);
1110
1311
  var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
1312
+
1313
+ if (range.end.column === 0) {
1314
+ var text = session.getTextRange(range);
1315
+ if (text[text.length - 1] == "\n") {
1316
+ var line = session.getLine(range.end.row);
1317
+ if (/^\s+$/.test(line)) {
1318
+ range.end.column = line.length;
1319
+ }
1320
+ }
1321
+ }
1111
1322
  if (new_range)
1112
1323
  range = new_range;
1113
1324
  }
@@ -1236,35 +1447,58 @@ var Editor = function(renderer, session) {
1236
1447
  this.selection.setSelectionRange(originalRange);
1237
1448
  };
1238
1449
 
1239
- /**
1240
- * Indents the current line.
1241
- *
1450
+ /**
1451
+ * Inserts an indentation into the current cursor position or indents the selected lines.
1452
+ *
1242
1453
  * @related EditSession.indentRows
1243
1454
  **/
1244
1455
  this.indent = function() {
1245
1456
  var session = this.session;
1246
1457
  var range = this.getSelectionRange();
1247
1458
 
1248
- if (range.start.row < range.end.row || range.start.column < range.end.column) {
1459
+ if (range.start.row < range.end.row) {
1249
1460
  var rows = this.$getSelectedRows();
1250
1461
  session.indentRows(rows.first, rows.last, "\t");
1462
+ return;
1463
+ } else if (range.start.column < range.end.column) {
1464
+ var text = session.getTextRange(range);
1465
+ if (!/^\s+$/.test(text)) {
1466
+ var rows = this.$getSelectedRows();
1467
+ session.indentRows(rows.first, rows.last, "\t");
1468
+ return;
1469
+ }
1470
+ }
1471
+
1472
+ var line = session.getLine(range.start.row);
1473
+ var position = range.start;
1474
+ var size = session.getTabSize();
1475
+ var column = session.documentToScreenColumn(position.row, position.column);
1476
+
1477
+ if (this.session.getUseSoftTabs()) {
1478
+ var count = (size - column % size);
1479
+ var indentString = lang.stringRepeat(" ", count);
1251
1480
  } else {
1252
- var indentString;
1253
-
1254
- if (this.session.getUseSoftTabs()) {
1255
- var size = session.getTabSize(),
1256
- position = this.getCursorPosition(),
1257
- column = session.documentToScreenColumn(position.row, position.column),
1258
- count = (size - column % size);
1259
-
1260
- indentString = lang.stringRepeat(" ", count);
1261
- } else
1262
- indentString = "\t";
1263
- return this.insert(indentString);
1481
+ var count = column % size;
1482
+ while (line[range.start.column] == " " && count) {
1483
+ range.start.column--;
1484
+ count--;
1485
+ }
1486
+ this.selection.setSelectionRange(range);
1487
+ indentString = "\t";
1264
1488
  }
1489
+ return this.insert(indentString);
1265
1490
  };
1266
1491
 
1267
- /**
1492
+ /**
1493
+ * Indents the current line.
1494
+ * @related EditSession.indentRows
1495
+ **/
1496
+ this.blockIndent = function() {
1497
+ var rows = this.$getSelectedRows();
1498
+ this.session.indentRows(rows.first, rows.last, "\t");
1499
+ };
1500
+
1501
+ /**
1268
1502
  * Outdents the current line.
1269
1503
  * @related EditSession.outdentRows
1270
1504
  **/
@@ -1299,7 +1533,6 @@ var Editor = function(renderer, session) {
1299
1533
  };
1300
1534
 
1301
1535
  /**
1302
- *
1303
1536
  * Given the currently selected range, this function either comments all the lines, or uncomments all of them.
1304
1537
  **/
1305
1538
  this.toggleCommentLines = function() {
@@ -1308,35 +1541,40 @@ var Editor = function(renderer, session) {
1308
1541
  this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
1309
1542
  };
1310
1543
 
1544
+ this.toggleBlockComment = function() {
1545
+ var cursor = this.getCursorPosition();
1546
+ var state = this.session.getState(cursor.row);
1547
+ var range = this.getSelectionRange();
1548
+ this.session.getMode().toggleBlockComment(state, this.session, range, cursor);
1549
+ };
1550
+
1311
1551
  /**
1312
1552
  * Works like [[EditSession.getTokenAt]], except it returns a number.
1313
1553
  * @returns {Number}
1314
1554
  **/
1315
- this.getNumberAt = function( row, column ) {
1316
- var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g
1317
- _numberRx.lastIndex = 0
1555
+ this.getNumberAt = function(row, column) {
1556
+ var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
1557
+ _numberRx.lastIndex = 0;
1318
1558
 
1319
- var s = this.session.getLine(row)
1320
- while(_numberRx.lastIndex < column - 1 ){
1321
- var m = _numberRx.exec(s)
1559
+ var s = this.session.getLine(row);
1560
+ while (_numberRx.lastIndex < column) {
1561
+ var m = _numberRx.exec(s);
1322
1562
  if(m.index <= column && m.index+m[0].length >= column){
1323
1563
  var number = {
1324
1564
  value: m[0],
1325
1565
  start: m.index,
1326
1566
  end: m.index+m[0].length
1327
-
1328
- }
1329
- return number
1567
+ };
1568
+ return number;
1330
1569
  }
1331
1570
  }
1332
1571
  return null;
1333
1572
  };
1334
-
1573
+
1335
1574
  /**
1336
- * Editor.modifyNumber(amount)
1575
+ * If the character before the cursor is a number, this functions changes its value by `amount`.
1337
1576
  * @param {Number} amount The value to change the numeral by (can be negative to decrease value)
1338
1577
  *
1339
- * If the character before the cursor is a number, this functions changes its value by `amount`.
1340
1578
  **/
1341
1579
  this.modifyNumber = function(amount) {
1342
1580
  var row = this.selection.getCursor().row;
@@ -1357,14 +1595,14 @@ var Editor = function(renderer, session) {
1357
1595
 
1358
1596
  var t = parseFloat(nr.value);
1359
1597
  t *= Math.pow(10, decimals);
1360
-
1598
+
1361
1599
 
1362
1600
  if(fp !== nr.end && column < fp){
1363
1601
  amount *= Math.pow(10, nr.end - column - 1);
1364
1602
  } else {
1365
1603
  amount *= Math.pow(10, nr.end - column);
1366
1604
  }
1367
-
1605
+
1368
1606
  t += amount;
1369
1607
  t /= Math.pow(10, decimals);
1370
1608
  var nnr = t.toFixed(decimals);
@@ -1379,8 +1617,8 @@ var Editor = function(renderer, session) {
1379
1617
  }
1380
1618
  }
1381
1619
  };
1382
-
1383
- /**
1620
+
1621
+ /**
1384
1622
  * Removes all the lines in the current selection
1385
1623
  * @related EditSession.remove
1386
1624
  **/
@@ -1402,128 +1640,143 @@ var Editor = function(renderer, session) {
1402
1640
  var sel = this.selection;
1403
1641
  var doc = this.session;
1404
1642
  var range = sel.getRange();
1643
+ var reverse = sel.isBackwards();
1405
1644
  if (range.isEmpty()) {
1406
1645
  var row = range.start.row;
1407
1646
  doc.duplicateLines(row, row);
1408
1647
  } else {
1409
- var reverse = sel.isBackwards()
1410
- var point = sel.isBackwards() ? range.start : range.end;
1648
+ var point = reverse ? range.start : range.end;
1411
1649
  var endPoint = doc.insert(point, doc.getTextRange(range), false);
1412
1650
  range.start = point;
1413
1651
  range.end = endPoint;
1414
-
1415
- sel.setSelectionRange(range, reverse)
1652
+
1653
+ sel.setSelectionRange(range, reverse);
1416
1654
  }
1417
1655
  };
1418
-
1419
- /**
1656
+
1657
+ /**
1420
1658
  * Shifts all the selected lines down one row.
1421
1659
  *
1422
1660
  * @returns {Number} On success, it returns -1.
1423
1661
  * @related EditSession.moveLinesUp
1424
1662
  **/
1425
1663
  this.moveLinesDown = function() {
1426
- this.$moveLines(function(firstRow, lastRow) {
1427
- return this.session.moveLinesDown(firstRow, lastRow);
1428
- });
1664
+ this.$moveLines(1, false);
1429
1665
  };
1430
1666
 
1431
- /**
1667
+ /**
1432
1668
  * Shifts all the selected lines up one row.
1433
1669
  * @returns {Number} On success, it returns -1.
1434
1670
  * @related EditSession.moveLinesDown
1435
1671
  **/
1436
1672
  this.moveLinesUp = function() {
1437
- this.$moveLines(function(firstRow, lastRow) {
1438
- return this.session.moveLinesUp(firstRow, lastRow);
1439
- });
1673
+ this.$moveLines(-1, false);
1440
1674
  };
1441
1675
 
1442
- /**
1676
+ /**
1443
1677
  * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
1444
1678
  * ```json
1445
1679
  * { row: newRowLocation, column: newColumnLocation }
1446
1680
  * ```
1447
1681
  * @param {Range} fromRange The range of text you want moved within the document
1448
1682
  * @param {Object} toPosition The location (row and column) where you want to move the text to
1449
- *
1683
+ *
1450
1684
  * @returns {Range} The new range where the text was moved to.
1451
1685
  * @related EditSession.moveText
1452
1686
  **/
1453
- this.moveText = function(range, toPosition) {
1454
- if (this.$readOnly)
1455
- return null;
1456
-
1457
- return this.session.moveText(range, toPosition);
1687
+ this.moveText = function(range, toPosition, copy) {
1688
+ return this.session.moveText(range, toPosition, copy);
1458
1689
  };
1459
1690
 
1460
- /**
1691
+ /**
1461
1692
  * Copies all the selected lines up one row.
1462
1693
  * @returns {Number} On success, returns 0.
1463
- *
1694
+ *
1464
1695
  **/
1465
1696
  this.copyLinesUp = function() {
1466
- this.$moveLines(function(firstRow, lastRow) {
1467
- this.session.duplicateLines(firstRow, lastRow);
1468
- return 0;
1469
- });
1697
+ this.$moveLines(-1, true);
1470
1698
  };
1471
1699
 
1472
- /**
1700
+ /**
1473
1701
  * Copies all the selected lines down one row.
1474
1702
  * @returns {Number} On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
1475
1703
  * @related EditSession.duplicateLines
1476
1704
  *
1477
1705
  **/
1478
1706
  this.copyLinesDown = function() {
1479
- this.$moveLines(function(firstRow, lastRow) {
1480
- return this.session.duplicateLines(firstRow, lastRow);
1481
- });
1707
+ this.$moveLines(1, true);
1482
1708
  };
1483
1709
 
1484
-
1485
1710
  /**
1486
- * Executes a specific function, which can be anything that manipulates selected lines, such as copying them, duplicating them, or shifting them.
1487
- * @param {Function} mover A method to call on each selected row
1488
- *
1711
+ * for internal use
1712
+ * @ignore
1489
1713
  *
1490
1714
  **/
1491
- this.$moveLines = function(mover) {
1492
- var rows = this.$getSelectedRows();
1715
+ this.$moveLines = function(dir, copy) {
1716
+ var rows, moved;
1493
1717
  var selection = this.selection;
1494
- if (!selection.isMultiLine()) {
1495
- var range = selection.getRange();
1496
- var reverse = selection.isBackwards();
1497
- }
1498
-
1499
- var linesMoved = mover.call(this, rows.first, rows.last);
1500
-
1501
- if (range) {
1502
- range.start.row += linesMoved;
1503
- range.end.row += linesMoved;
1504
- selection.setSelectionRange(range, reverse);
1505
- }
1506
- else {
1507
- selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
1508
- selection.$moveSelection(function() {
1509
- selection.moveCursorTo(rows.first+linesMoved, 0);
1510
- });
1718
+ if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
1719
+ var range = selection.toOrientedRange();
1720
+ rows = this.$getSelectedRows(range);
1721
+ moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir);
1722
+ if (copy && dir == -1) moved = 0;
1723
+ range.moveBy(moved, 0);
1724
+ selection.fromOrientedRange(range);
1725
+ } else {
1726
+ var ranges = selection.rangeList.ranges;
1727
+ selection.rangeList.detach(this.session);
1728
+ this.inVirtualSelectionMode = true;
1729
+
1730
+ var diff = 0;
1731
+ var totalDiff = 0;
1732
+ var l = ranges.length;
1733
+ for (var i = 0; i < l; i++) {
1734
+ var rangeIndex = i;
1735
+ ranges[i].moveBy(diff, 0);
1736
+ rows = this.$getSelectedRows(ranges[i]);
1737
+ var first = rows.first;
1738
+ var last = rows.last;
1739
+ while (++i < l) {
1740
+ if (totalDiff) ranges[i].moveBy(totalDiff, 0);
1741
+ var subRows = this.$getSelectedRows(ranges[i]);
1742
+ if (copy && subRows.first != last)
1743
+ break;
1744
+ else if (!copy && subRows.first > last + 1)
1745
+ break;
1746
+ last = subRows.last;
1747
+ }
1748
+ i--;
1749
+ diff = this.session.$moveLines(first, last, copy ? 0 : dir);
1750
+ if (copy && dir == -1) rangeIndex = i + 1;
1751
+ while (rangeIndex <= i) {
1752
+ ranges[rangeIndex].moveBy(diff, 0);
1753
+ rangeIndex++;
1754
+ }
1755
+ if (!copy) diff = 0;
1756
+ totalDiff += diff;
1757
+ }
1758
+
1759
+ selection.fromOrientedRange(selection.ranges[0]);
1760
+ selection.rangeList.attach(this.session);
1761
+ this.inVirtualSelectionMode = false;
1511
1762
  }
1512
1763
  };
1513
1764
 
1514
1765
  /**
1515
1766
  * Returns an object indicating the currently selected rows. The object looks like this:
1767
+ *
1516
1768
  * ```json
1517
1769
  * { first: range.start.row, last: range.end.row }
1518
1770
  * ```
1771
+ *
1519
1772
  * @returns {Object}
1520
1773
  **/
1521
- this.$getSelectedRows = function() {
1522
- var range = this.getSelectionRange().collapseRows();
1774
+ this.$getSelectedRows = function(range) {
1775
+ range = (range || this.getSelectionRange()).collapseRows();
1523
1776
 
1524
1777
  return {
1525
- first: range.start.row,
1526
- last: range.end.row
1778
+ first: this.session.getRowFoldStart(range.start.row),
1779
+ last: this.session.getRowFoldEnd(range.end.row)
1527
1780
  };
1528
1781
  };
1529
1782
 
@@ -1539,8 +1792,9 @@ var Editor = function(renderer, session) {
1539
1792
  this.renderer.hideComposition();
1540
1793
  };
1541
1794
 
1542
- /**
1795
+ /**
1543
1796
  * {:VirtualRenderer.getFirstVisibleRow}
1797
+ *
1544
1798
  * @returns {Number}
1545
1799
  * @related VirtualRenderer.getFirstVisibleRow
1546
1800
  **/
@@ -1548,8 +1802,9 @@ var Editor = function(renderer, session) {
1548
1802
  return this.renderer.getFirstVisibleRow();
1549
1803
  };
1550
1804
 
1551
- /**
1805
+ /**
1552
1806
  * {:VirtualRenderer.getLastVisibleRow}
1807
+ *
1553
1808
  * @returns {Number}
1554
1809
  * @related VirtualRenderer.getLastVisibleRow
1555
1810
  **/
@@ -1560,7 +1815,7 @@ var Editor = function(renderer, session) {
1560
1815
  /**
1561
1816
  * Indicates if the row is currently visible on the screen.
1562
1817
  * @param {Number} row The row to check
1563
- *
1818
+ *
1564
1819
  * @returns {Boolean}
1565
1820
  **/
1566
1821
  this.isRowVisible = function(row) {
@@ -1570,8 +1825,8 @@ var Editor = function(renderer, session) {
1570
1825
  /**
1571
1826
  * Indicates if the entire row is currently visible on the screen.
1572
1827
  * @param {Number} row The row to check
1573
- *
1574
- *
1828
+ *
1829
+ *
1575
1830
  * @returns {Boolean}
1576
1831
  **/
1577
1832
  this.isRowFullyVisible = function(row) {
@@ -1592,11 +1847,11 @@ var Editor = function(renderer, session) {
1592
1847
  var rows = dir * Math.floor(config.height / config.lineHeight);
1593
1848
 
1594
1849
  this.$blockScrolling++;
1595
- if (select == true) {
1850
+ if (select === true) {
1596
1851
  this.selection.$moveSelection(function(){
1597
1852
  this.moveCursorBy(rows, 0);
1598
1853
  });
1599
- } else if (select == false) {
1854
+ } else if (select === false) {
1600
1855
  this.selection.moveCursorBy(rows, 0);
1601
1856
  this.selection.clearSelection();
1602
1857
  }
@@ -1653,7 +1908,7 @@ var Editor = function(renderer, session) {
1653
1908
  this.$moveByPage(-1);
1654
1909
  };
1655
1910
 
1656
- /**
1911
+ /**
1657
1912
  * Moves the editor to the specified row.
1658
1913
  * @related VirtualRenderer.scrollToRow
1659
1914
  **/
@@ -1661,14 +1916,14 @@ var Editor = function(renderer, session) {
1661
1916
  this.renderer.scrollToRow(row);
1662
1917
  };
1663
1918
 
1664
- /**
1919
+ /**
1665
1920
  * Scrolls to a line. If `center` is `true`, it puts the line in middle of screen (or attempts to).
1666
1921
  * @param {Number} line The line to scroll to
1667
- * @param {Boolean} center If `true`
1922
+ * @param {Boolean} center If `true`
1668
1923
  * @param {Boolean} animate If `true` animates scrolling
1669
1924
  * @param {Function} callback Function to be called when the animation has finished
1670
1925
  *
1671
- *
1926
+ *
1672
1927
  * @related VirtualRenderer.scrollToLine
1673
1928
  **/
1674
1929
  this.scrollToLine = function(line, center, animate, callback) {
@@ -1683,13 +1938,14 @@ var Editor = function(renderer, session) {
1683
1938
  var pos = {
1684
1939
  row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
1685
1940
  column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
1686
- }
1941
+ };
1687
1942
  this.renderer.alignCursor(pos, 0.5);
1688
1943
  };
1689
1944
 
1690
- /**
1945
+ /**
1691
1946
  * Gets the current position of the cursor.
1692
- * @returns {Object} An object that looks something like this:
1947
+ * @returns {Object} An object that looks something like this:
1948
+ *
1693
1949
  * ```json
1694
1950
  * { row: currRow, column: currCol }
1695
1951
  * ```
@@ -1700,7 +1956,7 @@ var Editor = function(renderer, session) {
1700
1956
  return this.selection.getCursor();
1701
1957
  };
1702
1958
 
1703
- /**
1959
+ /**
1704
1960
  * Returns the screen position of the cursor.
1705
1961
  * @returns {Number}
1706
1962
  * @related EditSession.documentToScreenPosition
@@ -1709,7 +1965,7 @@ var Editor = function(renderer, session) {
1709
1965
  return this.session.documentToScreenPosition(this.getCursorPosition());
1710
1966
  };
1711
1967
 
1712
- /**
1968
+ /**
1713
1969
  * {:Selection.getRange}
1714
1970
  * @returns {Range}
1715
1971
  * @related Selection.getRange
@@ -1719,7 +1975,7 @@ var Editor = function(renderer, session) {
1719
1975
  };
1720
1976
 
1721
1977
 
1722
- /**
1978
+ /**
1723
1979
  * Selects all the text in editor.
1724
1980
  * @related Selection.selectAll
1725
1981
  **/
@@ -1729,7 +1985,7 @@ var Editor = function(renderer, session) {
1729
1985
  this.$blockScrolling -= 1;
1730
1986
  };
1731
1987
 
1732
- /**
1988
+ /**
1733
1989
  * {:Selection.clearSelection}
1734
1990
  * @related Selection.clearSelection
1735
1991
  **/
@@ -1737,7 +1993,7 @@ var Editor = function(renderer, session) {
1737
1993
  this.selection.clearSelection();
1738
1994
  };
1739
1995
 
1740
- /**
1996
+ /**
1741
1997
  * Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
1742
1998
  * @param {Number} row The new row number
1743
1999
  * @param {Number} column The new column number
@@ -1749,10 +2005,10 @@ var Editor = function(renderer, session) {
1749
2005
  this.selection.moveCursorTo(row, column);
1750
2006
  };
1751
2007
 
1752
- /**
2008
+ /**
1753
2009
  * Moves the cursor to the position indicated by `pos.row` and `pos.column`.
1754
2010
  * @param {Object} pos An object with two properties, row and column
1755
- *
2011
+ *
1756
2012
  *
1757
2013
  * @related Selection.moveCursorToPosition
1758
2014
  **/
@@ -1760,37 +2016,169 @@ var Editor = function(renderer, session) {
1760
2016
  this.selection.moveCursorToPosition(pos);
1761
2017
  };
1762
2018
 
1763
- /**
1764
- * Moves the cursor's row and column to the next matching bracket.
2019
+ /**
2020
+ * Moves the cursor's row and column to the next matching bracket or HTML tag.
1765
2021
  *
1766
2022
  **/
1767
- this.jumpToMatching = function(select) {
2023
+ this.jumpToMatching = function(select, expand) {
1768
2024
  var cursor = this.getCursorPosition();
2025
+ var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
2026
+ var prevToken = iterator.getCurrentToken();
2027
+ var token = prevToken || iterator.stepForward();
2028
+
2029
+ if (!token) return;
2030
+
2031
+ //get next closing tag or bracket
2032
+ var matchType;
2033
+ var found = false;
2034
+ var depth = {};
2035
+ var i = cursor.column - token.start;
2036
+ var bracketType;
2037
+ var brackets = {
2038
+ ")": "(",
2039
+ "(": "(",
2040
+ "]": "[",
2041
+ "[": "[",
2042
+ "{": "{",
2043
+ "}": "{"
2044
+ };
2045
+
2046
+ do {
2047
+ if (token.value.match(/[{}()\[\]]/g)) {
2048
+ for (; i < token.value.length && !found; i++) {
2049
+ if (!brackets[token.value[i]]) {
2050
+ continue;
2051
+ }
2052
+
2053
+ bracketType = brackets[token.value[i]] + '.' + token.type.replace("rparen", "lparen");
2054
+
2055
+ if (isNaN(depth[bracketType])) {
2056
+ depth[bracketType] = 0;
2057
+ }
2058
+
2059
+ switch (token.value[i]) {
2060
+ case '(':
2061
+ case '[':
2062
+ case '{':
2063
+ depth[bracketType]++;
2064
+ break;
2065
+ case ')':
2066
+ case ']':
2067
+ case '}':
2068
+ depth[bracketType]--;
2069
+
2070
+ if (depth[bracketType] === -1) {
2071
+ matchType = 'bracket';
2072
+ found = true;
2073
+ }
2074
+ break;
2075
+ }
2076
+ }
2077
+ }
2078
+ else if (token && token.type.indexOf('tag-name') !== -1) {
2079
+ if (isNaN(depth[token.value])) {
2080
+ depth[token.value] = 0;
2081
+ }
2082
+
2083
+ if (prevToken.value === '<') {
2084
+ depth[token.value]++;
2085
+ }
2086
+ else if (prevToken.value === '</') {
2087
+ depth[token.value]--;
2088
+ }
2089
+
2090
+ if (depth[token.value] === -1) {
2091
+ matchType = 'tag';
2092
+ found = true;
2093
+ }
2094
+ }
1769
2095
 
1770
- var range = this.session.getBracketRange(cursor);
1771
- if (!range) {
1772
- range = this.find({
1773
- needle: /[{}()\[\]]/g,
1774
- preventScroll:true,
1775
- start: {row: cursor.row, column: cursor.column - 1}
1776
- });
1777
- if (!range)
2096
+ if (!found) {
2097
+ prevToken = token;
2098
+ token = iterator.stepForward();
2099
+ i = 0;
2100
+ }
2101
+ } while (token && !found);
2102
+
2103
+ //no match found
2104
+ if (!matchType)
2105
+ return;
2106
+
2107
+ var range, pos;
2108
+ if (matchType === 'bracket') {
2109
+ range = this.session.getBracketRange(cursor);
2110
+ if (!range) {
2111
+ range = new Range(
2112
+ iterator.getCurrentTokenRow(),
2113
+ iterator.getCurrentTokenColumn() + i - 1,
2114
+ iterator.getCurrentTokenRow(),
2115
+ iterator.getCurrentTokenColumn() + i - 1
2116
+ );
2117
+ pos = range.start;
2118
+ if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
2119
+ range = this.session.getBracketRange(pos);
2120
+ }
2121
+ }
2122
+ else if (matchType === 'tag') {
2123
+ if (token && token.type.indexOf('tag-name') !== -1)
2124
+ var tag = token.value;
2125
+ else
1778
2126
  return;
1779
- var pos = range.start;
1780
- if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
1781
- range = this.session.getBracketRange(pos);
2127
+
2128
+ range = new Range(
2129
+ iterator.getCurrentTokenRow(),
2130
+ iterator.getCurrentTokenColumn() - 2,
2131
+ iterator.getCurrentTokenRow(),
2132
+ iterator.getCurrentTokenColumn() - 2
2133
+ );
2134
+
2135
+ //find matching tag
2136
+ if (range.compare(cursor.row, cursor.column) === 0) {
2137
+ found = false;
2138
+ do {
2139
+ token = prevToken;
2140
+ prevToken = iterator.stepBackward();
2141
+
2142
+ if (prevToken) {
2143
+ if (prevToken.type.indexOf('tag-close') !== -1) {
2144
+ range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1);
2145
+ }
2146
+
2147
+ if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
2148
+ if (prevToken.value === '<') {
2149
+ depth[tag]++;
2150
+ }
2151
+ else if (prevToken.value === '</') {
2152
+ depth[tag]--;
2153
+ }
2154
+
2155
+ if (depth[tag] === 0)
2156
+ found = true;
2157
+ }
2158
+ }
2159
+ } while (prevToken && !found);
2160
+ }
2161
+
2162
+ //we found it
2163
+ if (token && token.type.indexOf('tag-name')) {
2164
+ pos = range.start;
2165
+ if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
2166
+ pos = range.end;
2167
+ }
1782
2168
  }
1783
-
2169
+
1784
2170
  pos = range && range.cursor || pos;
1785
2171
  if (pos) {
1786
2172
  if (select) {
1787
- if (range && range.isEqual(this.getSelectionRange()))
2173
+ if (range && expand) {
2174
+ this.selection.setRange(range);
2175
+ } else if (range && range.isEqual(this.getSelectionRange())) {
1788
2176
  this.clearSelection();
1789
- else
2177
+ } else {
1790
2178
  this.selection.selectTo(pos.row, pos.column);
2179
+ }
1791
2180
  } else {
1792
- this.clearSelection();
1793
- this.moveCursorTo(pos.row, pos.column);
2181
+ this.selection.moveTo(pos.row, pos.column);
1794
2182
  }
1795
2183
  }
1796
2184
  };
@@ -1800,13 +2188,15 @@ var Editor = function(renderer, session) {
1800
2188
  * @param {Number} lineNumber The line number to go to
1801
2189
  * @param {Number} column A column number to go to
1802
2190
  * @param {Boolean} animate If `true` animates scolling
1803
- *
2191
+ *
1804
2192
  **/
1805
2193
  this.gotoLine = function(lineNumber, column, animate) {
1806
2194
  this.selection.clearSelection();
1807
2195
  this.session.unfold({row: lineNumber - 1, column: column || 0});
1808
2196
 
1809
2197
  this.$blockScrolling += 1;
2198
+ // todo: find a way to automatically exit multiselect mode
2199
+ this.exitMultiSelectMode && this.exitMultiSelectMode();
1810
2200
  this.moveCursorTo(lineNumber - 1, column || 0);
1811
2201
  this.$blockScrolling -= 1;
1812
2202
 
@@ -1814,7 +2204,7 @@ var Editor = function(renderer, session) {
1814
2204
  this.scrollToLine(lineNumber - 1, true, animate);
1815
2205
  };
1816
2206
 
1817
- /**
2207
+ /**
1818
2208
  * Moves the cursor to the specified row and column. Note that this does de-select the current selection.
1819
2209
  * @param {Number} row The new row number
1820
2210
  * @param {Number} column The new column number
@@ -1823,39 +2213,44 @@ var Editor = function(renderer, session) {
1823
2213
  * @related Editor.moveCursorTo
1824
2214
  **/
1825
2215
  this.navigateTo = function(row, column) {
1826
- this.clearSelection();
1827
- this.moveCursorTo(row, column);
2216
+ this.selection.moveTo(row, column);
1828
2217
  };
1829
2218
 
1830
2219
  /**
1831
2220
  * Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
1832
2221
  * @param {Number} times The number of times to change navigation
1833
- *
1834
- *
2222
+ *
2223
+ *
1835
2224
  **/
1836
2225
  this.navigateUp = function(times) {
2226
+ if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
2227
+ var selectionStart = this.selection.anchor.getPosition();
2228
+ return this.moveCursorToPosition(selectionStart);
2229
+ }
1837
2230
  this.selection.clearSelection();
1838
- times = times || 1;
1839
- this.selection.moveCursorBy(-times, 0);
2231
+ this.selection.moveCursorBy(-times || -1, 0);
1840
2232
  };
1841
2233
 
1842
2234
  /**
1843
2235
  * Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
1844
2236
  * @param {Number} times The number of times to change navigation
1845
- *
1846
- *
2237
+ *
2238
+ *
1847
2239
  **/
1848
2240
  this.navigateDown = function(times) {
2241
+ if (this.selection.isMultiLine() && this.selection.isBackwards()) {
2242
+ var selectionEnd = this.selection.anchor.getPosition();
2243
+ return this.moveCursorToPosition(selectionEnd);
2244
+ }
1849
2245
  this.selection.clearSelection();
1850
- times = times || 1;
1851
- this.selection.moveCursorBy(times, 0);
2246
+ this.selection.moveCursorBy(times || 1, 0);
1852
2247
  };
1853
2248
 
1854
2249
  /**
1855
2250
  * Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
1856
2251
  * @param {Number} times The number of times to change navigation
1857
- *
1858
- *
2252
+ *
2253
+ *
1859
2254
  **/
1860
2255
  this.navigateLeft = function(times) {
1861
2256
  if (!this.selection.isEmpty()) {
@@ -1874,8 +2269,8 @@ var Editor = function(renderer, session) {
1874
2269
  /**
1875
2270
  * Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
1876
2271
  * @param {Number} times The number of times to change navigation
1877
- *
1878
- *
2272
+ *
2273
+ *
1879
2274
  **/
1880
2275
  this.navigateRight = function(times) {
1881
2276
  if (!this.selection.isEmpty()) {
@@ -1892,7 +2287,7 @@ var Editor = function(renderer, session) {
1892
2287
  };
1893
2288
 
1894
2289
  /**
1895
- *
2290
+ *
1896
2291
  * Moves the cursor to the start of the current line. Note that this does de-select the current selection.
1897
2292
  **/
1898
2293
  this.navigateLineStart = function() {
@@ -1901,7 +2296,7 @@ var Editor = function(renderer, session) {
1901
2296
  };
1902
2297
 
1903
2298
  /**
1904
- *
2299
+ *
1905
2300
  * Moves the cursor to the end of the current line. Note that this does de-select the current selection.
1906
2301
  **/
1907
2302
  this.navigateLineEnd = function() {
@@ -1910,29 +2305,25 @@ var Editor = function(renderer, session) {
1910
2305
  };
1911
2306
 
1912
2307
  /**
1913
- *
2308
+ *
1914
2309
  * Moves the cursor to the end of the current file. Note that this does de-select the current selection.
1915
2310
  **/
1916
2311
  this.navigateFileEnd = function() {
1917
- var scrollTop = this.renderer.scrollTop;
1918
2312
  this.selection.moveCursorFileEnd();
1919
2313
  this.clearSelection();
1920
- this.renderer.animateScrolling(scrollTop);
1921
2314
  };
1922
2315
 
1923
2316
  /**
1924
- *
2317
+ *
1925
2318
  * Moves the cursor to the start of the current file. Note that this does de-select the current selection.
1926
2319
  **/
1927
2320
  this.navigateFileStart = function() {
1928
- var scrollTop = this.renderer.scrollTop;
1929
2321
  this.selection.moveCursorFileStart();
1930
2322
  this.clearSelection();
1931
- this.renderer.animateScrolling(scrollTop);
1932
2323
  };
1933
2324
 
1934
2325
  /**
1935
- *
2326
+ *
1936
2327
  * Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.
1937
2328
  **/
1938
2329
  this.navigateWordRight = function() {
@@ -1941,7 +2332,7 @@ var Editor = function(renderer, session) {
1941
2332
  };
1942
2333
 
1943
2334
  /**
1944
- *
2335
+ *
1945
2336
  * Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.
1946
2337
  **/
1947
2338
  this.navigateWordLeft = function() {
@@ -1996,8 +2387,7 @@ var Editor = function(renderer, session) {
1996
2387
  this.$blockScrolling += 1;
1997
2388
 
1998
2389
  var selection = this.getSelectionRange();
1999
- this.clearSelection();
2000
- this.selection.moveCursorTo(0, 0);
2390
+ this.selection.moveTo(0, 0);
2001
2391
 
2002
2392
  for (var i = ranges.length - 1; i >= 0; --i) {
2003
2393
  if(this.$tryReplace(ranges[i], replacement)) {
@@ -2022,7 +2412,7 @@ var Editor = function(renderer, session) {
2022
2412
  }
2023
2413
  };
2024
2414
 
2025
- /**
2415
+ /**
2026
2416
  * {:Search.getOptions} For more information on `options`, see [[Search `Search`]].
2027
2417
  * @related Search.getOptions
2028
2418
  * @returns {Object}
@@ -2031,7 +2421,7 @@ var Editor = function(renderer, session) {
2031
2421
  return this.$search.getOptions();
2032
2422
  };
2033
2423
 
2034
- /**
2424
+ /**
2035
2425
  * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
2036
2426
  * @param {String} needle The text to search for (optional)
2037
2427
  * @param {Object} options An object defining various search properties
@@ -2079,7 +2469,7 @@ var Editor = function(renderer, session) {
2079
2469
  this.selection.setRange(range);
2080
2470
  };
2081
2471
 
2082
- /**
2472
+ /**
2083
2473
  * Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]].
2084
2474
  * @param {Object} options search options
2085
2475
  * @param {Boolean} animate If `true` animate scrolling
@@ -2091,7 +2481,7 @@ var Editor = function(renderer, session) {
2091
2481
  this.find({skipCurrent: true, backwards: false}, options, animate);
2092
2482
  };
2093
2483
 
2094
- /**
2484
+ /**
2095
2485
  * Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]].
2096
2486
  * @param {Object} options search options
2097
2487
  * @param {Boolean} animate If `true` animate scrolling
@@ -2111,11 +2501,11 @@ var Editor = function(renderer, session) {
2111
2501
 
2112
2502
  var scrollTop = this.renderer.scrollTop;
2113
2503
  this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
2114
- if (animate != false)
2504
+ if (animate !== false)
2115
2505
  this.renderer.animateScrolling(scrollTop);
2116
2506
  };
2117
2507
 
2118
- /**
2508
+ /**
2119
2509
  * {:UndoManager.undo}
2120
2510
  * @related UndoManager.undo
2121
2511
  **/
@@ -2126,7 +2516,7 @@ var Editor = function(renderer, session) {
2126
2516
  this.renderer.scrollCursorIntoView(null, 0.5);
2127
2517
  };
2128
2518
 
2129
- /**
2519
+ /**
2130
2520
  * {:UndoManager.redo}
2131
2521
  * @related UndoManager.redo
2132
2522
  **/
@@ -2137,16 +2527,167 @@ var Editor = function(renderer, session) {
2137
2527
  this.renderer.scrollCursorIntoView(null, 0.5);
2138
2528
  };
2139
2529
 
2140
- /**
2141
- *
2530
+ /**
2531
+ *
2142
2532
  * Cleans up the entire editor.
2143
2533
  **/
2144
2534
  this.destroy = function() {
2145
2535
  this.renderer.destroy();
2536
+ this._signal("destroy", this);
2537
+ if (this.session) {
2538
+ this.session.destroy();
2539
+ }
2540
+ };
2541
+
2542
+ /**
2543
+ * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element
2544
+ * @param {Boolean} enable default true
2545
+ **/
2546
+ this.setAutoScrollEditorIntoView = function(enable) {
2547
+ if (!enable)
2548
+ return;
2549
+ var rect;
2550
+ var self = this;
2551
+ var shouldScroll = false;
2552
+ if (!this.$scrollAnchor)
2553
+ this.$scrollAnchor = document.createElement("div");
2554
+ var scrollAnchor = this.$scrollAnchor;
2555
+ scrollAnchor.style.cssText = "position:absolute";
2556
+ this.container.insertBefore(scrollAnchor, this.container.firstChild);
2557
+ var onChangeSelection = this.on("changeSelection", function() {
2558
+ shouldScroll = true;
2559
+ });
2560
+ // needed to not trigger sync reflow
2561
+ var onBeforeRender = this.renderer.on("beforeRender", function() {
2562
+ if (shouldScroll)
2563
+ rect = self.renderer.container.getBoundingClientRect();
2564
+ });
2565
+ var onAfterRender = this.renderer.on("afterRender", function() {
2566
+ if (shouldScroll && rect && (self.isFocused()
2567
+ || self.searchBox && self.searchBox.isFocused())
2568
+ ) {
2569
+ var renderer = self.renderer;
2570
+ var pos = renderer.$cursorLayer.$pixelPos;
2571
+ var config = renderer.layerConfig;
2572
+ var top = pos.top - config.offset;
2573
+ if (pos.top >= 0 && top + rect.top < 0) {
2574
+ shouldScroll = true;
2575
+ } else if (pos.top < config.height &&
2576
+ pos.top + rect.top + config.lineHeight > window.innerHeight) {
2577
+ shouldScroll = false;
2578
+ } else {
2579
+ shouldScroll = null;
2580
+ }
2581
+ if (shouldScroll != null) {
2582
+ scrollAnchor.style.top = top + "px";
2583
+ scrollAnchor.style.left = pos.left + "px";
2584
+ scrollAnchor.style.height = config.lineHeight + "px";
2585
+ scrollAnchor.scrollIntoView(shouldScroll);
2586
+ }
2587
+ shouldScroll = rect = null;
2588
+ }
2589
+ });
2590
+ this.setAutoScrollEditorIntoView = function(enable) {
2591
+ if (enable)
2592
+ return;
2593
+ delete this.setAutoScrollEditorIntoView;
2594
+ this.removeEventListener("changeSelection", onChangeSelection);
2595
+ this.renderer.removeEventListener("afterRender", onAfterRender);
2596
+ this.renderer.removeEventListener("beforeRender", onBeforeRender);
2597
+ };
2598
+ };
2599
+
2600
+
2601
+ this.$resetCursorStyle = function() {
2602
+ var style = this.$cursorStyle || "ace";
2603
+ var cursorLayer = this.renderer.$cursorLayer;
2604
+ if (!cursorLayer)
2605
+ return;
2606
+ cursorLayer.setSmoothBlinking(/smooth/.test(style));
2607
+ cursorLayer.isBlinking = !this.$readOnly && style != "wide";
2608
+ dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
2146
2609
  };
2147
2610
 
2148
2611
  }).call(Editor.prototype);
2149
2612
 
2150
2613
 
2614
+
2615
+ config.defineOptions(Editor.prototype, "editor", {
2616
+ selectionStyle: {
2617
+ set: function(style) {
2618
+ this.onSelectionChange();
2619
+ this._signal("changeSelectionStyle", {data: style});
2620
+ },
2621
+ initialValue: "line"
2622
+ },
2623
+ highlightActiveLine: {
2624
+ set: function() {this.$updateHighlightActiveLine();},
2625
+ initialValue: true
2626
+ },
2627
+ highlightSelectedWord: {
2628
+ set: function(shouldHighlight) {this.$onSelectionChange();},
2629
+ initialValue: true
2630
+ },
2631
+ readOnly: {
2632
+ set: function(readOnly) {
2633
+ // disabled to not break vim mode!
2634
+ // this.textInput.setReadOnly(readOnly);
2635
+ this.$resetCursorStyle();
2636
+ },
2637
+ initialValue: false
2638
+ },
2639
+ cursorStyle: {
2640
+ set: function(val) { this.$resetCursorStyle(); },
2641
+ values: ["ace", "slim", "smooth", "wide"],
2642
+ initialValue: "ace"
2643
+ },
2644
+ mergeUndoDeltas: {
2645
+ values: [false, true, "always"],
2646
+ initialValue: true
2647
+ },
2648
+ behavioursEnabled: {initialValue: true},
2649
+ wrapBehavioursEnabled: {initialValue: true},
2650
+ autoScrollEditorIntoView: {
2651
+ set: function(val) {this.setAutoScrollEditorIntoView(val)}
2652
+ },
2653
+
2654
+ hScrollBarAlwaysVisible: "renderer",
2655
+ vScrollBarAlwaysVisible: "renderer",
2656
+ highlightGutterLine: "renderer",
2657
+ animatedScroll: "renderer",
2658
+ showInvisibles: "renderer",
2659
+ showPrintMargin: "renderer",
2660
+ printMarginColumn: "renderer",
2661
+ printMargin: "renderer",
2662
+ fadeFoldWidgets: "renderer",
2663
+ showFoldWidgets: "renderer",
2664
+ showLineNumbers: "renderer",
2665
+ showGutter: "renderer",
2666
+ displayIndentGuides: "renderer",
2667
+ fontSize: "renderer",
2668
+ fontFamily: "renderer",
2669
+ maxLines: "renderer",
2670
+ minLines: "renderer",
2671
+ scrollPastEnd: "renderer",
2672
+ fixedWidthGutter: "renderer",
2673
+ theme: "renderer",
2674
+
2675
+ scrollSpeed: "$mouseHandler",
2676
+ dragDelay: "$mouseHandler",
2677
+ dragEnabled: "$mouseHandler",
2678
+ focusTimout: "$mouseHandler",
2679
+ tooltipFollowsMouse: "$mouseHandler",
2680
+
2681
+ firstLineNumber: "session",
2682
+ overwrite: "session",
2683
+ newLineMode: "session",
2684
+ useWorker: "session",
2685
+ useSoftTabs: "session",
2686
+ tabSize: "session",
2687
+ wrap: "session",
2688
+ foldStyle: "session",
2689
+ mode: "session"
2690
+ });
2691
+
2151
2692
  exports.Editor = Editor;
2152
- });
2693
+ });