pollypost 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1132) hide show
  1. data/.gitignore +15 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +674 -0
  4. data/README.md +165 -0
  5. data/Rakefile +9 -0
  6. data/assets/fonts/font-awesome-custom/fontawesome-custom.eot +0 -0
  7. data/assets/fonts/font-awesome-custom/fontawesome-custom.svg +15 -0
  8. data/assets/fonts/font-awesome-custom/fontawesome-custom.ttf +0 -0
  9. data/assets/fonts/font-awesome-custom/fontawesome-custom.woff +0 -0
  10. data/assets/javascripts/app.js +35 -0
  11. data/assets/javascripts/application.js +8 -0
  12. data/assets/javascripts/dom-tweaking.js +36 -0
  13. data/assets/javascripts/main.js +36 -0
  14. data/assets/javascripts/models/page_content.js +39 -0
  15. data/assets/javascripts/templates/bar_edit_mode.html +14 -0
  16. data/assets/javascripts/templates/bar_view_mode.html +13 -0
  17. data/assets/javascripts/templates/duplicate_page.html +20 -0
  18. data/assets/javascripts/templates/html_editor.html +18 -0
  19. data/assets/javascripts/templates/loading.html +9 -0
  20. data/assets/javascripts/templates/new_page.html +23 -0
  21. data/assets/javascripts/templates/settings.html +15 -0
  22. data/assets/javascripts/views/bar_edit_mode.js +117 -0
  23. data/assets/javascripts/views/bar_view_mode.js +40 -0
  24. data/assets/javascripts/views/duplicate_page.js +76 -0
  25. data/assets/javascripts/views/editier_bar.js +171 -0
  26. data/assets/javascripts/views/html_editor.js +116 -0
  27. data/assets/javascripts/views/loading.js +31 -0
  28. data/assets/javascripts/views/new_page.js +77 -0
  29. data/assets/javascripts/views/page_content.js +26 -0
  30. data/assets/javascripts/views/settings.js +89 -0
  31. data/assets/stylesheets/_bootstrap-custom.scss +50 -0
  32. data/assets/stylesheets/_editor.scss +303 -0
  33. data/assets/stylesheets/_font-awesome-custom.scss +17 -0
  34. data/assets/stylesheets/_variable-overrides.scss +13 -0
  35. data/assets/stylesheets/application.scss +41 -0
  36. data/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  37. data/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
  38. data/assets/stylesheets/font-awesome/_core.scss +12 -0
  39. data/assets/stylesheets/font-awesome/_mixins.scss +26 -0
  40. data/assets/stylesheets/font-awesome/_path.scss +14 -0
  41. data/lib/pollypost.rb +13 -0
  42. data/lib/pollypost/rake.rb +55 -0
  43. data/lib/pollypost/version.rb +11 -0
  44. data/pollypost.gemspec +27 -0
  45. data/test/README.md +55 -0
  46. data/test/basic.html +19 -0
  47. data/test/page_content_test.js +69 -0
  48. data/test/qunit-1.17.1.css +280 -0
  49. data/test/qunit-1.17.1.js +2875 -0
  50. data/test/sinon-1.14.1.js +5931 -0
  51. data/test/sinon-qunit-1.0.0.js +62 -0
  52. data/test/test.html +16 -0
  53. data/test/testmain.js +28 -0
  54. data/test/tests.js +58 -0
  55. data/vendor/assets/ace-1.1.8/ace.js +129 -0
  56. data/vendor/assets/ace-1.1.8/anchor.js +245 -0
  57. data/vendor/assets/ace-1.1.8/anchor_test.js +223 -0
  58. data/vendor/assets/ace-1.1.8/autocomplete.js +485 -0
  59. data/vendor/assets/ace-1.1.8/autocomplete/popup.js +338 -0
  60. data/vendor/assets/ace-1.1.8/autocomplete/text_completer.js +78 -0
  61. data/vendor/assets/ace-1.1.8/autocomplete/util.js +74 -0
  62. data/vendor/assets/ace-1.1.8/background_tokenizer.js +250 -0
  63. data/vendor/assets/ace-1.1.8/background_tokenizer_test.js +85 -0
  64. data/vendor/assets/ace-1.1.8/commands/command_manager.js +118 -0
  65. data/vendor/assets/ace-1.1.8/commands/command_manager_test.js +199 -0
  66. data/vendor/assets/ace-1.1.8/commands/default_commands.js +708 -0
  67. data/vendor/assets/ace-1.1.8/commands/incremental_search_commands.js +232 -0
  68. data/vendor/assets/ace-1.1.8/commands/multi_select_commands.js +102 -0
  69. data/vendor/assets/ace-1.1.8/commands/occur_commands.js +110 -0
  70. data/vendor/assets/ace-1.1.8/config.js +301 -0
  71. data/vendor/assets/ace-1.1.8/config_test.js +128 -0
  72. data/vendor/assets/ace-1.1.8/css/codefolding-fold-button-states.png +0 -0
  73. data/vendor/assets/ace-1.1.8/css/editor.css +422 -0
  74. data/vendor/assets/ace-1.1.8/css/expand-marker.png +0 -0
  75. data/vendor/assets/ace-1.1.8/document.js +645 -0
  76. data/vendor/assets/ace-1.1.8/document_test.js +306 -0
  77. data/vendor/assets/ace-1.1.8/edit_session.js +2554 -0
  78. data/vendor/assets/ace-1.1.8/edit_session/bracket_match.js +221 -0
  79. data/vendor/assets/ace-1.1.8/edit_session/fold.js +140 -0
  80. data/vendor/assets/ace-1.1.8/edit_session/fold_line.js +269 -0
  81. data/vendor/assets/ace-1.1.8/edit_session/folding.js +851 -0
  82. data/vendor/assets/ace-1.1.8/edit_session_test.js +1075 -0
  83. data/vendor/assets/ace-1.1.8/editor.js +2658 -0
  84. data/vendor/assets/ace-1.1.8/editor_change_document_test.js +188 -0
  85. data/vendor/assets/ace-1.1.8/editor_highlight_selected_word_test.js +223 -0
  86. data/vendor/assets/ace-1.1.8/editor_navigation_test.js +164 -0
  87. data/vendor/assets/ace-1.1.8/editor_text_edit_test.js +557 -0
  88. data/vendor/assets/ace-1.1.8/ext/beautify.js +57 -0
  89. data/vendor/assets/ace-1.1.8/ext/beautify/php_rules.js +366 -0
  90. data/vendor/assets/ace-1.1.8/ext/chromevox.js +980 -0
  91. data/vendor/assets/ace-1.1.8/ext/elastic_tabstops_lite.js +319 -0
  92. data/vendor/assets/ace-1.1.8/ext/emmet.js +434 -0
  93. data/vendor/assets/ace-1.1.8/ext/error_marker.js +214 -0
  94. data/vendor/assets/ace-1.1.8/ext/keybinding_menu.js +86 -0
  95. data/vendor/assets/ace-1.1.8/ext/language_tools.js +229 -0
  96. data/vendor/assets/ace-1.1.8/ext/linking.js +78 -0
  97. data/vendor/assets/ace-1.1.8/ext/menu_tools/add_editor_menu_options.js +109 -0
  98. data/vendor/assets/ace-1.1.8/ext/menu_tools/element_generator.js +148 -0
  99. data/vendor/assets/ace-1.1.8/ext/menu_tools/generate_settings_menu.js +264 -0
  100. data/vendor/assets/ace-1.1.8/ext/menu_tools/get_editor_keyboard_shortcuts.js +91 -0
  101. data/vendor/assets/ace-1.1.8/ext/menu_tools/get_set_functions.js +141 -0
  102. data/vendor/assets/ace-1.1.8/ext/menu_tools/overlay_page.js +116 -0
  103. data/vendor/assets/ace-1.1.8/ext/menu_tools/settings_menu.css +48 -0
  104. data/vendor/assets/ace-1.1.8/ext/modelist.js +191 -0
  105. data/vendor/assets/ace-1.1.8/ext/old_ie.js +114 -0
  106. data/vendor/assets/ace-1.1.8/ext/old_ie_test.js +77 -0
  107. data/vendor/assets/ace-1.1.8/ext/searchbox.css +153 -0
  108. data/vendor/assets/ace-1.1.8/ext/searchbox.js +308 -0
  109. data/vendor/assets/ace-1.1.8/ext/settings_menu.js +76 -0
  110. data/vendor/assets/ace-1.1.8/ext/spellcheck.js +69 -0
  111. data/vendor/assets/ace-1.1.8/ext/split.js +40 -0
  112. data/vendor/assets/ace-1.1.8/ext/static.css +31 -0
  113. data/vendor/assets/ace-1.1.8/ext/static_highlight.js +190 -0
  114. data/vendor/assets/ace-1.1.8/ext/static_highlight_test.js +96 -0
  115. data/vendor/assets/ace-1.1.8/ext/statusbar.js +48 -0
  116. data/vendor/assets/ace-1.1.8/ext/textarea.js +521 -0
  117. data/vendor/assets/ace-1.1.8/ext/themelist.js +100 -0
  118. data/vendor/assets/ace-1.1.8/ext/whitespace.js +213 -0
  119. data/vendor/assets/ace-1.1.8/ext/whitespace_test.js +116 -0
  120. data/vendor/assets/ace-1.1.8/incremental_search.js +317 -0
  121. data/vendor/assets/ace-1.1.8/incremental_search_test.js +213 -0
  122. data/vendor/assets/ace-1.1.8/keyboard/emacs.js +652 -0
  123. data/vendor/assets/ace-1.1.8/keyboard/emacs_test.js +151 -0
  124. data/vendor/assets/ace-1.1.8/keyboard/hash_handler.js +231 -0
  125. data/vendor/assets/ace-1.1.8/keyboard/keybinding.js +145 -0
  126. data/vendor/assets/ace-1.1.8/keyboard/keybinding_test.js +69 -0
  127. data/vendor/assets/ace-1.1.8/keyboard/state_handler.js +249 -0
  128. data/vendor/assets/ace-1.1.8/keyboard/textarea.js +82 -0
  129. data/vendor/assets/ace-1.1.8/keyboard/textinput.js +495 -0
  130. data/vendor/assets/ace-1.1.8/keyboard/vim.js +199 -0
  131. data/vendor/assets/ace-1.1.8/keyboard/vim/commands.js +618 -0
  132. data/vendor/assets/ace-1.1.8/keyboard/vim/maps/aliases.js +94 -0
  133. data/vendor/assets/ace-1.1.8/keyboard/vim/maps/motions.js +681 -0
  134. data/vendor/assets/ace-1.1.8/keyboard/vim/maps/operators.js +201 -0
  135. data/vendor/assets/ace-1.1.8/keyboard/vim/maps/util.js +132 -0
  136. data/vendor/assets/ace-1.1.8/keyboard/vim/registers.js +42 -0
  137. data/vendor/assets/ace-1.1.8/keyboard/vim_test.js +528 -0
  138. data/vendor/assets/ace-1.1.8/layer/cursor.js +234 -0
  139. data/vendor/assets/ace-1.1.8/layer/font_metrics.js +176 -0
  140. data/vendor/assets/ace-1.1.8/layer/gutter.js +287 -0
  141. data/vendor/assets/ace-1.1.8/layer/marker.js +218 -0
  142. data/vendor/assets/ace-1.1.8/layer/text.js +575 -0
  143. data/vendor/assets/ace-1.1.8/layer/text_test.js +126 -0
  144. data/vendor/assets/ace-1.1.8/lib/dom.js +283 -0
  145. data/vendor/assets/ace-1.1.8/lib/es5-shim.js +1062 -0
  146. data/vendor/assets/ace-1.1.8/lib/event.js +381 -0
  147. data/vendor/assets/ace-1.1.8/lib/event_emitter.js +155 -0
  148. data/vendor/assets/ace-1.1.8/lib/event_emitter_test.js +65 -0
  149. data/vendor/assets/ace-1.1.8/lib/fixoldbrowsers.js +19 -0
  150. data/vendor/assets/ace-1.1.8/lib/keys.js +163 -0
  151. data/vendor/assets/ace-1.1.8/lib/lang.js +221 -0
  152. data/vendor/assets/ace-1.1.8/lib/net.js +51 -0
  153. data/vendor/assets/ace-1.1.8/lib/oop.js +57 -0
  154. data/vendor/assets/ace-1.1.8/lib/regexp.js +113 -0
  155. data/vendor/assets/ace-1.1.8/lib/useragent.js +106 -0
  156. data/vendor/assets/ace-1.1.8/line_widgets.js +297 -0
  157. data/vendor/assets/ace-1.1.8/mode/_test/Readme.md +9 -0
  158. data/vendor/assets/ace-1.1.8/mode/_test/highlight_rules_test.js +210 -0
  159. data/vendor/assets/ace-1.1.8/mode/_test/package.json +8 -0
  160. data/vendor/assets/ace-1.1.8/mode/_test/text_asciidoc.txt +111 -0
  161. data/vendor/assets/ace-1.1.8/mode/_test/text_coffee.txt +57 -0
  162. data/vendor/assets/ace-1.1.8/mode/_test/text_curly.txt +9 -0
  163. data/vendor/assets/ace-1.1.8/mode/_test/text_html.txt +10 -0
  164. data/vendor/assets/ace-1.1.8/mode/_test/text_javascript.txt +86 -0
  165. data/vendor/assets/ace-1.1.8/mode/_test/text_livescript.txt +1 -0
  166. data/vendor/assets/ace-1.1.8/mode/_test/text_lucene.txt +16 -0
  167. data/vendor/assets/ace-1.1.8/mode/_test/text_markdown.txt +22 -0
  168. data/vendor/assets/ace-1.1.8/mode/_test/text_php.txt +24 -0
  169. data/vendor/assets/ace-1.1.8/mode/_test/text_ruby.txt +34 -0
  170. data/vendor/assets/ace-1.1.8/mode/_test/text_xml.txt +7 -0
  171. data/vendor/assets/ace-1.1.8/mode/_test/tokens_abap.json +189 -0
  172. data/vendor/assets/ace-1.1.8/mode/_test/tokens_actionscript.json +263 -0
  173. data/vendor/assets/ace-1.1.8/mode/_test/tokens_ada.json +39 -0
  174. data/vendor/assets/ace-1.1.8/mode/_test/tokens_asciidoc.json +422 -0
  175. data/vendor/assets/ace-1.1.8/mode/_test/tokens_assembly_x86.json +114 -0
  176. data/vendor/assets/ace-1.1.8/mode/_test/tokens_autohotkey.json +261 -0
  177. data/vendor/assets/ace-1.1.8/mode/_test/tokens_batchfile.json +70 -0
  178. data/vendor/assets/ace-1.1.8/mode/_test/tokens_c9search.json +131 -0
  179. data/vendor/assets/ace-1.1.8/mode/_test/tokens_c_cpp.json +185 -0
  180. data/vendor/assets/ace-1.1.8/mode/_test/tokens_cirru.json +267 -0
  181. data/vendor/assets/ace-1.1.8/mode/_test/tokens_clojure.json +162 -0
  182. data/vendor/assets/ace-1.1.8/mode/_test/tokens_cobol.json +4 -0
  183. data/vendor/assets/ace-1.1.8/mode/_test/tokens_coffee.json +545 -0
  184. data/vendor/assets/ace-1.1.8/mode/_test/tokens_coldfusion.json +26 -0
  185. data/vendor/assets/ace-1.1.8/mode/_test/tokens_csharp.json +31 -0
  186. data/vendor/assets/ace-1.1.8/mode/_test/tokens_css.json +148 -0
  187. data/vendor/assets/ace-1.1.8/mode/_test/tokens_curly.json +56 -0
  188. data/vendor/assets/ace-1.1.8/mode/_test/tokens_d.json +111 -0
  189. data/vendor/assets/ace-1.1.8/mode/_test/tokens_dart.json +368 -0
  190. data/vendor/assets/ace-1.1.8/mode/_test/tokens_diff.json +262 -0
  191. data/vendor/assets/ace-1.1.8/mode/_test/tokens_dot.json +2254 -0
  192. data/vendor/assets/ace-1.1.8/mode/_test/tokens_eiffel.json +141 -0
  193. data/vendor/assets/ace-1.1.8/mode/_test/tokens_ejs.json +296 -0
  194. data/vendor/assets/ace-1.1.8/mode/_test/tokens_elixir.json +196 -0
  195. data/vendor/assets/ace-1.1.8/mode/_test/tokens_elm.json +198 -0
  196. data/vendor/assets/ace-1.1.8/mode/_test/tokens_erlang.json +166 -0
  197. data/vendor/assets/ace-1.1.8/mode/_test/tokens_forth.json +219 -0
  198. data/vendor/assets/ace-1.1.8/mode/_test/tokens_ftl.json +341 -0
  199. data/vendor/assets/ace-1.1.8/mode/_test/tokens_gcode.json +296 -0
  200. data/vendor/assets/ace-1.1.8/mode/_test/tokens_gherkin.json +142 -0
  201. data/vendor/assets/ace-1.1.8/mode/_test/tokens_gitignore.json +33 -0
  202. data/vendor/assets/ace-1.1.8/mode/_test/tokens_glsl.json +127 -0
  203. data/vendor/assets/ace-1.1.8/mode/_test/tokens_golang.json +256 -0
  204. data/vendor/assets/ace-1.1.8/mode/_test/tokens_groovy.json +410 -0
  205. data/vendor/assets/ace-1.1.8/mode/_test/tokens_haml.json +174 -0
  206. data/vendor/assets/ace-1.1.8/mode/_test/tokens_handlebars.json +81 -0
  207. data/vendor/assets/ace-1.1.8/mode/_test/tokens_haskell.json +156 -0
  208. data/vendor/assets/ace-1.1.8/mode/_test/tokens_haxe.json +143 -0
  209. data/vendor/assets/ace-1.1.8/mode/_test/tokens_html.json +63 -0
  210. data/vendor/assets/ace-1.1.8/mode/_test/tokens_html_ruby.json +257 -0
  211. data/vendor/assets/ace-1.1.8/mode/_test/tokens_ini.json +23 -0
  212. data/vendor/assets/ace-1.1.8/mode/_test/tokens_io.json +49 -0
  213. data/vendor/assets/ace-1.1.8/mode/_test/tokens_jack.json +1786 -0
  214. data/vendor/assets/ace-1.1.8/mode/_test/tokens_jade.json +188 -0
  215. data/vendor/assets/ace-1.1.8/mode/_test/tokens_java.json +95 -0
  216. data/vendor/assets/ace-1.1.8/mode/_test/tokens_javascript.json +593 -0
  217. data/vendor/assets/ace-1.1.8/mode/_test/tokens_json.json +412 -0
  218. data/vendor/assets/ace-1.1.8/mode/_test/tokens_jsoniq.json +4 -0
  219. data/vendor/assets/ace-1.1.8/mode/_test/tokens_jsp.json +435 -0
  220. data/vendor/assets/ace-1.1.8/mode/_test/tokens_jsx.json +51 -0
  221. data/vendor/assets/ace-1.1.8/mode/_test/tokens_julia.json +111 -0
  222. data/vendor/assets/ace-1.1.8/mode/_test/tokens_latex.json +127 -0
  223. data/vendor/assets/ace-1.1.8/mode/_test/tokens_less.json +204 -0
  224. data/vendor/assets/ace-1.1.8/mode/_test/tokens_liquid.json +551 -0
  225. data/vendor/assets/ace-1.1.8/mode/_test/tokens_lisp.json +248 -0
  226. data/vendor/assets/ace-1.1.8/mode/_test/tokens_livescript.json +6 -0
  227. data/vendor/assets/ace-1.1.8/mode/_test/tokens_logiql.json +190 -0
  228. data/vendor/assets/ace-1.1.8/mode/_test/tokens_lsl.json +503 -0
  229. data/vendor/assets/ace-1.1.8/mode/_test/tokens_lua.json +348 -0
  230. data/vendor/assets/ace-1.1.8/mode/_test/tokens_luapage.json +633 -0
  231. data/vendor/assets/ace-1.1.8/mode/_test/tokens_lucene.json +92 -0
  232. data/vendor/assets/ace-1.1.8/mode/_test/tokens_markdown.json +114 -0
  233. data/vendor/assets/ace-1.1.8/mode/_test/tokens_matlab.json +90 -0
  234. data/vendor/assets/ace-1.1.8/mode/_test/tokens_mel.json +257 -0
  235. data/vendor/assets/ace-1.1.8/mode/_test/tokens_mushcode.json +790 -0
  236. data/vendor/assets/ace-1.1.8/mode/_test/tokens_mysql.json +4 -0
  237. data/vendor/assets/ace-1.1.8/mode/_test/tokens_nix.json +360 -0
  238. data/vendor/assets/ace-1.1.8/mode/_test/tokens_objectivec.json +792 -0
  239. data/vendor/assets/ace-1.1.8/mode/_test/tokens_ocaml.json +200 -0
  240. data/vendor/assets/ace-1.1.8/mode/_test/tokens_pascal.json +297 -0
  241. data/vendor/assets/ace-1.1.8/mode/_test/tokens_perl.json +227 -0
  242. data/vendor/assets/ace-1.1.8/mode/_test/tokens_pgsql.json +889 -0
  243. data/vendor/assets/ace-1.1.8/mode/_test/tokens_php.json +171 -0
  244. data/vendor/assets/ace-1.1.8/mode/_test/tokens_powershell.json +184 -0
  245. data/vendor/assets/ace-1.1.8/mode/_test/tokens_prolog.json +245 -0
  246. data/vendor/assets/ace-1.1.8/mode/_test/tokens_properties.json +68 -0
  247. data/vendor/assets/ace-1.1.8/mode/_test/tokens_protobuf.json +136 -0
  248. data/vendor/assets/ace-1.1.8/mode/_test/tokens_python.json +152 -0
  249. data/vendor/assets/ace-1.1.8/mode/_test/tokens_r.json +235 -0
  250. data/vendor/assets/ace-1.1.8/mode/_test/tokens_rdoc.json +441 -0
  251. data/vendor/assets/ace-1.1.8/mode/_test/tokens_rhtml.json +106 -0
  252. data/vendor/assets/ace-1.1.8/mode/_test/tokens_ruby.json +234 -0
  253. data/vendor/assets/ace-1.1.8/mode/_test/tokens_rust.json +136 -0
  254. data/vendor/assets/ace-1.1.8/mode/_test/tokens_sass.json +229 -0
  255. data/vendor/assets/ace-1.1.8/mode/_test/tokens_scad.json +194 -0
  256. data/vendor/assets/ace-1.1.8/mode/_test/tokens_scala.json +542 -0
  257. data/vendor/assets/ace-1.1.8/mode/_test/tokens_scheme.json +216 -0
  258. data/vendor/assets/ace-1.1.8/mode/_test/tokens_scss.json +123 -0
  259. data/vendor/assets/ace-1.1.8/mode/_test/tokens_sh.json +334 -0
  260. data/vendor/assets/ace-1.1.8/mode/_test/tokens_sjs.json +276 -0
  261. data/vendor/assets/ace-1.1.8/mode/_test/tokens_smarty.json +98 -0
  262. data/vendor/assets/ace-1.1.8/mode/_test/tokens_snippets.json +159 -0
  263. data/vendor/assets/ace-1.1.8/mode/_test/tokens_soy_template.json +286 -0
  264. data/vendor/assets/ace-1.1.8/mode/_test/tokens_space.json +322 -0
  265. data/vendor/assets/ace-1.1.8/mode/_test/tokens_sql.json +54 -0
  266. data/vendor/assets/ace-1.1.8/mode/_test/tokens_stylus.json +271 -0
  267. data/vendor/assets/ace-1.1.8/mode/_test/tokens_svg.json +684 -0
  268. data/vendor/assets/ace-1.1.8/mode/_test/tokens_tcl.json +385 -0
  269. data/vendor/assets/ace-1.1.8/mode/_test/tokens_tex.json +130 -0
  270. data/vendor/assets/ace-1.1.8/mode/_test/tokens_text.json +29 -0
  271. data/vendor/assets/ace-1.1.8/mode/_test/tokens_textile.json +113 -0
  272. data/vendor/assets/ace-1.1.8/mode/_test/tokens_toml.json +131 -0
  273. data/vendor/assets/ace-1.1.8/mode/_test/tokens_twig.json +288 -0
  274. data/vendor/assets/ace-1.1.8/mode/_test/tokens_typescript.json +559 -0
  275. data/vendor/assets/ace-1.1.8/mode/_test/tokens_vala.json +158 -0
  276. data/vendor/assets/ace-1.1.8/mode/_test/tokens_vbscript.json +205 -0
  277. data/vendor/assets/ace-1.1.8/mode/_test/tokens_velocity.json +285 -0
  278. data/vendor/assets/ace-1.1.8/mode/_test/tokens_verilog.json +113 -0
  279. data/vendor/assets/ace-1.1.8/mode/_test/tokens_vhdl.json +271 -0
  280. data/vendor/assets/ace-1.1.8/mode/_test/tokens_xml.json +43 -0
  281. data/vendor/assets/ace-1.1.8/mode/_test/tokens_xquery.json +44 -0
  282. data/vendor/assets/ace-1.1.8/mode/_test/tokens_yaml.json +150 -0
  283. data/vendor/assets/ace-1.1.8/mode/abap.js +77 -0
  284. data/vendor/assets/ace-1.1.8/mode/abap_highlight_rules.js +134 -0
  285. data/vendor/assets/ace-1.1.8/mode/actionscript.js +58 -0
  286. data/vendor/assets/ace-1.1.8/mode/actionscript_highlight_rules.js +141 -0
  287. data/vendor/assets/ace-1.1.8/mode/ada.js +54 -0
  288. data/vendor/assets/ace-1.1.8/mode/ada_highlight_rules.js +93 -0
  289. data/vendor/assets/ace-1.1.8/mode/apache_conf.js +62 -0
  290. data/vendor/assets/ace-1.1.8/mode/apache_conf_highlight_rules.js +231 -0
  291. data/vendor/assets/ace-1.1.8/mode/applescript.js +55 -0
  292. data/vendor/assets/ace-1.1.8/mode/applescript_highlight_rules.js +139 -0
  293. data/vendor/assets/ace-1.1.8/mode/asciidoc.js +64 -0
  294. data/vendor/assets/ace-1.1.8/mode/asciidoc_highlight_rules.js +234 -0
  295. data/vendor/assets/ace-1.1.8/mode/assembly_x86.js +56 -0
  296. data/vendor/assets/ace-1.1.8/mode/assembly_x86_highlight_rules.js +114 -0
  297. data/vendor/assets/ace-1.1.8/mode/autohotkey.js +57 -0
  298. data/vendor/assets/ace-1.1.8/mode/autohotkey_highlight_rules.js +107 -0
  299. data/vendor/assets/ace-1.1.8/mode/batchfile.js +61 -0
  300. data/vendor/assets/ace-1.1.8/mode/batchfile_highlight_rules.js +97 -0
  301. data/vendor/assets/ace-1.1.8/mode/behaviour.js +90 -0
  302. data/vendor/assets/ace-1.1.8/mode/behaviour/behaviour_test.js +133 -0
  303. data/vendor/assets/ace-1.1.8/mode/behaviour/css.js +108 -0
  304. data/vendor/assets/ace-1.1.8/mode/behaviour/cstyle.js +400 -0
  305. data/vendor/assets/ace-1.1.8/mode/behaviour/html.js +46 -0
  306. data/vendor/assets/ace-1.1.8/mode/behaviour/xml.js +202 -0
  307. data/vendor/assets/ace-1.1.8/mode/behaviour/xquery.js +92 -0
  308. data/vendor/assets/ace-1.1.8/mode/c9search.js +67 -0
  309. data/vendor/assets/ace-1.1.8/mode/c9search_highlight_rules.js +182 -0
  310. data/vendor/assets/ace-1.1.8/mode/c_cpp.js +101 -0
  311. data/vendor/assets/ace-1.1.8/mode/c_cpp_highlight_rules.js +196 -0
  312. data/vendor/assets/ace-1.1.8/mode/cirru.js +51 -0
  313. data/vendor/assets/ace-1.1.8/mode/cirru_highlight_rules.js +125 -0
  314. data/vendor/assets/ace-1.1.8/mode/clojure.js +128 -0
  315. data/vendor/assets/ace-1.1.8/mode/clojure_highlight_rules.js +200 -0
  316. data/vendor/assets/ace-1.1.8/mode/cobol.js +53 -0
  317. data/vendor/assets/ace-1.1.8/mode/cobol_highlight_rules.js +100 -0
  318. data/vendor/assets/ace-1.1.8/mode/coffee.js +135 -0
  319. data/vendor/assets/ace-1.1.8/mode/coffee/coffee-script.js +62 -0
  320. data/vendor/assets/ace-1.1.8/mode/coffee/helpers.js +271 -0
  321. data/vendor/assets/ace-1.1.8/mode/coffee/lexer.js +935 -0
  322. data/vendor/assets/ace-1.1.8/mode/coffee/nodes.js +3106 -0
  323. data/vendor/assets/ace-1.1.8/mode/coffee/parser.js +724 -0
  324. data/vendor/assets/ace-1.1.8/mode/coffee/parser_test.js +88 -0
  325. data/vendor/assets/ace-1.1.8/mode/coffee/rewriter.js +516 -0
  326. data/vendor/assets/ace-1.1.8/mode/coffee/scope.js +174 -0
  327. data/vendor/assets/ace-1.1.8/mode/coffee_highlight_rules.js +233 -0
  328. data/vendor/assets/ace-1.1.8/mode/coffee_worker.js +74 -0
  329. data/vendor/assets/ace-1.1.8/mode/coldfusion.js +61 -0
  330. data/vendor/assets/ace-1.1.8/mode/coldfusion_highlight_rules.js +49 -0
  331. data/vendor/assets/ace-1.1.8/mode/coldfusion_test.js +67 -0
  332. data/vendor/assets/ace-1.1.8/mode/csharp.js +61 -0
  333. data/vendor/assets/ace-1.1.8/mode/csharp_highlight_rules.js +93 -0
  334. data/vendor/assets/ace-1.1.8/mode/css.js +100 -0
  335. data/vendor/assets/ace-1.1.8/mode/css/csslint.js +9628 -0
  336. data/vendor/assets/ace-1.1.8/mode/css_highlight_rules.js +179 -0
  337. data/vendor/assets/ace-1.1.8/mode/css_test.js +78 -0
  338. data/vendor/assets/ace-1.1.8/mode/css_worker.js +100 -0
  339. data/vendor/assets/ace-1.1.8/mode/css_worker_test.js +68 -0
  340. data/vendor/assets/ace-1.1.8/mode/curly.js +63 -0
  341. data/vendor/assets/ace-1.1.8/mode/curly_highlight_rules.js +66 -0
  342. data/vendor/assets/ace-1.1.8/mode/d.js +56 -0
  343. data/vendor/assets/ace-1.1.8/mode/d_highlight_rules.js +334 -0
  344. data/vendor/assets/ace-1.1.8/mode/dart.js +62 -0
  345. data/vendor/assets/ace-1.1.8/mode/dart_highlight_rules.js +186 -0
  346. data/vendor/assets/ace-1.1.8/mode/diff.js +52 -0
  347. data/vendor/assets/ace-1.1.8/mode/diff_highlight_rules.js +108 -0
  348. data/vendor/assets/ace-1.1.8/mode/django.js +119 -0
  349. data/vendor/assets/ace-1.1.8/mode/doc_comment_highlight_rules.js +79 -0
  350. data/vendor/assets/ace-1.1.8/mode/dockerfile.js +52 -0
  351. data/vendor/assets/ace-1.1.8/mode/dockerfile_highlight_rules.js +57 -0
  352. data/vendor/assets/ace-1.1.8/mode/dot.js +55 -0
  353. data/vendor/assets/ace-1.1.8/mode/dot_highlight_rules.js +126 -0
  354. data/vendor/assets/ace-1.1.8/mode/eiffel.js +52 -0
  355. data/vendor/assets/ace-1.1.8/mode/eiffel_highlight_rules.js +143 -0
  356. data/vendor/assets/ace-1.1.8/mode/ejs.js +109 -0
  357. data/vendor/assets/ace-1.1.8/mode/elixir.js +58 -0
  358. data/vendor/assets/ace-1.1.8/mode/elixir_highlight_rules.js +433 -0
  359. data/vendor/assets/ace-1.1.8/mode/elm.js +58 -0
  360. data/vendor/assets/ace-1.1.8/mode/elm_highlight_rules.js +162 -0
  361. data/vendor/assets/ace-1.1.8/mode/erlang.js +57 -0
  362. data/vendor/assets/ace-1.1.8/mode/erlang_highlight_rules.js +876 -0
  363. data/vendor/assets/ace-1.1.8/mode/folding/asciidoc.js +142 -0
  364. data/vendor/assets/ace-1.1.8/mode/folding/c9search.js +83 -0
  365. data/vendor/assets/ace-1.1.8/mode/folding/coffee.js +120 -0
  366. data/vendor/assets/ace-1.1.8/mode/folding/coffee_test.js +101 -0
  367. data/vendor/assets/ace-1.1.8/mode/folding/csharp.js +138 -0
  368. data/vendor/assets/ace-1.1.8/mode/folding/cstyle.js +124 -0
  369. data/vendor/assets/ace-1.1.8/mode/folding/cstyle_test.js +109 -0
  370. data/vendor/assets/ace-1.1.8/mode/folding/diff.js +69 -0
  371. data/vendor/assets/ace-1.1.8/mode/folding/fold_mode.js +120 -0
  372. data/vendor/assets/ace-1.1.8/mode/folding/html.js +48 -0
  373. data/vendor/assets/ace-1.1.8/mode/folding/html_test.js +162 -0
  374. data/vendor/assets/ace-1.1.8/mode/folding/ini.js +80 -0
  375. data/vendor/assets/ace-1.1.8/mode/folding/latex.js +162 -0
  376. data/vendor/assets/ace-1.1.8/mode/folding/lua.js +163 -0
  377. data/vendor/assets/ace-1.1.8/mode/folding/markdown.js +125 -0
  378. data/vendor/assets/ace-1.1.8/mode/folding/mixed.js +83 -0
  379. data/vendor/assets/ace-1.1.8/mode/folding/pythonic.js +58 -0
  380. data/vendor/assets/ace-1.1.8/mode/folding/pythonic_test.js +98 -0
  381. data/vendor/assets/ace-1.1.8/mode/folding/velocity.js +120 -0
  382. data/vendor/assets/ace-1.1.8/mode/folding/xml.js +277 -0
  383. data/vendor/assets/ace-1.1.8/mode/folding/xml_test.js +110 -0
  384. data/vendor/assets/ace-1.1.8/mode/forth.js +58 -0
  385. data/vendor/assets/ace-1.1.8/mode/forth_highlight_rules.js +164 -0
  386. data/vendor/assets/ace-1.1.8/mode/ftl.js +49 -0
  387. data/vendor/assets/ace-1.1.8/mode/ftl_highlight_rules.js +195 -0
  388. data/vendor/assets/ace-1.1.8/mode/gcode.js +51 -0
  389. data/vendor/assets/ace-1.1.8/mode/gcode_highlight_rules.js +94 -0
  390. data/vendor/assets/ace-1.1.8/mode/gherkin.js +80 -0
  391. data/vendor/assets/ace-1.1.8/mode/gherkin_highlight_rules.js +113 -0
  392. data/vendor/assets/ace-1.1.8/mode/gitignore.js +20 -0
  393. data/vendor/assets/ace-1.1.8/mode/gitignore_highlight_rules.js +31 -0
  394. data/vendor/assets/ace-1.1.8/mode/glsl.js +56 -0
  395. data/vendor/assets/ace-1.1.8/mode/glsl_highlight_rules.js +81 -0
  396. data/vendor/assets/ace-1.1.8/mode/golang.js +55 -0
  397. data/vendor/assets/ace-1.1.8/mode/golang_highlight_rules.js +108 -0
  398. data/vendor/assets/ace-1.1.8/mode/groovy.js +24 -0
  399. data/vendor/assets/ace-1.1.8/mode/groovy_highlight_rules.js +173 -0
  400. data/vendor/assets/ace-1.1.8/mode/haml.js +61 -0
  401. data/vendor/assets/ace-1.1.8/mode/haml_highlight_rules.js +132 -0
  402. data/vendor/assets/ace-1.1.8/mode/handlebars.js +29 -0
  403. data/vendor/assets/ace-1.1.8/mode/handlebars_highlight_rules.js +72 -0
  404. data/vendor/assets/ace-1.1.8/mode/haskell.js +62 -0
  405. data/vendor/assets/ace-1.1.8/mode/haskell_highlight_rules.js +246 -0
  406. data/vendor/assets/ace-1.1.8/mode/haxe.js +56 -0
  407. data/vendor/assets/ace-1.1.8/mode/haxe_highlight_rules.js +98 -0
  408. data/vendor/assets/ace-1.1.8/mode/html.js +106 -0
  409. data/vendor/assets/ace-1.1.8/mode/html/saxparser.js +10430 -0
  410. data/vendor/assets/ace-1.1.8/mode/html_completions.js +305 -0
  411. data/vendor/assets/ace-1.1.8/mode/html_highlight_rules.js +111 -0
  412. data/vendor/assets/ace-1.1.8/mode/html_ruby.js +59 -0
  413. data/vendor/assets/ace-1.1.8/mode/html_ruby_highlight_rules.js +84 -0
  414. data/vendor/assets/ace-1.1.8/mode/html_test.js +67 -0
  415. data/vendor/assets/ace-1.1.8/mode/html_worker.js +92 -0
  416. data/vendor/assets/ace-1.1.8/mode/ini.js +53 -0
  417. data/vendor/assets/ace-1.1.8/mode/ini_highlight_rules.js +112 -0
  418. data/vendor/assets/ace-1.1.8/mode/io.js +58 -0
  419. data/vendor/assets/ace-1.1.8/mode/io_highlight_rules.js +120 -0
  420. data/vendor/assets/ace-1.1.8/mode/jack.js +79 -0
  421. data/vendor/assets/ace-1.1.8/mode/jack_highlight_rules.js +142 -0
  422. data/vendor/assets/ace-1.1.8/mode/jade.js +57 -0
  423. data/vendor/assets/ace-1.1.8/mode/jade_highlight_rules.js +341 -0
  424. data/vendor/assets/ace-1.1.8/mode/java.js +24 -0
  425. data/vendor/assets/ace-1.1.8/mode/java_highlight_rules.js +128 -0
  426. data/vendor/assets/ace-1.1.8/mode/javascript.js +116 -0
  427. data/vendor/assets/ace-1.1.8/mode/javascript/jshint.js +9459 -0
  428. data/vendor/assets/ace-1.1.8/mode/javascript_highlight_rules.js +405 -0
  429. data/vendor/assets/ace-1.1.8/mode/javascript_test.js +213 -0
  430. data/vendor/assets/ace-1.1.8/mode/javascript_worker.js +187 -0
  431. data/vendor/assets/ace-1.1.8/mode/javascript_worker_test.js +106 -0
  432. data/vendor/assets/ace-1.1.8/mode/js_regex_highlight_rules.js +94 -0
  433. data/vendor/assets/ace-1.1.8/mode/json.js +93 -0
  434. data/vendor/assets/ace-1.1.8/mode/json/json_parse.js +346 -0
  435. data/vendor/assets/ace-1.1.8/mode/json_highlight_rules.js +100 -0
  436. data/vendor/assets/ace-1.1.8/mode/json_worker.js +68 -0
  437. data/vendor/assets/ace-1.1.8/mode/json_worker_test.js +101 -0
  438. data/vendor/assets/ace-1.1.8/mode/jsoniq.js +203 -0
  439. data/vendor/assets/ace-1.1.8/mode/jsp.js +55 -0
  440. data/vendor/assets/ace-1.1.8/mode/jsp_highlight_rules.js +91 -0
  441. data/vendor/assets/ace-1.1.8/mode/jsx.js +56 -0
  442. data/vendor/assets/ace-1.1.8/mode/jsx_highlight_rules.js +120 -0
  443. data/vendor/assets/ace-1.1.8/mode/julia.js +62 -0
  444. data/vendor/assets/ace-1.1.8/mode/julia_highlight_rules.js +170 -0
  445. data/vendor/assets/ace-1.1.8/mode/latex.js +26 -0
  446. data/vendor/assets/ace-1.1.8/mode/latex_highlight_rules.js +73 -0
  447. data/vendor/assets/ace-1.1.8/mode/less.js +84 -0
  448. data/vendor/assets/ace-1.1.8/mode/less_highlight_rules.js +271 -0
  449. data/vendor/assets/ace-1.1.8/mode/liquid.js +82 -0
  450. data/vendor/assets/ace-1.1.8/mode/liquid_highlight_rules.js +131 -0
  451. data/vendor/assets/ace-1.1.8/mode/lisp.js +56 -0
  452. data/vendor/assets/ace-1.1.8/mode/lisp_highlight_rules.js +124 -0
  453. data/vendor/assets/ace-1.1.8/mode/livescript.js +249 -0
  454. data/vendor/assets/ace-1.1.8/mode/logiql.js +139 -0
  455. data/vendor/assets/ace-1.1.8/mode/logiql_highlight_rules.js +119 -0
  456. data/vendor/assets/ace-1.1.8/mode/logiql_test.js +98 -0
  457. data/vendor/assets/ace-1.1.8/mode/lsl.js +92 -0
  458. data/vendor/assets/ace-1.1.8/mode/lsl_highlight_rules.js +123 -0
  459. data/vendor/assets/ace-1.1.8/mode/lua.js +168 -0
  460. data/vendor/assets/ace-1.1.8/mode/lua/luaparse.js +1989 -0
  461. data/vendor/assets/ace-1.1.8/mode/lua_highlight_rules.js +193 -0
  462. data/vendor/assets/ace-1.1.8/mode/lua_worker.js +71 -0
  463. data/vendor/assets/ace-1.1.8/mode/luapage.js +24 -0
  464. data/vendor/assets/ace-1.1.8/mode/luapage_highlight_rules.js +49 -0
  465. data/vendor/assets/ace-1.1.8/mode/lucene.js +19 -0
  466. data/vendor/assets/ace-1.1.8/mode/lucene_highlight_rules.js +49 -0
  467. data/vendor/assets/ace-1.1.8/mode/makefile.js +58 -0
  468. data/vendor/assets/ace-1.1.8/mode/makefile_highlight_rules.js +75 -0
  469. data/vendor/assets/ace-1.1.8/mode/markdown.js +76 -0
  470. data/vendor/assets/ace-1.1.8/mode/markdown_highlight_rules.js +228 -0
  471. data/vendor/assets/ace-1.1.8/mode/matching_brace_outdent.js +69 -0
  472. data/vendor/assets/ace-1.1.8/mode/matching_parens_outdent.js +74 -0
  473. data/vendor/assets/ace-1.1.8/mode/matlab.js +55 -0
  474. data/vendor/assets/ace-1.1.8/mode/matlab_highlight_rules.js +262 -0
  475. data/vendor/assets/ace-1.1.8/mode/mel.js +56 -0
  476. data/vendor/assets/ace-1.1.8/mode/mel_highlight_rules.js +133 -0
  477. data/vendor/assets/ace-1.1.8/mode/mushcode.js +116 -0
  478. data/vendor/assets/ace-1.1.8/mode/mushcode_highlight_rules.js +569 -0
  479. data/vendor/assets/ace-1.1.8/mode/mysql.js +51 -0
  480. data/vendor/assets/ace-1.1.8/mode/mysql_highlight_rules.js +122 -0
  481. data/vendor/assets/ace-1.1.8/mode/nix.js +62 -0
  482. data/vendor/assets/ace-1.1.8/mode/nix_highlight_rules.js +119 -0
  483. data/vendor/assets/ace-1.1.8/mode/objectivec.js +61 -0
  484. data/vendor/assets/ace-1.1.8/mode/objectivec_highlight_rules.js +331 -0
  485. data/vendor/assets/ace-1.1.8/mode/ocaml.js +97 -0
  486. data/vendor/assets/ace-1.1.8/mode/ocaml_highlight_rules.js +337 -0
  487. data/vendor/assets/ace-1.1.8/mode/pascal.js +67 -0
  488. data/vendor/assets/ace-1.1.8/mode/pascal_highlight_rules.js +127 -0
  489. data/vendor/assets/ace-1.1.8/mode/perl.js +90 -0
  490. data/vendor/assets/ace-1.1.8/mode/perl_highlight_rules.js +165 -0
  491. data/vendor/assets/ace-1.1.8/mode/pgsql.js +59 -0
  492. data/vendor/assets/ace-1.1.8/mode/pgsql_highlight_rules.js +619 -0
  493. data/vendor/assets/ace-1.1.8/mode/php.js +158 -0
  494. data/vendor/assets/ace-1.1.8/mode/php/php.js +5031 -0
  495. data/vendor/assets/ace-1.1.8/mode/php_highlight_rules.js +1085 -0
  496. data/vendor/assets/ace-1.1.8/mode/php_test.js +65 -0
  497. data/vendor/assets/ace-1.1.8/mode/php_worker.js +81 -0
  498. data/vendor/assets/ace-1.1.8/mode/plain_text.js +55 -0
  499. data/vendor/assets/ace-1.1.8/mode/plain_text_test.js +56 -0
  500. data/vendor/assets/ace-1.1.8/mode/powershell.js +61 -0
  501. data/vendor/assets/ace-1.1.8/mode/powershell_highlight_rules.js +145 -0
  502. data/vendor/assets/ace-1.1.8/mode/praat.js +84 -0
  503. data/vendor/assets/ace-1.1.8/mode/praat_highlight_rules.js +262 -0
  504. data/vendor/assets/ace-1.1.8/mode/prolog.js +62 -0
  505. data/vendor/assets/ace-1.1.8/mode/prolog_highlight_rules.js +238 -0
  506. data/vendor/assets/ace-1.1.8/mode/properties.js +48 -0
  507. data/vendor/assets/ace-1.1.8/mode/properties_highlight_rules.js +86 -0
  508. data/vendor/assets/ace-1.1.8/mode/protobuf.js +63 -0
  509. data/vendor/assets/ace-1.1.8/mode/protobuf_highlight_rules.js +66 -0
  510. data/vendor/assets/ace-1.1.8/mode/python.js +113 -0
  511. data/vendor/assets/ace-1.1.8/mode/python_highlight_rules.js +191 -0
  512. data/vendor/assets/ace-1.1.8/mode/python_test.js +79 -0
  513. data/vendor/assets/ace-1.1.8/mode/r.js +154 -0
  514. data/vendor/assets/ace-1.1.8/mode/r_highlight_rules.js +208 -0
  515. data/vendor/assets/ace-1.1.8/mode/rdoc.js +61 -0
  516. data/vendor/assets/ace-1.1.8/mode/rdoc_highlight_rules.js +119 -0
  517. data/vendor/assets/ace-1.1.8/mode/rhtml.js +87 -0
  518. data/vendor/assets/ace-1.1.8/mode/rhtml_highlight_rules.js +66 -0
  519. data/vendor/assets/ace-1.1.8/mode/ruby.js +100 -0
  520. data/vendor/assets/ace-1.1.8/mode/ruby_highlight_rules.js +323 -0
  521. data/vendor/assets/ace-1.1.8/mode/ruby_test.js +77 -0
  522. data/vendor/assets/ace-1.1.8/mode/rust.js +58 -0
  523. data/vendor/assets/ace-1.1.8/mode/rust_highlight_rules.js +158 -0
  524. data/vendor/assets/ace-1.1.8/mode/sass.js +52 -0
  525. data/vendor/assets/ace-1.1.8/mode/sass_highlight_rules.js +79 -0
  526. data/vendor/assets/ace-1.1.8/mode/scad.js +99 -0
  527. data/vendor/assets/ace-1.1.8/mode/scad_highlight_rules.js +142 -0
  528. data/vendor/assets/ace-1.1.8/mode/scala.js +25 -0
  529. data/vendor/assets/ace-1.1.8/mode/scala_highlight_rules.js +160 -0
  530. data/vendor/assets/ace-1.1.8/mode/scheme.js +56 -0
  531. data/vendor/assets/ace-1.1.8/mode/scheme_highlight_rules.js +123 -0
  532. data/vendor/assets/ace-1.1.8/mode/scss.js +84 -0
  533. data/vendor/assets/ace-1.1.8/mode/scss_highlight_rules.js +296 -0
  534. data/vendor/assets/ace-1.1.8/mode/sh.js +116 -0
  535. data/vendor/assets/ace-1.1.8/mode/sh_highlight_rules.js +203 -0
  536. data/vendor/assets/ace-1.1.8/mode/sjs.js +56 -0
  537. data/vendor/assets/ace-1.1.8/mode/sjs_highlight_rules.js +233 -0
  538. data/vendor/assets/ace-1.1.8/mode/smarty.js +51 -0
  539. data/vendor/assets/ace-1.1.8/mode/smarty_highlight_rules.js +139 -0
  540. data/vendor/assets/ace-1.1.8/mode/snippets.js +113 -0
  541. data/vendor/assets/ace-1.1.8/mode/soy_template.js +60 -0
  542. data/vendor/assets/ace-1.1.8/mode/soy_template_highlight_rules.js +356 -0
  543. data/vendor/assets/ace-1.1.8/mode/space.js +21 -0
  544. data/vendor/assets/ace-1.1.8/mode/space_highlight_rules.js +56 -0
  545. data/vendor/assets/ace-1.1.8/mode/sql.js +53 -0
  546. data/vendor/assets/ace-1.1.8/mode/sql_highlight_rules.js +99 -0
  547. data/vendor/assets/ace-1.1.8/mode/stylus.js +62 -0
  548. data/vendor/assets/ace-1.1.8/mode/stylus_highlight_rules.js +165 -0
  549. data/vendor/assets/ace-1.1.8/mode/svg.js +69 -0
  550. data/vendor/assets/ace-1.1.8/mode/svg_highlight_rules.js +49 -0
  551. data/vendor/assets/ace-1.1.8/mode/tcl.js +84 -0
  552. data/vendor/assets/ace-1.1.8/mode/tcl_highlight_rules.js +172 -0
  553. data/vendor/assets/ace-1.1.8/mode/tex.js +68 -0
  554. data/vendor/assets/ace-1.1.8/mode/tex_highlight_rules.js +127 -0
  555. data/vendor/assets/ace-1.1.8/mode/text.js +386 -0
  556. data/vendor/assets/ace-1.1.8/mode/text_highlight_rules.js +234 -0
  557. data/vendor/assets/ace-1.1.8/mode/text_test.js +64 -0
  558. data/vendor/assets/ace-1.1.8/mode/textile.js +67 -0
  559. data/vendor/assets/ace-1.1.8/mode/textile_highlight_rules.js +93 -0
  560. data/vendor/assets/ace-1.1.8/mode/toml.js +56 -0
  561. data/vendor/assets/ace-1.1.8/mode/toml_highlight_rules.js +103 -0
  562. data/vendor/assets/ace-1.1.8/mode/twig.js +81 -0
  563. data/vendor/assets/ace-1.1.8/mode/twig_highlight_rules.js +166 -0
  564. data/vendor/assets/ace-1.1.8/mode/typescript.js +62 -0
  565. data/vendor/assets/ace-1.1.8/mode/typescript_highlight_rules.js +98 -0
  566. data/vendor/assets/ace-1.1.8/mode/vala.js +105 -0
  567. data/vendor/assets/ace-1.1.8/mode/vala_highlight_rules.js +457 -0
  568. data/vendor/assets/ace-1.1.8/mode/vbscript.js +60 -0
  569. data/vendor/assets/ace-1.1.8/mode/vbscript_highlight_rules.js +246 -0
  570. data/vendor/assets/ace-1.1.8/mode/velocity.js +58 -0
  571. data/vendor/assets/ace-1.1.8/mode/velocity_highlight_rules.js +177 -0
  572. data/vendor/assets/ace-1.1.8/mode/verilog.js +54 -0
  573. data/vendor/assets/ace-1.1.8/mode/verilog_highlight_rules.js +101 -0
  574. data/vendor/assets/ace-1.1.8/mode/vhdl.js +52 -0
  575. data/vendor/assets/ace-1.1.8/mode/vhdl_highlight_rules.js +115 -0
  576. data/vendor/assets/ace-1.1.8/mode/xml.js +59 -0
  577. data/vendor/assets/ace-1.1.8/mode/xml_highlight_rules.js +242 -0
  578. data/vendor/assets/ace-1.1.8/mode/xml_test.js +75 -0
  579. data/vendor/assets/ace-1.1.8/mode/xquery.js +216 -0
  580. data/vendor/assets/ace-1.1.8/mode/xquery/Readme.md +1 -0
  581. data/vendor/assets/ace-1.1.8/mode/xquery/jsoniq_lexer.js +4453 -0
  582. data/vendor/assets/ace-1.1.8/mode/xquery/modules.js +4 -0
  583. data/vendor/assets/ace-1.1.8/mode/xquery/xqlint.js +78912 -0
  584. data/vendor/assets/ace-1.1.8/mode/xquery/xquery_lexer.js +4422 -0
  585. data/vendor/assets/ace-1.1.8/mode/xquery_worker.js +115 -0
  586. data/vendor/assets/ace-1.1.8/mode/yaml.js +78 -0
  587. data/vendor/assets/ace-1.1.8/mode/yaml_highlight_rules.js +113 -0
  588. data/vendor/assets/ace-1.1.8/model/editor.js +62 -0
  589. data/vendor/assets/ace-1.1.8/mouse/default_gutter_handler.js +181 -0
  590. data/vendor/assets/ace-1.1.8/mouse/default_handlers.js +278 -0
  591. data/vendor/assets/ace-1.1.8/mouse/dragdrop_handler.js +428 -0
  592. data/vendor/assets/ace-1.1.8/mouse/fold_handler.js +93 -0
  593. data/vendor/assets/ace-1.1.8/mouse/mouse_event.js +129 -0
  594. data/vendor/assets/ace-1.1.8/mouse/mouse_handler.js +203 -0
  595. data/vendor/assets/ace-1.1.8/mouse/mouse_handler_test.js +77 -0
  596. data/vendor/assets/ace-1.1.8/mouse/multi_select_handler.js +208 -0
  597. data/vendor/assets/ace-1.1.8/multi_select.js +996 -0
  598. data/vendor/assets/ace-1.1.8/multi_select_test.js +199 -0
  599. data/vendor/assets/ace-1.1.8/occur.js +193 -0
  600. data/vendor/assets/ace-1.1.8/occur_test.js +154 -0
  601. data/vendor/assets/ace-1.1.8/placeholder.js +274 -0
  602. data/vendor/assets/ace-1.1.8/placeholder_test.js +156 -0
  603. data/vendor/assets/ace-1.1.8/range.js +549 -0
  604. data/vendor/assets/ace-1.1.8/range_list.js +240 -0
  605. data/vendor/assets/ace-1.1.8/range_list_test.js +182 -0
  606. data/vendor/assets/ace-1.1.8/range_test.js +191 -0
  607. data/vendor/assets/ace-1.1.8/renderloop.js +75 -0
  608. data/vendor/assets/ace-1.1.8/requirejs/text.js +52 -0
  609. data/vendor/assets/ace-1.1.8/requirejs/text_build.js +60 -0
  610. data/vendor/assets/ace-1.1.8/scrollbar.js +270 -0
  611. data/vendor/assets/ace-1.1.8/search.js +396 -0
  612. data/vendor/assets/ace-1.1.8/search_highlight.js +82 -0
  613. data/vendor/assets/ace-1.1.8/search_test.js +461 -0
  614. data/vendor/assets/ace-1.1.8/selection.js +955 -0
  615. data/vendor/assets/ace-1.1.8/selection_test.js +480 -0
  616. data/vendor/assets/ace-1.1.8/snippets.js +949 -0
  617. data/vendor/assets/ace-1.1.8/snippets/_.snippets +240 -0
  618. data/vendor/assets/ace-1.1.8/snippets/_all_modes.js +7 -0
  619. data/vendor/assets/ace-1.1.8/snippets/_all_modes.snippets +0 -0
  620. data/vendor/assets/ace-1.1.8/snippets/abap.js +7 -0
  621. data/vendor/assets/ace-1.1.8/snippets/abap.snippets +0 -0
  622. data/vendor/assets/ace-1.1.8/snippets/actionscript.js +7 -0
  623. data/vendor/assets/ace-1.1.8/snippets/actionscript.snippets +157 -0
  624. data/vendor/assets/ace-1.1.8/snippets/ada.js +7 -0
  625. data/vendor/assets/ace-1.1.8/snippets/ada.snippets +0 -0
  626. data/vendor/assets/ace-1.1.8/snippets/all_modes.js +7 -0
  627. data/vendor/assets/ace-1.1.8/snippets/all_modes.snippets +0 -0
  628. data/vendor/assets/ace-1.1.8/snippets/apache.snippets +35 -0
  629. data/vendor/assets/ace-1.1.8/snippets/apache_conf.js +7 -0
  630. data/vendor/assets/ace-1.1.8/snippets/apache_conf.snippets +0 -0
  631. data/vendor/assets/ace-1.1.8/snippets/applescript.js +7 -0
  632. data/vendor/assets/ace-1.1.8/snippets/applescript.snippets +0 -0
  633. data/vendor/assets/ace-1.1.8/snippets/asciidoc.js +7 -0
  634. data/vendor/assets/ace-1.1.8/snippets/asciidoc.snippets +0 -0
  635. data/vendor/assets/ace-1.1.8/snippets/assembly_x86.js +7 -0
  636. data/vendor/assets/ace-1.1.8/snippets/assembly_x86.snippets +0 -0
  637. data/vendor/assets/ace-1.1.8/snippets/autohotkey.js +7 -0
  638. data/vendor/assets/ace-1.1.8/snippets/autohotkey.snippets +0 -0
  639. data/vendor/assets/ace-1.1.8/snippets/autoit.snippets +66 -0
  640. data/vendor/assets/ace-1.1.8/snippets/batchfile.js +7 -0
  641. data/vendor/assets/ace-1.1.8/snippets/batchfile.snippets +0 -0
  642. data/vendor/assets/ace-1.1.8/snippets/c.snippets +235 -0
  643. data/vendor/assets/ace-1.1.8/snippets/c9search.js +7 -0
  644. data/vendor/assets/ace-1.1.8/snippets/c9search.snippets +0 -0
  645. data/vendor/assets/ace-1.1.8/snippets/c_cpp.js +7 -0
  646. data/vendor/assets/ace-1.1.8/snippets/c_cpp.snippets +131 -0
  647. data/vendor/assets/ace-1.1.8/snippets/chef.snippets +204 -0
  648. data/vendor/assets/ace-1.1.8/snippets/cirru.js +7 -0
  649. data/vendor/assets/ace-1.1.8/snippets/cirru.snippets +0 -0
  650. data/vendor/assets/ace-1.1.8/snippets/clojure.js +7 -0
  651. data/vendor/assets/ace-1.1.8/snippets/clojure.snippets +90 -0
  652. data/vendor/assets/ace-1.1.8/snippets/cmake.snippets +58 -0
  653. data/vendor/assets/ace-1.1.8/snippets/cobol.js +7 -0
  654. data/vendor/assets/ace-1.1.8/snippets/cobol.snippets +0 -0
  655. data/vendor/assets/ace-1.1.8/snippets/coffee.js +7 -0
  656. data/vendor/assets/ace-1.1.8/snippets/coffee.snippets +95 -0
  657. data/vendor/assets/ace-1.1.8/snippets/coldfusion.js +7 -0
  658. data/vendor/assets/ace-1.1.8/snippets/coldfusion.snippets +0 -0
  659. data/vendor/assets/ace-1.1.8/snippets/cs.snippets +374 -0
  660. data/vendor/assets/ace-1.1.8/snippets/csharp.js +7 -0
  661. data/vendor/assets/ace-1.1.8/snippets/csharp.snippets +0 -0
  662. data/vendor/assets/ace-1.1.8/snippets/css.js +7 -0
  663. data/vendor/assets/ace-1.1.8/snippets/css.snippets +967 -0
  664. data/vendor/assets/ace-1.1.8/snippets/curly.js +7 -0
  665. data/vendor/assets/ace-1.1.8/snippets/curly.snippets +0 -0
  666. data/vendor/assets/ace-1.1.8/snippets/d.js +7 -0
  667. data/vendor/assets/ace-1.1.8/snippets/d.snippets +0 -0
  668. data/vendor/assets/ace-1.1.8/snippets/dart.js +7 -0
  669. data/vendor/assets/ace-1.1.8/snippets/dart.snippets +83 -0
  670. data/vendor/assets/ace-1.1.8/snippets/diff.js +7 -0
  671. data/vendor/assets/ace-1.1.8/snippets/diff.snippets +11 -0
  672. data/vendor/assets/ace-1.1.8/snippets/django.js +7 -0
  673. data/vendor/assets/ace-1.1.8/snippets/django.snippets +108 -0
  674. data/vendor/assets/ace-1.1.8/snippets/dockerfile.js +7 -0
  675. data/vendor/assets/ace-1.1.8/snippets/dockerfile.snippets +0 -0
  676. data/vendor/assets/ace-1.1.8/snippets/dot.js +7 -0
  677. data/vendor/assets/ace-1.1.8/snippets/dot.snippets +0 -0
  678. data/vendor/assets/ace-1.1.8/snippets/dummy.js +7 -0
  679. data/vendor/assets/ace-1.1.8/snippets/dummy_syntax.js +7 -0
  680. data/vendor/assets/ace-1.1.8/snippets/eiffel.js +7 -0
  681. data/vendor/assets/ace-1.1.8/snippets/eiffel.snippets +0 -0
  682. data/vendor/assets/ace-1.1.8/snippets/ejs.js +7 -0
  683. data/vendor/assets/ace-1.1.8/snippets/ejs.snippets +0 -0
  684. data/vendor/assets/ace-1.1.8/snippets/elixir.js +7 -0
  685. data/vendor/assets/ace-1.1.8/snippets/elixir.snippets +0 -0
  686. data/vendor/assets/ace-1.1.8/snippets/elm.js +7 -0
  687. data/vendor/assets/ace-1.1.8/snippets/elm.snippets +0 -0
  688. data/vendor/assets/ace-1.1.8/snippets/erlang.js +7 -0
  689. data/vendor/assets/ace-1.1.8/snippets/erlang.snippets +160 -0
  690. data/vendor/assets/ace-1.1.8/snippets/eruby.snippets +113 -0
  691. data/vendor/assets/ace-1.1.8/snippets/falcon.snippets +71 -0
  692. data/vendor/assets/ace-1.1.8/snippets/forth.js +7 -0
  693. data/vendor/assets/ace-1.1.8/snippets/forth.snippets +0 -0
  694. data/vendor/assets/ace-1.1.8/snippets/ftl.js +7 -0
  695. data/vendor/assets/ace-1.1.8/snippets/ftl.snippets +0 -0
  696. data/vendor/assets/ace-1.1.8/snippets/gcode.js +7 -0
  697. data/vendor/assets/ace-1.1.8/snippets/gcode.snippets +0 -0
  698. data/vendor/assets/ace-1.1.8/snippets/gherkin.js +7 -0
  699. data/vendor/assets/ace-1.1.8/snippets/gherkin.snippets +0 -0
  700. data/vendor/assets/ace-1.1.8/snippets/gitignore.js +7 -0
  701. data/vendor/assets/ace-1.1.8/snippets/gitignore.snippets +0 -0
  702. data/vendor/assets/ace-1.1.8/snippets/glsl.js +7 -0
  703. data/vendor/assets/ace-1.1.8/snippets/glsl.snippets +0 -0
  704. data/vendor/assets/ace-1.1.8/snippets/go.snippets +201 -0
  705. data/vendor/assets/ace-1.1.8/snippets/golang.js +7 -0
  706. data/vendor/assets/ace-1.1.8/snippets/golang.snippets +0 -0
  707. data/vendor/assets/ace-1.1.8/snippets/groovy.js +7 -0
  708. data/vendor/assets/ace-1.1.8/snippets/groovy.snippets +0 -0
  709. data/vendor/assets/ace-1.1.8/snippets/haml.js +7 -0
  710. data/vendor/assets/ace-1.1.8/snippets/haml.snippets +20 -0
  711. data/vendor/assets/ace-1.1.8/snippets/handlebars.js +7 -0
  712. data/vendor/assets/ace-1.1.8/snippets/handlebars.snippets +0 -0
  713. data/vendor/assets/ace-1.1.8/snippets/haskell.js +7 -0
  714. data/vendor/assets/ace-1.1.8/snippets/haskell.snippets +82 -0
  715. data/vendor/assets/ace-1.1.8/snippets/haxe.js +7 -0
  716. data/vendor/assets/ace-1.1.8/snippets/haxe.snippets +0 -0
  717. data/vendor/assets/ace-1.1.8/snippets/html.js +7 -0
  718. data/vendor/assets/ace-1.1.8/snippets/html.snippets +828 -0
  719. data/vendor/assets/ace-1.1.8/snippets/html_ruby.js +7 -0
  720. data/vendor/assets/ace-1.1.8/snippets/html_ruby.snippets +0 -0
  721. data/vendor/assets/ace-1.1.8/snippets/htmldjango.snippets +136 -0
  722. data/vendor/assets/ace-1.1.8/snippets/htmltornado.snippets +55 -0
  723. data/vendor/assets/ace-1.1.8/snippets/ini.js +7 -0
  724. data/vendor/assets/ace-1.1.8/snippets/ini.snippets +0 -0
  725. data/vendor/assets/ace-1.1.8/snippets/io.js +69 -0
  726. data/vendor/assets/ace-1.1.8/snippets/io.snippets +0 -0
  727. data/vendor/assets/ace-1.1.8/snippets/jack.js +7 -0
  728. data/vendor/assets/ace-1.1.8/snippets/jack.snippets +0 -0
  729. data/vendor/assets/ace-1.1.8/snippets/jade.js +7 -0
  730. data/vendor/assets/ace-1.1.8/snippets/jade.snippets +0 -0
  731. data/vendor/assets/ace-1.1.8/snippets/java.js +7 -0
  732. data/vendor/assets/ace-1.1.8/snippets/java.snippets +240 -0
  733. data/vendor/assets/ace-1.1.8/snippets/javascript-jquery.snippets +589 -0
  734. data/vendor/assets/ace-1.1.8/snippets/javascript.js +7 -0
  735. data/vendor/assets/ace-1.1.8/snippets/javascript.snippets +195 -0
  736. data/vendor/assets/ace-1.1.8/snippets/json.js +7 -0
  737. data/vendor/assets/ace-1.1.8/snippets/json.snippets +0 -0
  738. data/vendor/assets/ace-1.1.8/snippets/jsoniq.js +7 -0
  739. data/vendor/assets/ace-1.1.8/snippets/jsoniq.snippets +61 -0
  740. data/vendor/assets/ace-1.1.8/snippets/jsp.js +7 -0
  741. data/vendor/assets/ace-1.1.8/snippets/jsp.snippets +99 -0
  742. data/vendor/assets/ace-1.1.8/snippets/jsx.js +7 -0
  743. data/vendor/assets/ace-1.1.8/snippets/jsx.snippets +0 -0
  744. data/vendor/assets/ace-1.1.8/snippets/julia.js +7 -0
  745. data/vendor/assets/ace-1.1.8/snippets/julia.snippets +0 -0
  746. data/vendor/assets/ace-1.1.8/snippets/latex.js +7 -0
  747. data/vendor/assets/ace-1.1.8/snippets/latex.snippets +0 -0
  748. data/vendor/assets/ace-1.1.8/snippets/ledger.snippets +5 -0
  749. data/vendor/assets/ace-1.1.8/snippets/less.js +7 -0
  750. data/vendor/assets/ace-1.1.8/snippets/less.snippets +0 -0
  751. data/vendor/assets/ace-1.1.8/snippets/liquid.js +7 -0
  752. data/vendor/assets/ace-1.1.8/snippets/liquid.snippets +0 -0
  753. data/vendor/assets/ace-1.1.8/snippets/lisp.js +7 -0
  754. data/vendor/assets/ace-1.1.8/snippets/lisp.snippets +0 -0
  755. data/vendor/assets/ace-1.1.8/snippets/livescript.js +7 -0
  756. data/vendor/assets/ace-1.1.8/snippets/livescript.snippets +0 -0
  757. data/vendor/assets/ace-1.1.8/snippets/logiql.js +7 -0
  758. data/vendor/assets/ace-1.1.8/snippets/logiql.snippets +0 -0
  759. data/vendor/assets/ace-1.1.8/snippets/lsl.js +7 -0
  760. data/vendor/assets/ace-1.1.8/snippets/lsl.snippets +1066 -0
  761. data/vendor/assets/ace-1.1.8/snippets/lua.js +7 -0
  762. data/vendor/assets/ace-1.1.8/snippets/lua.snippets +21 -0
  763. data/vendor/assets/ace-1.1.8/snippets/luapage.js +7 -0
  764. data/vendor/assets/ace-1.1.8/snippets/luapage.snippets +0 -0
  765. data/vendor/assets/ace-1.1.8/snippets/lucene.js +7 -0
  766. data/vendor/assets/ace-1.1.8/snippets/lucene.snippets +0 -0
  767. data/vendor/assets/ace-1.1.8/snippets/makefile.js +7 -0
  768. data/vendor/assets/ace-1.1.8/snippets/makefile.snippets +4 -0
  769. data/vendor/assets/ace-1.1.8/snippets/mako.snippets +54 -0
  770. data/vendor/assets/ace-1.1.8/snippets/markdown.js +7 -0
  771. data/vendor/assets/ace-1.1.8/snippets/markdown.snippets +88 -0
  772. data/vendor/assets/ace-1.1.8/snippets/matlab.js +7 -0
  773. data/vendor/assets/ace-1.1.8/snippets/matlab.snippets +0 -0
  774. data/vendor/assets/ace-1.1.8/snippets/mel.js +7 -0
  775. data/vendor/assets/ace-1.1.8/snippets/mel.snippets +0 -0
  776. data/vendor/assets/ace-1.1.8/snippets/mushcode.js +7 -0
  777. data/vendor/assets/ace-1.1.8/snippets/mushcode.snippets +0 -0
  778. data/vendor/assets/ace-1.1.8/snippets/mushcode_high_rules.js +7 -0
  779. data/vendor/assets/ace-1.1.8/snippets/mushcode_high_rules.snippets +0 -0
  780. data/vendor/assets/ace-1.1.8/snippets/mysql.js +7 -0
  781. data/vendor/assets/ace-1.1.8/snippets/mysql.snippets +0 -0
  782. data/vendor/assets/ace-1.1.8/snippets/nix.js +7 -0
  783. data/vendor/assets/ace-1.1.8/snippets/nix.snippets +0 -0
  784. data/vendor/assets/ace-1.1.8/snippets/objc.snippets +247 -0
  785. data/vendor/assets/ace-1.1.8/snippets/objectivec.js +7 -0
  786. data/vendor/assets/ace-1.1.8/snippets/objectivec.snippets +0 -0
  787. data/vendor/assets/ace-1.1.8/snippets/ocaml.js +7 -0
  788. data/vendor/assets/ace-1.1.8/snippets/ocaml.snippets +0 -0
  789. data/vendor/assets/ace-1.1.8/snippets/pascal.js +7 -0
  790. data/vendor/assets/ace-1.1.8/snippets/pascal.snippets +0 -0
  791. data/vendor/assets/ace-1.1.8/snippets/perl.js +7 -0
  792. data/vendor/assets/ace-1.1.8/snippets/perl.snippets +347 -0
  793. data/vendor/assets/ace-1.1.8/snippets/pgsql.js +7 -0
  794. data/vendor/assets/ace-1.1.8/snippets/pgsql.snippets +0 -0
  795. data/vendor/assets/ace-1.1.8/snippets/php.js +7 -0
  796. data/vendor/assets/ace-1.1.8/snippets/php.snippets +377 -0
  797. data/vendor/assets/ace-1.1.8/snippets/plain_text.js +7 -0
  798. data/vendor/assets/ace-1.1.8/snippets/plain_text.snippets +0 -0
  799. data/vendor/assets/ace-1.1.8/snippets/powershell.js +7 -0
  800. data/vendor/assets/ace-1.1.8/snippets/powershell.snippets +0 -0
  801. data/vendor/assets/ace-1.1.8/snippets/praat.js +7 -0
  802. data/vendor/assets/ace-1.1.8/snippets/praat.snippets +0 -0
  803. data/vendor/assets/ace-1.1.8/snippets/prolog.js +7 -0
  804. data/vendor/assets/ace-1.1.8/snippets/prolog.snippets +0 -0
  805. data/vendor/assets/ace-1.1.8/snippets/properties.js +7 -0
  806. data/vendor/assets/ace-1.1.8/snippets/properties.snippets +0 -0
  807. data/vendor/assets/ace-1.1.8/snippets/protobuf.js +7 -0
  808. data/vendor/assets/ace-1.1.8/snippets/protobuf.snippets +0 -0
  809. data/vendor/assets/ace-1.1.8/snippets/python.js +7 -0
  810. data/vendor/assets/ace-1.1.8/snippets/python.snippets +158 -0
  811. data/vendor/assets/ace-1.1.8/snippets/r.js +7 -0
  812. data/vendor/assets/ace-1.1.8/snippets/r.snippets +121 -0
  813. data/vendor/assets/ace-1.1.8/snippets/rdoc.js +7 -0
  814. data/vendor/assets/ace-1.1.8/snippets/rdoc.snippets +0 -0
  815. data/vendor/assets/ace-1.1.8/snippets/rhtml.js +7 -0
  816. data/vendor/assets/ace-1.1.8/snippets/rhtml.snippets +0 -0
  817. data/vendor/assets/ace-1.1.8/snippets/rst.snippets +22 -0
  818. data/vendor/assets/ace-1.1.8/snippets/ruby.js +7 -0
  819. data/vendor/assets/ace-1.1.8/snippets/ruby.snippets +928 -0
  820. data/vendor/assets/ace-1.1.8/snippets/rust.js +7 -0
  821. data/vendor/assets/ace-1.1.8/snippets/rust.snippets +0 -0
  822. data/vendor/assets/ace-1.1.8/snippets/sass.js +7 -0
  823. data/vendor/assets/ace-1.1.8/snippets/sass.snippets +0 -0
  824. data/vendor/assets/ace-1.1.8/snippets/scad.js +7 -0
  825. data/vendor/assets/ace-1.1.8/snippets/scad.snippets +0 -0
  826. data/vendor/assets/ace-1.1.8/snippets/scala.js +7 -0
  827. data/vendor/assets/ace-1.1.8/snippets/scala.snippets +0 -0
  828. data/vendor/assets/ace-1.1.8/snippets/scheme.js +7 -0
  829. data/vendor/assets/ace-1.1.8/snippets/scheme.snippets +0 -0
  830. data/vendor/assets/ace-1.1.8/snippets/scss.js +7 -0
  831. data/vendor/assets/ace-1.1.8/snippets/scss.snippets +0 -0
  832. data/vendor/assets/ace-1.1.8/snippets/sh.js +7 -0
  833. data/vendor/assets/ace-1.1.8/snippets/sh.snippets +83 -0
  834. data/vendor/assets/ace-1.1.8/snippets/sjs.js +7 -0
  835. data/vendor/assets/ace-1.1.8/snippets/sjs.snippets +0 -0
  836. data/vendor/assets/ace-1.1.8/snippets/smarty.js +7 -0
  837. data/vendor/assets/ace-1.1.8/snippets/smarty.snippets +0 -0
  838. data/vendor/assets/ace-1.1.8/snippets/snippets.js +7 -0
  839. data/vendor/assets/ace-1.1.8/snippets/snippets.snippets +9 -0
  840. data/vendor/assets/ace-1.1.8/snippets/soy_template.js +7 -0
  841. data/vendor/assets/ace-1.1.8/snippets/soy_template.snippets +0 -0
  842. data/vendor/assets/ace-1.1.8/snippets/space.js +7 -0
  843. data/vendor/assets/ace-1.1.8/snippets/space.snippets +0 -0
  844. data/vendor/assets/ace-1.1.8/snippets/sql.js +7 -0
  845. data/vendor/assets/ace-1.1.8/snippets/sql.snippets +26 -0
  846. data/vendor/assets/ace-1.1.8/snippets/stylus.js +7 -0
  847. data/vendor/assets/ace-1.1.8/snippets/stylus.snippets +0 -0
  848. data/vendor/assets/ace-1.1.8/snippets/svg.js +7 -0
  849. data/vendor/assets/ace-1.1.8/snippets/svg.snippets +0 -0
  850. data/vendor/assets/ace-1.1.8/snippets/tcl.js +7 -0
  851. data/vendor/assets/ace-1.1.8/snippets/tcl.snippets +92 -0
  852. data/vendor/assets/ace-1.1.8/snippets/tex.js +7 -0
  853. data/vendor/assets/ace-1.1.8/snippets/tex.snippets +191 -0
  854. data/vendor/assets/ace-1.1.8/snippets/text.js +7 -0
  855. data/vendor/assets/ace-1.1.8/snippets/text.snippets +0 -0
  856. data/vendor/assets/ace-1.1.8/snippets/textile.js +7 -0
  857. data/vendor/assets/ace-1.1.8/snippets/textile.snippets +30 -0
  858. data/vendor/assets/ace-1.1.8/snippets/tmsnippet.snippets +0 -0
  859. data/vendor/assets/ace-1.1.8/snippets/toml.js +7 -0
  860. data/vendor/assets/ace-1.1.8/snippets/toml.snippets +0 -0
  861. data/vendor/assets/ace-1.1.8/snippets/twig.js +7 -0
  862. data/vendor/assets/ace-1.1.8/snippets/twig.snippets +0 -0
  863. data/vendor/assets/ace-1.1.8/snippets/typescript.js +7 -0
  864. data/vendor/assets/ace-1.1.8/snippets/typescript.snippets +0 -0
  865. data/vendor/assets/ace-1.1.8/snippets/vala.js +195 -0
  866. data/vendor/assets/ace-1.1.8/snippets/vala.snippets +0 -0
  867. data/vendor/assets/ace-1.1.8/snippets/vbscript.js +7 -0
  868. data/vendor/assets/ace-1.1.8/snippets/vbscript.snippets +0 -0
  869. data/vendor/assets/ace-1.1.8/snippets/velocity.js +8 -0
  870. data/vendor/assets/ace-1.1.8/snippets/velocity.snippets +28 -0
  871. data/vendor/assets/ace-1.1.8/snippets/verilog.js +7 -0
  872. data/vendor/assets/ace-1.1.8/snippets/verilog.snippets +0 -0
  873. data/vendor/assets/ace-1.1.8/snippets/vhdl.js +7 -0
  874. data/vendor/assets/ace-1.1.8/snippets/vhdl.snippets +0 -0
  875. data/vendor/assets/ace-1.1.8/snippets/xml.js +7 -0
  876. data/vendor/assets/ace-1.1.8/snippets/xml.snippets +0 -0
  877. data/vendor/assets/ace-1.1.8/snippets/xquery.js +7 -0
  878. data/vendor/assets/ace-1.1.8/snippets/xquery.snippets +61 -0
  879. data/vendor/assets/ace-1.1.8/snippets/xslt.snippets +97 -0
  880. data/vendor/assets/ace-1.1.8/snippets/yaml.js +7 -0
  881. data/vendor/assets/ace-1.1.8/snippets/yaml.snippets +0 -0
  882. data/vendor/assets/ace-1.1.8/snippets_test.js +131 -0
  883. data/vendor/assets/ace-1.1.8/split.js +373 -0
  884. data/vendor/assets/ace-1.1.8/test/all.js +35 -0
  885. data/vendor/assets/ace-1.1.8/test/all_browser.js +141 -0
  886. data/vendor/assets/ace-1.1.8/test/assertions.js +56 -0
  887. data/vendor/assets/ace-1.1.8/test/asyncjs/assert.js +313 -0
  888. data/vendor/assets/ace-1.1.8/test/asyncjs/async.js +529 -0
  889. data/vendor/assets/ace-1.1.8/test/asyncjs/index.js +13 -0
  890. data/vendor/assets/ace-1.1.8/test/asyncjs/test.js +195 -0
  891. data/vendor/assets/ace-1.1.8/test/asyncjs/utils.js +65 -0
  892. data/vendor/assets/ace-1.1.8/test/benchmark.js +78 -0
  893. data/vendor/assets/ace-1.1.8/test/mockdom.js +10 -0
  894. data/vendor/assets/ace-1.1.8/test/mockrenderer.js +208 -0
  895. data/vendor/assets/ace-1.1.8/test/tests.html +46 -0
  896. data/vendor/assets/ace-1.1.8/theme/ambiance.css +221 -0
  897. data/vendor/assets/ace-1.1.8/theme/ambiance.js +33 -0
  898. data/vendor/assets/ace-1.1.8/theme/chaos.css +154 -0
  899. data/vendor/assets/ace-1.1.8/theme/chaos.js +33 -0
  900. data/vendor/assets/ace-1.1.8/theme/chrome.css +154 -0
  901. data/vendor/assets/ace-1.1.8/theme/chrome.js +39 -0
  902. data/vendor/assets/ace-1.1.8/theme/clouds.css +112 -0
  903. data/vendor/assets/ace-1.1.8/theme/clouds.js +39 -0
  904. data/vendor/assets/ace-1.1.8/theme/clouds_midnight.css +113 -0
  905. data/vendor/assets/ace-1.1.8/theme/clouds_midnight.js +39 -0
  906. data/vendor/assets/ace-1.1.8/theme/cobalt.css +134 -0
  907. data/vendor/assets/ace-1.1.8/theme/cobalt.js +39 -0
  908. data/vendor/assets/ace-1.1.8/theme/crimson_editor.css +143 -0
  909. data/vendor/assets/ace-1.1.8/theme/crimson_editor.js +39 -0
  910. data/vendor/assets/ace-1.1.8/theme/dawn.css +127 -0
  911. data/vendor/assets/ace-1.1.8/theme/dawn.js +39 -0
  912. data/vendor/assets/ace-1.1.8/theme/dreamweaver.css +176 -0
  913. data/vendor/assets/ace-1.1.8/theme/dreamweaver.js +38 -0
  914. data/vendor/assets/ace-1.1.8/theme/eclipse.css +113 -0
  915. data/vendor/assets/ace-1.1.8/theme/eclipse.js +41 -0
  916. data/vendor/assets/ace-1.1.8/theme/github.css +119 -0
  917. data/vendor/assets/ace-1.1.8/theme/github.js +39 -0
  918. data/vendor/assets/ace-1.1.8/theme/idle_fingers.css +113 -0
  919. data/vendor/assets/ace-1.1.8/theme/idle_fingers.js +39 -0
  920. data/vendor/assets/ace-1.1.8/theme/katzenmilch.css +140 -0
  921. data/vendor/assets/ace-1.1.8/theme/katzenmilch.js +39 -0
  922. data/vendor/assets/ace-1.1.8/theme/kr_theme.css +124 -0
  923. data/vendor/assets/ace-1.1.8/theme/kr_theme.js +39 -0
  924. data/vendor/assets/ace-1.1.8/theme/kuroir.css +67 -0
  925. data/vendor/assets/ace-1.1.8/theme/kuroir.js +39 -0
  926. data/vendor/assets/ace-1.1.8/theme/merbivore.css +110 -0
  927. data/vendor/assets/ace-1.1.8/theme/merbivore.js +39 -0
  928. data/vendor/assets/ace-1.1.8/theme/merbivore_soft.css +111 -0
  929. data/vendor/assets/ace-1.1.8/theme/merbivore_soft.js +39 -0
  930. data/vendor/assets/ace-1.1.8/theme/mono_industrial.css +126 -0
  931. data/vendor/assets/ace-1.1.8/theme/mono_industrial.js +39 -0
  932. data/vendor/assets/ace-1.1.8/theme/monokai.css +122 -0
  933. data/vendor/assets/ace-1.1.8/theme/monokai.js +39 -0
  934. data/vendor/assets/ace-1.1.8/theme/pastel_on_dark.css +129 -0
  935. data/vendor/assets/ace-1.1.8/theme/pastel_on_dark.js +39 -0
  936. data/vendor/assets/ace-1.1.8/theme/solarized_dark.css +101 -0
  937. data/vendor/assets/ace-1.1.8/theme/solarized_dark.js +39 -0
  938. data/vendor/assets/ace-1.1.8/theme/solarized_light.css +106 -0
  939. data/vendor/assets/ace-1.1.8/theme/solarized_light.js +39 -0
  940. data/vendor/assets/ace-1.1.8/theme/terminal.css +132 -0
  941. data/vendor/assets/ace-1.1.8/theme/terminal.js +39 -0
  942. data/vendor/assets/ace-1.1.8/theme/textmate.css +155 -0
  943. data/vendor/assets/ace-1.1.8/theme/textmate.js +40 -0
  944. data/vendor/assets/ace-1.1.8/theme/tomorrow.css +125 -0
  945. data/vendor/assets/ace-1.1.8/theme/tomorrow.js +39 -0
  946. data/vendor/assets/ace-1.1.8/theme/tomorrow_night.css +125 -0
  947. data/vendor/assets/ace-1.1.8/theme/tomorrow_night.js +39 -0
  948. data/vendor/assets/ace-1.1.8/theme/tomorrow_night_blue.css +122 -0
  949. data/vendor/assets/ace-1.1.8/theme/tomorrow_night_blue.js +39 -0
  950. data/vendor/assets/ace-1.1.8/theme/tomorrow_night_bright.css +141 -0
  951. data/vendor/assets/ace-1.1.8/theme/tomorrow_night_bright.js +39 -0
  952. data/vendor/assets/ace-1.1.8/theme/tomorrow_night_eighties.css +125 -0
  953. data/vendor/assets/ace-1.1.8/theme/tomorrow_night_eighties.js +39 -0
  954. data/vendor/assets/ace-1.1.8/theme/twilight.css +128 -0
  955. data/vendor/assets/ace-1.1.8/theme/twilight.js +39 -0
  956. data/vendor/assets/ace-1.1.8/theme/vibrant_ink.css +110 -0
  957. data/vendor/assets/ace-1.1.8/theme/vibrant_ink.js +39 -0
  958. data/vendor/assets/ace-1.1.8/theme/xcode.css +103 -0
  959. data/vendor/assets/ace-1.1.8/theme/xcode.js +39 -0
  960. data/vendor/assets/ace-1.1.8/token_iterator.js +150 -0
  961. data/vendor/assets/ace-1.1.8/token_iterator_test.js +212 -0
  962. data/vendor/assets/ace-1.1.8/tokenizer.js +366 -0
  963. data/vendor/assets/ace-1.1.8/tokenizer_dev.js +183 -0
  964. data/vendor/assets/ace-1.1.8/tokenizer_test.js +97 -0
  965. data/vendor/assets/ace-1.1.8/tooltip.js +138 -0
  966. data/vendor/assets/ace-1.1.8/undomanager.js +168 -0
  967. data/vendor/assets/ace-1.1.8/unicode.js +107 -0
  968. data/vendor/assets/ace-1.1.8/virtual_renderer.js +1759 -0
  969. data/vendor/assets/ace-1.1.8/virtual_renderer_test.js +86 -0
  970. data/vendor/assets/ace-1.1.8/worker/mirror.js +49 -0
  971. data/vendor/assets/ace-1.1.8/worker/worker.js +193 -0
  972. data/vendor/assets/ace-1.1.8/worker/worker_client.js +255 -0
  973. data/vendor/assets/ace-1.1.8/worker/worker_test.js +125 -0
  974. data/vendor/assets/ckeditor-4.4.7/CHANGES.md +720 -0
  975. data/vendor/assets/ckeditor-4.4.7/LICENSE.md +1264 -0
  976. data/vendor/assets/ckeditor-4.4.7/README.md +39 -0
  977. data/vendor/assets/ckeditor-4.4.7/adapters/jquery.js +10 -0
  978. data/vendor/assets/ckeditor-4.4.7/build-config.js +83 -0
  979. data/vendor/assets/ckeditor-4.4.7/ckeditor.js +829 -0
  980. data/vendor/assets/ckeditor-4.4.7/config.js +34 -0
  981. data/vendor/assets/ckeditor-4.4.7/contents.css +134 -0
  982. data/vendor/assets/ckeditor-4.4.7/lang/en.js +5 -0
  983. data/vendor/assets/ckeditor-4.4.7/plugins/clipboard/dialogs/paste.js +11 -0
  984. data/vendor/assets/ckeditor-4.4.7/plugins/dialog/dialogDefinition.js +4 -0
  985. data/vendor/assets/ckeditor-4.4.7/plugins/icons.png +0 -0
  986. data/vendor/assets/ckeditor-4.4.7/plugins/icons_hidpi.png +0 -0
  987. data/vendor/assets/ckeditor-4.4.7/plugins/image/dialogs/image.js +43 -0
  988. data/vendor/assets/ckeditor-4.4.7/plugins/image/images/noimage.png +0 -0
  989. data/vendor/assets/ckeditor-4.4.7/plugins/link/dialogs/anchor.js +7 -0
  990. data/vendor/assets/ckeditor-4.4.7/plugins/link/dialogs/link.js +26 -0
  991. data/vendor/assets/ckeditor-4.4.7/plugins/link/images/anchor.png +0 -0
  992. data/vendor/assets/ckeditor-4.4.7/plugins/link/images/hidpi/anchor.png +0 -0
  993. data/vendor/assets/ckeditor-4.4.7/plugins/magicline/images/hidpi/icon-rtl.png +0 -0
  994. data/vendor/assets/ckeditor-4.4.7/plugins/magicline/images/hidpi/icon.png +0 -0
  995. data/vendor/assets/ckeditor-4.4.7/plugins/magicline/images/icon-rtl.png +0 -0
  996. data/vendor/assets/ckeditor-4.4.7/plugins/magicline/images/icon.png +0 -0
  997. data/vendor/assets/ckeditor-4.4.7/plugins/pastefromword/filter/default.js +31 -0
  998. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_address.png +0 -0
  999. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_blockquote.png +0 -0
  1000. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_div.png +0 -0
  1001. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_h1.png +0 -0
  1002. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_h2.png +0 -0
  1003. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_h3.png +0 -0
  1004. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_h4.png +0 -0
  1005. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_h5.png +0 -0
  1006. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_h6.png +0 -0
  1007. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_p.png +0 -0
  1008. data/vendor/assets/ckeditor-4.4.7/plugins/showblocks/images/block_pre.png +0 -0
  1009. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/_translationstatus.txt +20 -0
  1010. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/af.js +13 -0
  1011. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/ar.js +13 -0
  1012. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/bg.js +13 -0
  1013. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/ca.js +14 -0
  1014. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/cs.js +13 -0
  1015. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/cy.js +14 -0
  1016. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/da.js +13 -0
  1017. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/de.js +13 -0
  1018. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/el.js +13 -0
  1019. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/en-gb.js +13 -0
  1020. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/en.js +13 -0
  1021. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/eo.js +12 -0
  1022. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/es.js +13 -0
  1023. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/et.js +13 -0
  1024. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/fa.js +12 -0
  1025. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/fi.js +13 -0
  1026. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/fr-ca.js +10 -0
  1027. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/fr.js +11 -0
  1028. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/gl.js +13 -0
  1029. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/he.js +12 -0
  1030. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/hr.js +13 -0
  1031. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/hu.js +12 -0
  1032. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/id.js +13 -0
  1033. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/it.js +14 -0
  1034. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/ja.js +9 -0
  1035. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/km.js +13 -0
  1036. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/ku.js +13 -0
  1037. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/lt.js +13 -0
  1038. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/lv.js +13 -0
  1039. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/nb.js +11 -0
  1040. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/nl.js +13 -0
  1041. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/no.js +11 -0
  1042. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/pl.js +12 -0
  1043. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/pt-br.js +11 -0
  1044. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/pt.js +13 -0
  1045. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/ru.js +13 -0
  1046. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/si.js +13 -0
  1047. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/sk.js +13 -0
  1048. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/sl.js +12 -0
  1049. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/sq.js +13 -0
  1050. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/sv.js +11 -0
  1051. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/th.js +13 -0
  1052. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/tr.js +12 -0
  1053. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/tt.js +13 -0
  1054. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/ug.js +13 -0
  1055. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/uk.js +12 -0
  1056. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/vi.js +14 -0
  1057. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/zh-cn.js +9 -0
  1058. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/lang/zh.js +12 -0
  1059. data/vendor/assets/ckeditor-4.4.7/plugins/specialchar/dialogs/specialchar.js +14 -0
  1060. data/vendor/assets/ckeditor-4.4.7/plugins/table/dialogs/table.js +21 -0
  1061. data/vendor/assets/ckeditor-4.4.7/plugins/templates/dialogs/templates.css +84 -0
  1062. data/vendor/assets/ckeditor-4.4.7/plugins/templates/dialogs/templates.js +10 -0
  1063. data/vendor/assets/ckeditor-4.4.7/plugins/templates/templates/default.js +6 -0
  1064. data/vendor/assets/ckeditor-4.4.7/plugins/templates/templates/images/template1.gif +0 -0
  1065. data/vendor/assets/ckeditor-4.4.7/plugins/templates/templates/images/template2.gif +0 -0
  1066. data/vendor/assets/ckeditor-4.4.7/plugins/templates/templates/images/template3.gif +0 -0
  1067. data/vendor/assets/ckeditor-4.4.7/plugins/uploadcare/README.md +64 -0
  1068. data/vendor/assets/ckeditor-4.4.7/plugins/uploadcare/icons/hidpi/uploadcare.png +0 -0
  1069. data/vendor/assets/ckeditor-4.4.7/plugins/uploadcare/icons/uploadcare.png +0 -0
  1070. data/vendor/assets/ckeditor-4.4.7/samples/ajax.html +82 -0
  1071. data/vendor/assets/ckeditor-4.4.7/samples/api.html +207 -0
  1072. data/vendor/assets/ckeditor-4.4.7/samples/appendto.html +56 -0
  1073. data/vendor/assets/ckeditor-4.4.7/samples/assets/inlineall/logo.png +0 -0
  1074. data/vendor/assets/ckeditor-4.4.7/samples/assets/outputxhtml/outputxhtml.css +204 -0
  1075. data/vendor/assets/ckeditor-4.4.7/samples/assets/posteddata.php +59 -0
  1076. data/vendor/assets/ckeditor-4.4.7/samples/assets/sample.jpg +0 -0
  1077. data/vendor/assets/ckeditor-4.4.7/samples/assets/uilanguages/languages.js +7 -0
  1078. data/vendor/assets/ckeditor-4.4.7/samples/datafiltering.html +401 -0
  1079. data/vendor/assets/ckeditor-4.4.7/samples/divreplace.html +141 -0
  1080. data/vendor/assets/ckeditor-4.4.7/samples/index.html +119 -0
  1081. data/vendor/assets/ckeditor-4.4.7/samples/inlineall.html +311 -0
  1082. data/vendor/assets/ckeditor-4.4.7/samples/inlinebycode.html +121 -0
  1083. data/vendor/assets/ckeditor-4.4.7/samples/inlinetextarea.html +110 -0
  1084. data/vendor/assets/ckeditor-4.4.7/samples/jquery.html +100 -0
  1085. data/vendor/assets/ckeditor-4.4.7/samples/plugins/dialog/assets/my_dialog.js +48 -0
  1086. data/vendor/assets/ckeditor-4.4.7/samples/plugins/dialog/dialog.html +187 -0
  1087. data/vendor/assets/ckeditor-4.4.7/samples/plugins/enterkey/enterkey.html +103 -0
  1088. data/vendor/assets/ckeditor-4.4.7/samples/plugins/magicline/magicline.html +206 -0
  1089. data/vendor/assets/ckeditor-4.4.7/samples/plugins/toolbar/toolbar.html +232 -0
  1090. data/vendor/assets/ckeditor-4.4.7/samples/readonly.html +73 -0
  1091. data/vendor/assets/ckeditor-4.4.7/samples/replacebyclass.html +57 -0
  1092. data/vendor/assets/ckeditor-4.4.7/samples/replacebycode.html +56 -0
  1093. data/vendor/assets/ckeditor-4.4.7/samples/sample.css +365 -0
  1094. data/vendor/assets/ckeditor-4.4.7/samples/sample.js +50 -0
  1095. data/vendor/assets/ckeditor-4.4.7/samples/sample_posteddata.php +16 -0
  1096. data/vendor/assets/ckeditor-4.4.7/samples/tabindex.html +75 -0
  1097. data/vendor/assets/ckeditor-4.4.7/samples/uicolor.html +69 -0
  1098. data/vendor/assets/ckeditor-4.4.7/samples/uilanguages.html +119 -0
  1099. data/vendor/assets/ckeditor-4.4.7/samples/xhtmlstyle.html +231 -0
  1100. data/vendor/assets/ckeditor-4.4.7/skins/flat/dialog.css +5 -0
  1101. data/vendor/assets/ckeditor-4.4.7/skins/flat/dialog_ie.css +5 -0
  1102. data/vendor/assets/ckeditor-4.4.7/skins/flat/dialog_ie7.css +5 -0
  1103. data/vendor/assets/ckeditor-4.4.7/skins/flat/dialog_ie8.css +5 -0
  1104. data/vendor/assets/ckeditor-4.4.7/skins/flat/dialog_iequirks.css +5 -0
  1105. data/vendor/assets/ckeditor-4.4.7/skins/flat/editor.css +5 -0
  1106. data/vendor/assets/ckeditor-4.4.7/skins/flat/editor_gecko.css +5 -0
  1107. data/vendor/assets/ckeditor-4.4.7/skins/flat/editor_ie.css +5 -0
  1108. data/vendor/assets/ckeditor-4.4.7/skins/flat/editor_ie7.css +5 -0
  1109. data/vendor/assets/ckeditor-4.4.7/skins/flat/editor_ie8.css +5 -0
  1110. data/vendor/assets/ckeditor-4.4.7/skins/flat/editor_iequirks.css +5 -0
  1111. data/vendor/assets/ckeditor-4.4.7/skins/flat/icons.png +0 -0
  1112. data/vendor/assets/ckeditor-4.4.7/skins/flat/icons_hidpi.png +0 -0
  1113. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/arrow.png +0 -0
  1114. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/close.png +0 -0
  1115. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/hidpi/close.png +0 -0
  1116. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/hidpi/lock-open.png +0 -0
  1117. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/hidpi/lock.png +0 -0
  1118. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/hidpi/refresh.png +0 -0
  1119. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/lock-open.png +0 -0
  1120. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/lock.png +0 -0
  1121. data/vendor/assets/ckeditor-4.4.7/skins/flat/images/refresh.png +0 -0
  1122. data/vendor/assets/ckeditor-4.4.7/skins/flat/readme.md +8 -0
  1123. data/vendor/assets/ckeditor-4.4.7/styles.js +111 -0
  1124. data/vendor/assets/javascripts/backbone.js +1608 -0
  1125. data/vendor/assets/javascripts/backbone.memento.js +159 -0
  1126. data/vendor/assets/javascripts/jquery-ui.js +14987 -0
  1127. data/vendor/assets/javascripts/jquery.js +10346 -0
  1128. data/vendor/assets/javascripts/jquery.noty.js +1436 -0
  1129. data/vendor/assets/javascripts/require.js +36 -0
  1130. data/vendor/assets/javascripts/text.js +391 -0
  1131. data/vendor/assets/javascripts/underscore.js +1536 -0
  1132. metadata +1287 -0
@@ -0,0 +1,306 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ if (typeof process !== "undefined") {
32
+ require("amd-loader");
33
+ require("./test/mockdom");
34
+ }
35
+
36
+ define(function(require, exports, module) {
37
+ "use strict";
38
+
39
+ var Document = require("./document").Document;
40
+ var Range = require("./range").Range;
41
+ var assert = require("./test/assertions");
42
+
43
+ module.exports = {
44
+
45
+ "test: insert text in line" : function() {
46
+ var doc = new Document(["12", "34"]);
47
+
48
+ var deltas = [];
49
+ doc.on("change", function(e) { deltas.push(e.data); });
50
+
51
+ doc.insert({row: 0, column: 1}, "juhu");
52
+ assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
53
+
54
+ var d = deltas.concat();
55
+ doc.revertDeltas(d);
56
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
57
+
58
+ doc.applyDeltas(d);
59
+ assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
60
+ },
61
+
62
+ "test: insert new line" : function() {
63
+ var doc = new Document(["12", "34"]);
64
+
65
+ var deltas = [];
66
+ doc.on("change", function(e) { deltas.push(e.data); });
67
+
68
+ doc.insertNewLine({row: 0, column: 1});
69
+ assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
70
+
71
+ var d = deltas.concat();
72
+ doc.revertDeltas(d);
73
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
74
+
75
+ doc.applyDeltas(d);
76
+ assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
77
+ },
78
+
79
+ "test: insert lines at the beginning" : function() {
80
+ var doc = new Document(["12", "34"]);
81
+
82
+ var deltas = [];
83
+ doc.on("change", function(e) { deltas.push(e.data); });
84
+
85
+ doc.insertLines(0, ["aa", "bb"]);
86
+ assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
87
+
88
+ var d = deltas.concat();
89
+ doc.revertDeltas(d);
90
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
91
+
92
+ doc.applyDeltas(d);
93
+ assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
94
+ },
95
+
96
+ "test: insert lines at the end" : function() {
97
+ var doc = new Document(["12", "34"]);
98
+
99
+ var deltas = [];
100
+ doc.on("change", function(e) { deltas.push(e.data); });
101
+
102
+ doc.insertLines(2, ["aa", "bb"]);
103
+ assert.equal(doc.getValue(), ["12", "34", "aa", "bb"].join("\n"));
104
+ },
105
+
106
+ "test: insert lines in the middle" : function() {
107
+ var doc = new Document(["12", "34"]);
108
+
109
+ var deltas = [];
110
+ doc.on("change", function(e) { deltas.push(e.data); });
111
+
112
+ doc.insertLines(1, ["aa", "bb"]);
113
+ assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
114
+
115
+ var d = deltas.concat();
116
+ doc.revertDeltas(d);
117
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
118
+
119
+ doc.applyDeltas(d);
120
+ assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
121
+ },
122
+
123
+ "test: insert multi line string at the start" : function() {
124
+ var doc = new Document(["12", "34"]);
125
+
126
+ var deltas = [];
127
+ doc.on("change", function(e) { deltas.push(e.data); });
128
+
129
+ doc.insert({row: 0, column: 0}, "aa\nbb\ncc");
130
+ assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
131
+
132
+ var d = deltas.concat();
133
+ doc.revertDeltas(d);
134
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
135
+
136
+ doc.applyDeltas(d);
137
+ assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
138
+ },
139
+
140
+ "test: insert multi line string at the end" : function() {
141
+ var doc = new Document(["12", "34"]);
142
+
143
+ var deltas = [];
144
+ doc.on("change", function(e) { deltas.push(e.data); });
145
+
146
+ doc.insert({row: 2, column: 0}, "aa\nbb\ncc");
147
+ assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
148
+
149
+ var d = deltas.concat();
150
+ doc.revertDeltas(d);
151
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
152
+
153
+ doc.applyDeltas(d);
154
+ assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
155
+ },
156
+
157
+ "test: insert multi line string in the middle" : function() {
158
+ var doc = new Document(["12", "34"]);
159
+
160
+ var deltas = [];
161
+ doc.on("change", function(e) { deltas.push(e.data); });
162
+
163
+ doc.insert({row: 0, column: 1}, "aa\nbb\ncc");
164
+ assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
165
+
166
+ var d = deltas.concat();
167
+ doc.revertDeltas(d);
168
+ assert.equal(doc.getValue(), ["12", "34"].join("\n"));
169
+
170
+ doc.applyDeltas(d);
171
+ assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
172
+ },
173
+
174
+ "test: delete in line" : function() {
175
+ var doc = new Document(["1234", "5678"]);
176
+
177
+ var deltas = [];
178
+ doc.on("change", function(e) { deltas.push(e.data); });
179
+
180
+ doc.remove(new Range(0, 1, 0, 3));
181
+ assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
182
+
183
+ var d = deltas.concat();
184
+ doc.revertDeltas(d);
185
+ assert.equal(doc.getValue(), ["1234", "5678"].join("\n"));
186
+
187
+ doc.applyDeltas(d);
188
+ assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
189
+ },
190
+
191
+ "test: delete new line" : function() {
192
+ var doc = new Document(["1234", "5678"]);
193
+
194
+ var deltas = [];
195
+ doc.on("change", function(e) { deltas.push(e.data); });
196
+
197
+ doc.remove(new Range(0, 4, 1, 0));
198
+ assert.equal(doc.getValue(), ["12345678"].join("\n"));
199
+
200
+ var d = deltas.concat();
201
+ doc.revertDeltas(d);
202
+ assert.equal(doc.getValue(), ["1234", "5678"].join("\n"));
203
+
204
+ doc.applyDeltas(d);
205
+ assert.equal(doc.getValue(), ["12345678"].join("\n"));
206
+ },
207
+
208
+ "test: delete multi line range line" : function() {
209
+ var doc = new Document(["1234", "5678", "abcd"]);
210
+
211
+ var deltas = [];
212
+ doc.on("change", function(e) { deltas.push(e.data); });
213
+
214
+ doc.remove(new Range(0, 2, 2, 2));
215
+ assert.equal(doc.getValue(), ["12cd"].join("\n"));
216
+
217
+ var d = deltas.concat();
218
+ doc.revertDeltas(d);
219
+ assert.equal(doc.getValue(), ["1234", "5678", "abcd"].join("\n"));
220
+
221
+ doc.applyDeltas(d);
222
+ assert.equal(doc.getValue(), ["12cd"].join("\n"));
223
+ },
224
+
225
+ "test: delete full lines" : function() {
226
+ var doc = new Document(["1234", "5678", "abcd"]);
227
+
228
+ var deltas = [];
229
+ doc.on("change", function(e) { deltas.push(e.data); });
230
+
231
+ doc.remove(new Range(1, 0, 3, 0));
232
+ assert.equal(doc.getValue(), ["1234", ""].join("\n"));
233
+ },
234
+
235
+ "test: remove lines should return the removed lines" : function() {
236
+ var doc = new Document(["1234", "5678", "abcd"]);
237
+
238
+ var removed = doc.removeLines(1, 2);
239
+ assert.equal(removed.join("\n"), ["5678", "abcd"].join("\n"));
240
+ },
241
+
242
+ "test: should handle unix style new lines" : function() {
243
+ var doc = new Document(["1", "2", "3"]);
244
+ assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
245
+ },
246
+
247
+ "test: should handle windows style new lines" : function() {
248
+ var doc = new Document(["1", "2", "3"].join("\r\n"));
249
+
250
+ doc.setNewLineMode("unix");
251
+ assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
252
+ },
253
+
254
+ "test: set new line mode to 'windows' should use '\\r\\n' as new lines": function() {
255
+ var doc = new Document(["1", "2", "3"].join("\n"));
256
+ doc.setNewLineMode("windows");
257
+ assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n"));
258
+ },
259
+
260
+ "test: set new line mode to 'unix' should use '\\n' as new lines": function() {
261
+ var doc = new Document(["1", "2", "3"].join("\r\n"));
262
+
263
+ doc.setNewLineMode("unix");
264
+ assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
265
+ },
266
+
267
+ "test: set new line mode to 'auto' should detect the incoming nl type": function() {
268
+ var doc = new Document(["1", "2", "3"].join("\n"));
269
+
270
+ doc.setNewLineMode("auto");
271
+ assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
272
+
273
+ var doc = new Document(["1", "2", "3"].join("\r\n"));
274
+
275
+ doc.setNewLineMode("auto");
276
+ assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n"));
277
+
278
+ doc.replace(new Range(0, 0, 2, 1), ["4", "5", "6"].join("\n"));
279
+ assert.equal(["4", "5", "6"].join("\n"), doc.getValue());
280
+ },
281
+
282
+ "test: set value": function() {
283
+ var doc = new Document("1");
284
+ assert.equal("1", doc.getValue());
285
+
286
+ doc.setValue(doc.getValue());
287
+ assert.equal("1", doc.getValue());
288
+
289
+ var doc = new Document("1\n2");
290
+ assert.equal("1\n2", doc.getValue());
291
+
292
+ doc.setValue(doc.getValue());
293
+ assert.equal("1\n2", doc.getValue());
294
+ },
295
+
296
+ "test: empty document has to contain one line": function() {
297
+ var doc = new Document("");
298
+ assert.equal(doc.$lines.length, 1);
299
+ }
300
+ };
301
+
302
+ });
303
+
304
+ if (typeof module !== "undefined" && module === require.main) {
305
+ require("asyncjs").test.testcase(module.exports).exec()
306
+ }
@@ -0,0 +1,2554 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define(function(require, exports, module) {
32
+ "use strict";
33
+
34
+ var oop = require("./lib/oop");
35
+ var lang = require("./lib/lang");
36
+ var config = require("./config");
37
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
38
+ var Selection = require("./selection").Selection;
39
+ var TextMode = require("./mode/text").Mode;
40
+ var Range = require("./range").Range;
41
+ var Document = require("./document").Document;
42
+ var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
43
+ var SearchHighlight = require("./search_highlight").SearchHighlight;
44
+
45
+ /**
46
+ * Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state.
47
+ *
48
+ * `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s.
49
+ * @class EditSession
50
+ **/
51
+
52
+ //{ events
53
+ /**
54
+ *
55
+ * Emitted when the document changes.
56
+ * @event change
57
+ * @param {Object} e An object containing a `delta` of information about the change.
58
+ **/
59
+ /**
60
+ * Emitted when the tab size changes, via [[EditSession.setTabSize]].
61
+ *
62
+ * @event changeTabSize
63
+ **/
64
+ /**
65
+ * Emitted when the ability to overwrite text changes, via [[EditSession.setOverwrite]].
66
+ *
67
+ * @event changeOverwrite
68
+ **/
69
+ /**
70
+ * Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change.
71
+ *
72
+ * @event changeBreakpoint
73
+ **/
74
+ /**
75
+ * Emitted when a front marker changes.
76
+ *
77
+ * @event changeFrontMarker
78
+ **/
79
+ /**
80
+ * Emitted when a back marker changes.
81
+ *
82
+ * @event changeBackMarker
83
+ **/
84
+ /**
85
+ * Emitted when an annotation changes, like through [[EditSession.setAnnotations]].
86
+ *
87
+ * @event changeAnnotation
88
+ **/
89
+ /**
90
+ * Emitted when a background tokenizer asynchronously processes new rows.
91
+ * @event tokenizerUpdate
92
+ *
93
+ * @param {Object} e An object containing one property, `"data"`, that contains information about the changing rows
94
+ *
95
+ **/
96
+ /**
97
+ * Emitted when the current mode changes.
98
+ *
99
+ * @event changeMode
100
+ *
101
+ **/
102
+ /**
103
+ * Emitted when the wrap mode changes.
104
+ *
105
+ * @event changeWrapMode
106
+ *
107
+ **/
108
+ /**
109
+ * Emitted when the wrapping limit changes.
110
+ *
111
+ * @event changeWrapLimit
112
+ *
113
+ **/
114
+ /**
115
+ * Emitted when a code fold is added or removed.
116
+ *
117
+ * @event changeFold
118
+ *
119
+ **/
120
+ /**
121
+ * Emitted when the scroll top changes.
122
+ * @event changeScrollTop
123
+ *
124
+ * @param {Number} scrollTop The new scroll top value
125
+ **/
126
+ /**
127
+ * Emitted when the scroll left changes.
128
+ * @event changeScrollLeft
129
+ *
130
+ * @param {Number} scrollLeft The new scroll left value
131
+ **/
132
+ //}
133
+
134
+ /**
135
+ *
136
+ * Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`.
137
+ * @param {Document | String} text [If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text]{: #textParam}
138
+ * @param {TextMode} mode [The inital language mode to use for the document]{: #modeParam}
139
+ *
140
+ * @constructor
141
+ **/
142
+
143
+ var EditSession = function(text, mode) {
144
+ this.$breakpoints = [];
145
+ this.$decorations = [];
146
+ this.$frontMarkers = {};
147
+ this.$backMarkers = {};
148
+ this.$markerId = 1;
149
+ this.$undoSelect = true;
150
+
151
+ this.$foldData = [];
152
+ this.$foldData.toString = function() {
153
+ return this.join("\n");
154
+ }
155
+ this.on("changeFold", this.onChangeFold.bind(this));
156
+ this.$onChange = this.onChange.bind(this);
157
+
158
+ if (typeof text != "object" || !text.getLine)
159
+ text = new Document(text);
160
+
161
+ this.setDocument(text);
162
+ this.selection = new Selection(this);
163
+
164
+ config.resetOptions(this);
165
+ this.setMode(mode);
166
+ config._signal("session", this);
167
+ };
168
+
169
+
170
+ (function() {
171
+
172
+ oop.implement(this, EventEmitter);
173
+
174
+ /**
175
+ * Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`.
176
+ *
177
+ * @param {Document} doc The new `Document` to use
178
+ *
179
+ **/
180
+ this.setDocument = function(doc) {
181
+ if (this.doc)
182
+ this.doc.removeListener("change", this.$onChange);
183
+
184
+ this.doc = doc;
185
+ doc.on("change", this.$onChange);
186
+
187
+ if (this.bgTokenizer)
188
+ this.bgTokenizer.setDocument(this.getDocument());
189
+
190
+ this.resetCaches();
191
+ };
192
+
193
+ /**
194
+ * Returns the `Document` associated with this session.
195
+ * @return {Document}
196
+ **/
197
+ this.getDocument = function() {
198
+ return this.doc;
199
+ };
200
+
201
+ /**
202
+ * @param {Number} row The row to work with
203
+ *
204
+ **/
205
+ this.$resetRowCache = function(docRow) {
206
+ if (!docRow) {
207
+ this.$docRowCache = [];
208
+ this.$screenRowCache = [];
209
+ return;
210
+ }
211
+ var l = this.$docRowCache.length;
212
+ var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
213
+ if (l > i) {
214
+ this.$docRowCache.splice(i, l);
215
+ this.$screenRowCache.splice(i, l);
216
+ }
217
+ };
218
+
219
+ this.$getRowCacheIndex = function(cacheArray, val) {
220
+ var low = 0;
221
+ var hi = cacheArray.length - 1;
222
+
223
+ while (low <= hi) {
224
+ var mid = (low + hi) >> 1;
225
+ var c = cacheArray[mid];
226
+
227
+ if (val > c)
228
+ low = mid + 1;
229
+ else if (val < c)
230
+ hi = mid - 1;
231
+ else
232
+ return mid;
233
+ }
234
+
235
+ return low -1;
236
+ };
237
+
238
+ this.resetCaches = function() {
239
+ this.$modified = true;
240
+ this.$wrapData = [];
241
+ this.$rowLengthCache = [];
242
+ this.$resetRowCache(0);
243
+ if (this.bgTokenizer)
244
+ this.bgTokenizer.start(0);
245
+ };
246
+
247
+ this.onChangeFold = function(e) {
248
+ var fold = e.data;
249
+ this.$resetRowCache(fold.start.row);
250
+ };
251
+
252
+ this.onChange = function(e) {
253
+ var delta = e.data;
254
+ this.$modified = true;
255
+
256
+ this.$resetRowCache(delta.range.start.row);
257
+
258
+ var removedFolds = this.$updateInternalDataOnChange(e);
259
+ if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
260
+ this.$deltasDoc.push(delta);
261
+ if (removedFolds && removedFolds.length != 0) {
262
+ this.$deltasFold.push({
263
+ action: "removeFolds",
264
+ folds: removedFolds
265
+ });
266
+ }
267
+
268
+ this.$informUndoManager.schedule();
269
+ }
270
+
271
+ this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);
272
+ this._signal("change", e);
273
+ };
274
+
275
+ /**
276
+ * Sets the session text.
277
+ * @param {String} text The new text to place
278
+ *
279
+ **/
280
+ this.setValue = function(text) {
281
+ this.doc.setValue(text);
282
+ this.selection.moveTo(0, 0);
283
+
284
+ this.$resetRowCache(0);
285
+ this.$deltas = [];
286
+ this.$deltasDoc = [];
287
+ this.$deltasFold = [];
288
+ this.setUndoManager(this.$undoManager);
289
+ this.getUndoManager().reset();
290
+ };
291
+
292
+ /**
293
+ * Returns the current [[Document `Document`]] as a string.
294
+ * @method toString
295
+ * @returns {String}
296
+ * @alias EditSession.getValue
297
+ *
298
+ **/
299
+
300
+ /**
301
+ * Returns the current [[Document `Document`]] as a string.
302
+ * @method getValue
303
+ * @returns {String}
304
+ * @alias EditSession.toString
305
+ **/
306
+ this.getValue =
307
+ this.toString = function() {
308
+ return this.doc.getValue();
309
+ };
310
+
311
+ /**
312
+ * Returns the string of the current selection.
313
+ **/
314
+ this.getSelection = function() {
315
+ return this.selection;
316
+ };
317
+
318
+ /**
319
+ * {:BackgroundTokenizer.getState}
320
+ * @param {Number} row The row to start at
321
+ *
322
+ * @related BackgroundTokenizer.getState
323
+ **/
324
+ this.getState = function(row) {
325
+ return this.bgTokenizer.getState(row);
326
+ };
327
+
328
+ /**
329
+ * Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
330
+ * @param {Number} row The row to start at
331
+ *
332
+ *
333
+ *
334
+ **/
335
+ this.getTokens = function(row) {
336
+ return this.bgTokenizer.getTokens(row);
337
+ };
338
+
339
+ /**
340
+ * Returns an object indicating the token at the current row. The object has two properties: `index` and `start`.
341
+ * @param {Number} row The row number to retrieve from
342
+ * @param {Number} column The column number to retrieve from
343
+ *
344
+ *
345
+ **/
346
+ this.getTokenAt = function(row, column) {
347
+ var tokens = this.bgTokenizer.getTokens(row);
348
+ var token, c = 0;
349
+ if (column == null) {
350
+ i = tokens.length - 1;
351
+ c = this.getLine(row).length;
352
+ } else {
353
+ for (var i = 0; i < tokens.length; i++) {
354
+ c += tokens[i].value.length;
355
+ if (c >= column)
356
+ break;
357
+ }
358
+ }
359
+ token = tokens[i];
360
+ if (!token)
361
+ return null;
362
+ token.index = i;
363
+ token.start = c - token.value.length;
364
+ return token;
365
+ };
366
+
367
+ /**
368
+ * Sets the undo manager.
369
+ * @param {UndoManager} undoManager The new undo manager
370
+ *
371
+ *
372
+ **/
373
+ this.setUndoManager = function(undoManager) {
374
+ this.$undoManager = undoManager;
375
+ this.$deltas = [];
376
+ this.$deltasDoc = [];
377
+ this.$deltasFold = [];
378
+
379
+ if (this.$informUndoManager)
380
+ this.$informUndoManager.cancel();
381
+
382
+ if (undoManager) {
383
+ var self = this;
384
+
385
+ this.$syncInformUndoManager = function() {
386
+ self.$informUndoManager.cancel();
387
+
388
+ if (self.$deltasFold.length) {
389
+ self.$deltas.push({
390
+ group: "fold",
391
+ deltas: self.$deltasFold
392
+ });
393
+ self.$deltasFold = [];
394
+ }
395
+
396
+ if (self.$deltasDoc.length) {
397
+ self.$deltas.push({
398
+ group: "doc",
399
+ deltas: self.$deltasDoc
400
+ });
401
+ self.$deltasDoc = [];
402
+ }
403
+
404
+ if (self.$deltas.length > 0) {
405
+ undoManager.execute({
406
+ action: "aceupdate",
407
+ args: [self.$deltas, self],
408
+ merge: self.mergeUndoDeltas
409
+ });
410
+ }
411
+ self.mergeUndoDeltas = false;
412
+ self.$deltas = [];
413
+ };
414
+ this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);
415
+ }
416
+ };
417
+
418
+ /**
419
+ * starts a new group in undo history
420
+ **/
421
+ this.markUndoGroup = function() {
422
+ if (this.$syncInformUndoManager)
423
+ this.$syncInformUndoManager();
424
+ };
425
+
426
+ this.$defaultUndoManager = {
427
+ undo: function() {},
428
+ redo: function() {},
429
+ reset: function() {}
430
+ };
431
+
432
+ /**
433
+ * Returns the current undo manager.
434
+ **/
435
+ this.getUndoManager = function() {
436
+ return this.$undoManager || this.$defaultUndoManager;
437
+ };
438
+
439
+ /**
440
+ * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`.
441
+ **/
442
+ this.getTabString = function() {
443
+ if (this.getUseSoftTabs()) {
444
+ return lang.stringRepeat(" ", this.getTabSize());
445
+ } else {
446
+ return "\t";
447
+ }
448
+ };
449
+
450
+ /**
451
+ /**
452
+ * Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`).
453
+ * @param {Boolean} useSoftTabs Value indicating whether or not to use soft tabs
454
+ **/
455
+ this.setUseSoftTabs = function(val) {
456
+ this.setOption("useSoftTabs", val);
457
+ };
458
+ /**
459
+ * Returns `true` if soft tabs are being used, `false` otherwise.
460
+ * @returns {Boolean}
461
+ **/
462
+ this.getUseSoftTabs = function() {
463
+ // todo might need more general way for changing settings from mode, but this is ok for now
464
+ return this.$useSoftTabs && !this.$mode.$indentWithTabs;
465
+ };
466
+ /**
467
+ * Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event.
468
+ * @param {Number} tabSize The new tab size
469
+ **/
470
+ this.setTabSize = function(tabSize) {
471
+ this.setOption("tabSize", tabSize);
472
+ };
473
+ /**
474
+ * Returns the current tab size.
475
+ **/
476
+ this.getTabSize = function() {
477
+ return this.$tabSize;
478
+ };
479
+
480
+ /**
481
+ * Returns `true` if the character at the position is a soft tab.
482
+ * @param {Object} position The position to check
483
+ *
484
+ *
485
+ **/
486
+ this.isTabStop = function(position) {
487
+ return this.$useSoftTabs && (position.column % this.$tabSize === 0);
488
+ };
489
+
490
+ this.$overwrite = false;
491
+ /**
492
+ * Pass in `true` to enable overwrites in your session, or `false` to disable.
493
+ *
494
+ * 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.
495
+ *
496
+ * @param {Boolean} overwrite Defines wheter or not to set overwrites
497
+ *
498
+ *
499
+ **/
500
+ this.setOverwrite = function(overwrite) {
501
+ this.setOption("overwrite", overwrite);
502
+ };
503
+
504
+ /**
505
+ * Returns `true` if overwrites are enabled; `false` otherwise.
506
+ **/
507
+ this.getOverwrite = function() {
508
+ return this.$overwrite;
509
+ };
510
+
511
+ /**
512
+ * Sets the value of overwrite to the opposite of whatever it currently is.
513
+ **/
514
+ this.toggleOverwrite = function() {
515
+ this.setOverwrite(!this.$overwrite);
516
+ };
517
+
518
+ /**
519
+ * Adds `className` to the `row`, to be used for CSS stylings and whatnot.
520
+ * @param {Number} row The row number
521
+ * @param {String} className The class to add
522
+ *
523
+ *
524
+ **/
525
+ this.addGutterDecoration = function(row, className) {
526
+ if (!this.$decorations[row])
527
+ this.$decorations[row] = "";
528
+ this.$decorations[row] += " " + className;
529
+ this._signal("changeBreakpoint", {});
530
+ };
531
+
532
+ /**
533
+ * Removes `className` from the `row`.
534
+ * @param {Number} row The row number
535
+ * @param {String} className The class to add
536
+ *
537
+ *
538
+ **/
539
+ this.removeGutterDecoration = function(row, className) {
540
+ this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
541
+ this._signal("changeBreakpoint", {});
542
+ };
543
+
544
+ /**
545
+ * Returns an array of numbers, indicating which rows have breakpoints.
546
+ * @returns {[Number]}
547
+ **/
548
+ this.getBreakpoints = function() {
549
+ return this.$breakpoints;
550
+ };
551
+
552
+ /**
553
+ * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
554
+ * @param {Array} rows An array of row indices
555
+ *
556
+ *
557
+ *
558
+ **/
559
+ this.setBreakpoints = function(rows) {
560
+ this.$breakpoints = [];
561
+ for (var i=0; i<rows.length; i++) {
562
+ this.$breakpoints[rows[i]] = "ace_breakpoint";
563
+ }
564
+ this._signal("changeBreakpoint", {});
565
+ };
566
+
567
+ /**
568
+ * Removes all breakpoints on the rows. This function also emites the `'changeBreakpoint'` event.
569
+ **/
570
+ this.clearBreakpoints = function() {
571
+ this.$breakpoints = [];
572
+ this._signal("changeBreakpoint", {});
573
+ };
574
+
575
+ /**
576
+ * Sets a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
577
+ * @param {Number} row A row index
578
+ * @param {String} className Class of the breakpoint
579
+ *
580
+ *
581
+ **/
582
+ this.setBreakpoint = function(row, className) {
583
+ if (className === undefined)
584
+ className = "ace_breakpoint";
585
+ if (className)
586
+ this.$breakpoints[row] = className;
587
+ else
588
+ delete this.$breakpoints[row];
589
+ this._signal("changeBreakpoint", {});
590
+ };
591
+
592
+ /**
593
+ * Removes a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
594
+ * @param {Number} row A row index
595
+ *
596
+ *
597
+ **/
598
+ this.clearBreakpoint = function(row) {
599
+ delete this.$breakpoints[row];
600
+ this._signal("changeBreakpoint", {});
601
+ };
602
+
603
+ /**
604
+ * Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires.
605
+ * @param {Range} range Define the range of the marker
606
+ * @param {String} clazz Set the CSS class for the marker
607
+ * @param {Function | String} type Identify the type of the marker
608
+ * @param {Boolean} inFront Set to `true` to establish a front marker
609
+ *
610
+ *
611
+ * @return {Number} The new marker id
612
+ **/
613
+ this.addMarker = function(range, clazz, type, inFront) {
614
+ var id = this.$markerId++;
615
+
616
+ var marker = {
617
+ range : range,
618
+ type : type || "line",
619
+ renderer: typeof type == "function" ? type : null,
620
+ clazz : clazz,
621
+ inFront: !!inFront,
622
+ id: id
623
+ };
624
+
625
+ if (inFront) {
626
+ this.$frontMarkers[id] = marker;
627
+ this._signal("changeFrontMarker");
628
+ } else {
629
+ this.$backMarkers[id] = marker;
630
+ this._signal("changeBackMarker");
631
+ }
632
+
633
+ return id;
634
+ };
635
+
636
+ /**
637
+ * Adds a dynamic marker to the session.
638
+ * @param {Object} marker object with update method
639
+ * @param {Boolean} inFront Set to `true` to establish a front marker
640
+ *
641
+ *
642
+ * @return {Object} The added marker
643
+ **/
644
+ this.addDynamicMarker = function(marker, inFront) {
645
+ if (!marker.update)
646
+ return;
647
+ var id = this.$markerId++;
648
+ marker.id = id;
649
+ marker.inFront = !!inFront;
650
+
651
+ if (inFront) {
652
+ this.$frontMarkers[id] = marker;
653
+ this._signal("changeFrontMarker");
654
+ } else {
655
+ this.$backMarkers[id] = marker;
656
+ this._signal("changeBackMarker");
657
+ }
658
+
659
+ return marker;
660
+ };
661
+
662
+ /**
663
+ * Removes the marker with the specified ID. If this marker was in front, the `'changeFrontMarker'` event is emitted. If the marker was in the back, the `'changeBackMarker'` event is emitted.
664
+ * @param {Number} markerId A number representing a marker
665
+ *
666
+ *
667
+ *
668
+ **/
669
+ this.removeMarker = function(markerId) {
670
+ var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
671
+ if (!marker)
672
+ return;
673
+
674
+ var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
675
+ if (marker) {
676
+ delete (markers[markerId]);
677
+ this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
678
+ }
679
+ };
680
+
681
+ /**
682
+ * Returns an array containing the IDs of all the markers, either front or back.
683
+ * @param {Boolean} inFront If `true`, indicates you only want front markers; `false` indicates only back markers
684
+ *
685
+ * @returns {Array}
686
+ **/
687
+ this.getMarkers = function(inFront) {
688
+ return inFront ? this.$frontMarkers : this.$backMarkers;
689
+ };
690
+
691
+ this.highlight = function(re) {
692
+ if (!this.$searchHighlight) {
693
+ var highlight = new SearchHighlight(null, "ace_selected-word", "text");
694
+ this.$searchHighlight = this.addDynamicMarker(highlight);
695
+ }
696
+ this.$searchHighlight.setRegexp(re);
697
+ };
698
+
699
+ // experimental
700
+ this.highlightLines = function(startRow, endRow, clazz, inFront) {
701
+ if (typeof endRow != "number") {
702
+ clazz = endRow;
703
+ endRow = startRow;
704
+ }
705
+ if (!clazz)
706
+ clazz = "ace_step";
707
+
708
+ var range = new Range(startRow, 0, endRow, Infinity);
709
+ range.id = this.addMarker(range, clazz, "fullLine", inFront);
710
+ return range;
711
+ };
712
+
713
+ /*
714
+ * Error:
715
+ * {
716
+ * row: 12,
717
+ * column: 2, //can be undefined
718
+ * text: "Missing argument",
719
+ * type: "error" // or "warning" or "info"
720
+ * }
721
+ */
722
+ /**
723
+ * Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
724
+ * @param {Array} annotations A list of annotations
725
+ *
726
+ **/
727
+ this.setAnnotations = function(annotations) {
728
+ this.$annotations = annotations;
729
+ this._signal("changeAnnotation", {});
730
+ };
731
+
732
+ /**
733
+ * Returns the annotations for the `EditSession`.
734
+ * @returns {Array}
735
+ **/
736
+ this.getAnnotations = function() {
737
+ return this.$annotations || [];
738
+ };
739
+
740
+ /**
741
+ * Clears all the annotations for this session. This function also triggers the `'changeAnnotation'` event.
742
+ **/
743
+ this.clearAnnotations = function() {
744
+ this.setAnnotations([]);
745
+ };
746
+
747
+ /**
748
+ * If `text` contains either the newline (`\n`) or carriage-return ('\r') characters, `$autoNewLine` stores that value.
749
+ * @param {String} text A block of text
750
+ *
751
+ *
752
+ **/
753
+ this.$detectNewLine = function(text) {
754
+ var match = text.match(/^.*?(\r?\n)/m);
755
+ if (match) {
756
+ this.$autoNewLine = match[1];
757
+ } else {
758
+ this.$autoNewLine = "\n";
759
+ }
760
+ };
761
+
762
+ /**
763
+ * Given a starting row and column, this method returns the `Range` of the first word boundary it finds.
764
+ * @param {Number} row The row to start at
765
+ * @param {Number} column The column to start at
766
+ *
767
+ * @returns {Range}
768
+ **/
769
+ this.getWordRange = function(row, column) {
770
+ var line = this.getLine(row);
771
+
772
+ var inToken = false;
773
+ if (column > 0)
774
+ inToken = !!line.charAt(column - 1).match(this.tokenRe);
775
+
776
+ if (!inToken)
777
+ inToken = !!line.charAt(column).match(this.tokenRe);
778
+
779
+ if (inToken)
780
+ var re = this.tokenRe;
781
+ else if (/^\s+$/.test(line.slice(column-1, column+1)))
782
+ var re = /\s/;
783
+ else
784
+ var re = this.nonTokenRe;
785
+
786
+ var start = column;
787
+ if (start > 0) {
788
+ do {
789
+ start--;
790
+ }
791
+ while (start >= 0 && line.charAt(start).match(re));
792
+ start++;
793
+ }
794
+
795
+ var end = column;
796
+ while (end < line.length && line.charAt(end).match(re)) {
797
+ end++;
798
+ }
799
+
800
+ return new Range(row, start, row, end);
801
+ };
802
+
803
+ /**
804
+ * Gets the range of a word, including its right whitespace.
805
+ * @param {Number} row The row number to start from
806
+ * @param {Number} column The column number to start from
807
+ *
808
+ * @return {Range}
809
+ **/
810
+ this.getAWordRange = function(row, column) {
811
+ var wordRange = this.getWordRange(row, column);
812
+ var line = this.getLine(wordRange.end.row);
813
+
814
+ while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
815
+ wordRange.end.column += 1;
816
+ }
817
+ return wordRange;
818
+ };
819
+
820
+ /**
821
+ * {:Document.setNewLineMode.desc}
822
+ * @param {String} newLineMode {:Document.setNewLineMode.param}
823
+ *
824
+ *
825
+ * @related Document.setNewLineMode
826
+ **/
827
+ this.setNewLineMode = function(newLineMode) {
828
+ this.doc.setNewLineMode(newLineMode);
829
+ };
830
+
831
+ /**
832
+ *
833
+ * Returns the current new line mode.
834
+ * @returns {String}
835
+ * @related Document.getNewLineMode
836
+ **/
837
+ this.getNewLineMode = function() {
838
+ return this.doc.getNewLineMode();
839
+ };
840
+
841
+ /**
842
+ * Identifies if you want to use a worker for the `EditSession`.
843
+ * @param {Boolean} useWorker Set to `true` to use a worker
844
+ *
845
+ **/
846
+ this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); };
847
+
848
+ /**
849
+ * Returns `true` if workers are being used.
850
+ **/
851
+ this.getUseWorker = function() { return this.$useWorker; };
852
+
853
+ /**
854
+ * Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event.
855
+ **/
856
+ this.onReloadTokenizer = function(e) {
857
+ var rows = e.data;
858
+ this.bgTokenizer.start(rows.first);
859
+ this._signal("tokenizerUpdate", e);
860
+ };
861
+
862
+ this.$modes = {};
863
+
864
+ /**
865
+ * Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted.
866
+ * @param {TextMode} mode Set a new text mode
867
+ * @param {cb} optional callback
868
+ *
869
+ **/
870
+ this.$mode = null;
871
+ this.$modeId = null;
872
+ this.setMode = function(mode, cb) {
873
+ if (mode && typeof mode === "object") {
874
+ if (mode.getTokenizer)
875
+ return this.$onChangeMode(mode);
876
+ var options = mode;
877
+ var path = options.path;
878
+ } else {
879
+ path = mode || "ace/mode/text";
880
+ }
881
+
882
+ // this is needed if ace isn't on require path (e.g tests in node)
883
+ if (!this.$modes["ace/mode/text"])
884
+ this.$modes["ace/mode/text"] = new TextMode();
885
+
886
+ if (this.$modes[path] && !options) {
887
+ this.$onChangeMode(this.$modes[path]);
888
+ cb && cb();
889
+ return;
890
+ }
891
+ // load on demand
892
+ this.$modeId = path;
893
+ config.loadModule(["mode", path], function(m) {
894
+ if (this.$modeId !== path)
895
+ return cb && cb();
896
+ if (this.$modes[path] && !options)
897
+ return this.$onChangeMode(this.$modes[path]);
898
+ if (m && m.Mode) {
899
+ m = new m.Mode(options);
900
+ if (!options) {
901
+ this.$modes[path] = m;
902
+ m.$id = path;
903
+ }
904
+ this.$onChangeMode(m);
905
+ cb && cb();
906
+ }
907
+ }.bind(this));
908
+
909
+ // set mode to text until loading is finished
910
+ if (!this.$mode)
911
+ this.$onChangeMode(this.$modes["ace/mode/text"], true);
912
+ };
913
+
914
+ this.$onChangeMode = function(mode, $isPlaceholder) {
915
+ if (!$isPlaceholder)
916
+ this.$modeId = mode.$id;
917
+ if (this.$mode === mode)
918
+ return;
919
+
920
+ this.$mode = mode;
921
+
922
+ this.$stopWorker();
923
+
924
+ if (this.$useWorker)
925
+ this.$startWorker();
926
+
927
+ var tokenizer = mode.getTokenizer();
928
+
929
+ if(tokenizer.addEventListener !== undefined) {
930
+ var onReloadTokenizer = this.onReloadTokenizer.bind(this);
931
+ tokenizer.addEventListener("update", onReloadTokenizer);
932
+ }
933
+
934
+ if (!this.bgTokenizer) {
935
+ this.bgTokenizer = new BackgroundTokenizer(tokenizer);
936
+ var _self = this;
937
+ this.bgTokenizer.addEventListener("update", function(e) {
938
+ _self._signal("tokenizerUpdate", e);
939
+ });
940
+ } else {
941
+ this.bgTokenizer.setTokenizer(tokenizer);
942
+ }
943
+
944
+ this.bgTokenizer.setDocument(this.getDocument());
945
+
946
+ this.tokenRe = mode.tokenRe;
947
+ this.nonTokenRe = mode.nonTokenRe;
948
+
949
+
950
+ if (!$isPlaceholder) {
951
+ // experimental method, used by c9 findiniles
952
+ if (mode.attachToSession)
953
+ mode.attachToSession(this);
954
+ this.$options.wrapMethod.set.call(this, this.$wrapMethod);
955
+ this.$setFolding(mode.foldingRules);
956
+ this.bgTokenizer.start(0);
957
+ this._emit("changeMode");
958
+ }
959
+ };
960
+
961
+ this.$stopWorker = function() {
962
+ if (this.$worker) {
963
+ this.$worker.terminate();
964
+ this.$worker = null;
965
+ }
966
+ };
967
+
968
+ this.$startWorker = function() {
969
+ try {
970
+ this.$worker = this.$mode.createWorker(this);
971
+ } catch (e) {
972
+ if (typeof console == "object") {
973
+ console.log("Could not load worker");
974
+ console.log(e);
975
+ }
976
+ this.$worker = null;
977
+ }
978
+ };
979
+
980
+ /**
981
+ * Returns the current text mode.
982
+ * @returns {TextMode} The current text mode
983
+ **/
984
+ this.getMode = function() {
985
+ return this.$mode;
986
+ };
987
+
988
+ this.$scrollTop = 0;
989
+ /**
990
+ * This function sets the scroll top value. It also emits the `'changeScrollTop'` event.
991
+ * @param {Number} scrollTop The new scroll top value
992
+ *
993
+ **/
994
+ this.setScrollTop = function(scrollTop) {
995
+ // TODO: should we force integer lineheight instead? scrollTop = Math.round(scrollTop);
996
+ if (this.$scrollTop === scrollTop || isNaN(scrollTop))
997
+ return;
998
+
999
+ this.$scrollTop = scrollTop;
1000
+ this._signal("changeScrollTop", scrollTop);
1001
+ };
1002
+
1003
+ /**
1004
+ * [Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
1005
+ * @returns {Number}
1006
+ **/
1007
+ this.getScrollTop = function() {
1008
+ return this.$scrollTop;
1009
+ };
1010
+
1011
+ this.$scrollLeft = 0;
1012
+ /**
1013
+ * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
1014
+ **/
1015
+ this.setScrollLeft = function(scrollLeft) {
1016
+ // scrollLeft = Math.round(scrollLeft);
1017
+ if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
1018
+ return;
1019
+
1020
+ this.$scrollLeft = scrollLeft;
1021
+ this._signal("changeScrollLeft", scrollLeft);
1022
+ };
1023
+
1024
+ /**
1025
+ * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
1026
+ * @returns {Number}
1027
+ **/
1028
+ this.getScrollLeft = function() {
1029
+ return this.$scrollLeft;
1030
+ };
1031
+
1032
+ /**
1033
+ * Returns the width of the screen.
1034
+ * @returns {Number}
1035
+ **/
1036
+ this.getScreenWidth = function() {
1037
+ this.$computeWidth();
1038
+ if (this.lineWidgets)
1039
+ return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
1040
+ return this.screenWidth;
1041
+ };
1042
+
1043
+ this.getLineWidgetMaxWidth = function() {
1044
+ if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth;
1045
+ var width = 0;
1046
+ this.lineWidgets.forEach(function(w) {
1047
+ if (w && w.screenWidth > width)
1048
+ width = w.screenWidth;
1049
+ });
1050
+ return this.lineWidgetWidth = width;
1051
+ };
1052
+
1053
+ this.$computeWidth = function(force) {
1054
+ if (this.$modified || force) {
1055
+ this.$modified = false;
1056
+
1057
+ if (this.$useWrapMode)
1058
+ return this.screenWidth = this.$wrapLimit;
1059
+
1060
+ var lines = this.doc.getAllLines();
1061
+ var cache = this.$rowLengthCache;
1062
+ var longestScreenLine = 0;
1063
+ var foldIndex = 0;
1064
+ var foldLine = this.$foldData[foldIndex];
1065
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
1066
+ var len = lines.length;
1067
+
1068
+ for (var i = 0; i < len; i++) {
1069
+ if (i > foldStart) {
1070
+ i = foldLine.end.row + 1;
1071
+ if (i >= len)
1072
+ break;
1073
+ foldLine = this.$foldData[foldIndex++];
1074
+ foldStart = foldLine ? foldLine.start.row : Infinity;
1075
+ }
1076
+
1077
+ if (cache[i] == null)
1078
+ cache[i] = this.$getStringScreenWidth(lines[i])[0];
1079
+
1080
+ if (cache[i] > longestScreenLine)
1081
+ longestScreenLine = cache[i];
1082
+ }
1083
+ this.screenWidth = longestScreenLine;
1084
+ }
1085
+ };
1086
+
1087
+ /**
1088
+ * Returns a verbatim copy of the given line as it is in the document
1089
+ * @param {Number} row The row to retrieve from
1090
+ *
1091
+ *
1092
+ * @returns {String}
1093
+ *
1094
+ **/
1095
+ this.getLine = function(row) {
1096
+ return this.doc.getLine(row);
1097
+ };
1098
+
1099
+ /**
1100
+ * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
1101
+ * @param {Number} firstRow The first row index to retrieve
1102
+ * @param {Number} lastRow The final row index to retrieve
1103
+ *
1104
+ * @returns {[String]}
1105
+ *
1106
+ **/
1107
+ this.getLines = function(firstRow, lastRow) {
1108
+ return this.doc.getLines(firstRow, lastRow);
1109
+ };
1110
+
1111
+ /**
1112
+ * Returns the number of rows in the document.
1113
+ * @returns {Number}
1114
+ **/
1115
+ this.getLength = function() {
1116
+ return this.doc.getLength();
1117
+ };
1118
+
1119
+ /**
1120
+ * {:Document.getTextRange.desc}
1121
+ * @param {Range} range The range to work with
1122
+ *
1123
+ * @returns {String}
1124
+ **/
1125
+ this.getTextRange = function(range) {
1126
+ return this.doc.getTextRange(range || this.selection.getRange());
1127
+ };
1128
+
1129
+ /**
1130
+ * Inserts a block of `text` and the indicated `position`.
1131
+ * @param {Object} position The position {row, column} to start inserting at
1132
+ * @param {String} text A chunk of text to insert
1133
+ * @returns {Object} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
1134
+ *
1135
+ *
1136
+ **/
1137
+ this.insert = function(position, text) {
1138
+ return this.doc.insert(position, text);
1139
+ };
1140
+
1141
+ /**
1142
+ * Removes the `range` from the document.
1143
+ * @param {Range} range A specified Range to remove
1144
+ * @returns {Object} The new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
1145
+ *
1146
+ * @related Document.remove
1147
+ *
1148
+ **/
1149
+ this.remove = function(range) {
1150
+ return this.doc.remove(range);
1151
+ };
1152
+
1153
+ /**
1154
+ * Reverts previous changes to your document.
1155
+ * @param {Array} deltas An array of previous changes
1156
+ * @param {Boolean} dontSelect [If `true`, doesn't select the range of where the change occured]{: #dontSelect}
1157
+ *
1158
+ *
1159
+ * @returns {Range}
1160
+ **/
1161
+ this.undoChanges = function(deltas, dontSelect) {
1162
+ if (!deltas.length)
1163
+ return;
1164
+
1165
+ this.$fromUndo = true;
1166
+ var lastUndoRange = null;
1167
+ for (var i = deltas.length - 1; i != -1; i--) {
1168
+ var delta = deltas[i];
1169
+ if (delta.group == "doc") {
1170
+ this.doc.revertDeltas(delta.deltas);
1171
+ lastUndoRange =
1172
+ this.$getUndoSelection(delta.deltas, true, lastUndoRange);
1173
+ } else {
1174
+ delta.deltas.forEach(function(foldDelta) {
1175
+ this.addFolds(foldDelta.folds);
1176
+ }, this);
1177
+ }
1178
+ }
1179
+ this.$fromUndo = false;
1180
+ lastUndoRange &&
1181
+ this.$undoSelect &&
1182
+ !dontSelect &&
1183
+ this.selection.setSelectionRange(lastUndoRange);
1184
+ return lastUndoRange;
1185
+ };
1186
+
1187
+ /**
1188
+ * Re-implements a previously undone change to your document.
1189
+ * @param {Array} deltas An array of previous changes
1190
+ * @param {Boolean} dontSelect {:dontSelect}
1191
+ *
1192
+ *
1193
+ * @returns {Range}
1194
+ **/
1195
+ this.redoChanges = function(deltas, dontSelect) {
1196
+ if (!deltas.length)
1197
+ return;
1198
+
1199
+ this.$fromUndo = true;
1200
+ var lastUndoRange = null;
1201
+ for (var i = 0; i < deltas.length; i++) {
1202
+ var delta = deltas[i];
1203
+ if (delta.group == "doc") {
1204
+ this.doc.applyDeltas(delta.deltas);
1205
+ lastUndoRange =
1206
+ this.$getUndoSelection(delta.deltas, false, lastUndoRange);
1207
+ }
1208
+ }
1209
+ this.$fromUndo = false;
1210
+ lastUndoRange &&
1211
+ this.$undoSelect &&
1212
+ !dontSelect &&
1213
+ this.selection.setSelectionRange(lastUndoRange);
1214
+ return lastUndoRange;
1215
+ };
1216
+
1217
+ /**
1218
+ * Enables or disables highlighting of the range where an undo occured.
1219
+ * @param {Boolean} enable If `true`, selects the range of the reinserted change
1220
+ *
1221
+ **/
1222
+ this.setUndoSelect = function(enable) {
1223
+ this.$undoSelect = enable;
1224
+ };
1225
+
1226
+ this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
1227
+ function isInsert(delta) {
1228
+ var insert =
1229
+ delta.action === "insertText" || delta.action === "insertLines";
1230
+ return isUndo ? !insert : insert;
1231
+ }
1232
+
1233
+ var delta = deltas[0];
1234
+ var range, point;
1235
+ var lastDeltaIsInsert = false;
1236
+ if (isInsert(delta)) {
1237
+ range = Range.fromPoints(delta.range.start, delta.range.end);
1238
+ lastDeltaIsInsert = true;
1239
+ } else {
1240
+ range = Range.fromPoints(delta.range.start, delta.range.start);
1241
+ lastDeltaIsInsert = false;
1242
+ }
1243
+
1244
+ for (var i = 1; i < deltas.length; i++) {
1245
+ delta = deltas[i];
1246
+ if (isInsert(delta)) {
1247
+ point = delta.range.start;
1248
+ if (range.compare(point.row, point.column) == -1) {
1249
+ range.setStart(delta.range.start);
1250
+ }
1251
+ point = delta.range.end;
1252
+ if (range.compare(point.row, point.column) == 1) {
1253
+ range.setEnd(delta.range.end);
1254
+ }
1255
+ lastDeltaIsInsert = true;
1256
+ } else {
1257
+ point = delta.range.start;
1258
+ if (range.compare(point.row, point.column) == -1) {
1259
+ range =
1260
+ Range.fromPoints(delta.range.start, delta.range.start);
1261
+ }
1262
+ lastDeltaIsInsert = false;
1263
+ }
1264
+ }
1265
+
1266
+ // Check if this range and the last undo range has something in common.
1267
+ // If true, merge the ranges.
1268
+ if (lastUndoRange != null) {
1269
+ if (Range.comparePoints(lastUndoRange.start, range.start) === 0) {
1270
+ lastUndoRange.start.column += range.end.column - range.start.column;
1271
+ lastUndoRange.end.column += range.end.column - range.start.column;
1272
+ }
1273
+
1274
+ var cmp = lastUndoRange.compareRange(range);
1275
+ if (cmp == 1) {
1276
+ range.setStart(lastUndoRange.start);
1277
+ } else if (cmp == -1) {
1278
+ range.setEnd(lastUndoRange.end);
1279
+ }
1280
+ }
1281
+
1282
+ return range;
1283
+ };
1284
+
1285
+ /**
1286
+ * Replaces a range in the document with the new `text`.
1287
+ *
1288
+ * @param {Range} range A specified Range to replace
1289
+ * @param {String} text The new text to use as a replacement
1290
+ * @returns {Object} An object containing the final row and column, like this:
1291
+ * ```
1292
+ * {row: endRow, column: 0}
1293
+ * ```
1294
+ * If the text and range are empty, this function returns an object containing the current `range.start` value.
1295
+ * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
1296
+ *
1297
+ *
1298
+ *
1299
+ * @related Document.replace
1300
+ *
1301
+ *
1302
+ **/
1303
+ this.replace = function(range, text) {
1304
+ return this.doc.replace(range, text);
1305
+ };
1306
+
1307
+ /**
1308
+ * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
1309
+ * ```json
1310
+ * { row: newRowLocation, column: newColumnLocation }
1311
+ * ```
1312
+ * @param {Range} fromRange The range of text you want moved within the document
1313
+ * @param {Object} toPosition The location (row and column) where you want to move the text to
1314
+ * @returns {Range} The new range where the text was moved to.
1315
+ *
1316
+ *
1317
+ *
1318
+ **/
1319
+ this.moveText = function(fromRange, toPosition, copy) {
1320
+ var text = this.getTextRange(fromRange);
1321
+ var folds = this.getFoldsInRange(fromRange);
1322
+
1323
+ var toRange = Range.fromPoints(toPosition, toPosition);
1324
+ if (!copy) {
1325
+ this.remove(fromRange);
1326
+ var rowDiff = fromRange.start.row - fromRange.end.row;
1327
+ var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
1328
+ if (collDiff) {
1329
+ if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
1330
+ toRange.start.column += collDiff;
1331
+ if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
1332
+ toRange.end.column += collDiff;
1333
+ }
1334
+ if (rowDiff && toRange.start.row >= fromRange.end.row) {
1335
+ toRange.start.row += rowDiff;
1336
+ toRange.end.row += rowDiff;
1337
+ }
1338
+ }
1339
+
1340
+ toRange.end = this.insert(toRange.start, text);
1341
+ if (folds.length) {
1342
+ var oldStart = fromRange.start;
1343
+ var newStart = toRange.start;
1344
+ var rowDiff = newStart.row - oldStart.row;
1345
+ var collDiff = newStart.column - oldStart.column;
1346
+ this.addFolds(folds.map(function(x) {
1347
+ x = x.clone();
1348
+ if (x.start.row == oldStart.row)
1349
+ x.start.column += collDiff;
1350
+ if (x.end.row == oldStart.row)
1351
+ x.end.column += collDiff;
1352
+ x.start.row += rowDiff;
1353
+ x.end.row += rowDiff;
1354
+ return x;
1355
+ }));
1356
+ }
1357
+
1358
+ return toRange;
1359
+ };
1360
+
1361
+ /**
1362
+ * Indents all the rows, from `startRow` to `endRow` (inclusive), by prefixing each row with the token in `indentString`.
1363
+ *
1364
+ * If `indentString` contains the `'\t'` character, it's replaced by whatever is defined by [[EditSession.getTabString `getTabString()`]].
1365
+ * @param {Number} startRow Starting row
1366
+ * @param {Number} endRow Ending row
1367
+ * @param {String} indentString The indent token
1368
+ *
1369
+ *
1370
+ **/
1371
+ this.indentRows = function(startRow, endRow, indentString) {
1372
+ indentString = indentString.replace(/\t/g, this.getTabString());
1373
+ for (var row=startRow; row<=endRow; row++)
1374
+ this.insert({row: row, column:0}, indentString);
1375
+ };
1376
+
1377
+ /**
1378
+ * Outdents all the rows defined by the `start` and `end` properties of `range`.
1379
+ * @param {Range} range A range of rows
1380
+ *
1381
+ *
1382
+ **/
1383
+ this.outdentRows = function (range) {
1384
+ var rowRange = range.collapseRows();
1385
+ var deleteRange = new Range(0, 0, 0, 0);
1386
+ var size = this.getTabSize();
1387
+
1388
+ for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
1389
+ var line = this.getLine(i);
1390
+
1391
+ deleteRange.start.row = i;
1392
+ deleteRange.end.row = i;
1393
+ for (var j = 0; j < size; ++j)
1394
+ if (line.charAt(j) != ' ')
1395
+ break;
1396
+ if (j < size && line.charAt(j) == '\t') {
1397
+ deleteRange.start.column = j;
1398
+ deleteRange.end.column = j + 1;
1399
+ } else {
1400
+ deleteRange.start.column = 0;
1401
+ deleteRange.end.column = j;
1402
+ }
1403
+ this.remove(deleteRange);
1404
+ }
1405
+ };
1406
+
1407
+ this.$moveLines = function(firstRow, lastRow, dir) {
1408
+ firstRow = this.getRowFoldStart(firstRow);
1409
+ lastRow = this.getRowFoldEnd(lastRow);
1410
+ if (dir < 0) {
1411
+ var row = this.getRowFoldStart(firstRow + dir);
1412
+ if (row < 0) return 0;
1413
+ var diff = row-firstRow;
1414
+ } else if (dir > 0) {
1415
+ var row = this.getRowFoldEnd(lastRow + dir);
1416
+ if (row > this.doc.getLength()-1) return 0;
1417
+ var diff = row-lastRow;
1418
+ } else {
1419
+ firstRow = this.$clipRowToDocument(firstRow);
1420
+ lastRow = this.$clipRowToDocument(lastRow);
1421
+ var diff = lastRow - firstRow + 1;
1422
+ }
1423
+
1424
+ var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
1425
+ var folds = this.getFoldsInRange(range).map(function(x){
1426
+ x = x.clone();
1427
+ x.start.row += diff;
1428
+ x.end.row += diff;
1429
+ return x;
1430
+ });
1431
+
1432
+ var lines = dir == 0
1433
+ ? this.doc.getLines(firstRow, lastRow)
1434
+ : this.doc.removeLines(firstRow, lastRow);
1435
+ this.doc.insertLines(firstRow+diff, lines);
1436
+ folds.length && this.addFolds(folds);
1437
+ return diff;
1438
+ };
1439
+ /**
1440
+ * Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`.
1441
+ * @param {Number} firstRow The starting row to move up
1442
+ * @param {Number} lastRow The final row to move up
1443
+ * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
1444
+ *
1445
+ * @related Document.insertLines
1446
+ *
1447
+ **/
1448
+ this.moveLinesUp = function(firstRow, lastRow) {
1449
+ return this.$moveLines(firstRow, lastRow, -1);
1450
+ };
1451
+
1452
+ /**
1453
+ * Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`.
1454
+ * @param {Number} firstRow The starting row to move down
1455
+ * @param {Number} lastRow The final row to move down
1456
+ * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
1457
+ *
1458
+ * @related Document.insertLines
1459
+ **/
1460
+ this.moveLinesDown = function(firstRow, lastRow) {
1461
+ return this.$moveLines(firstRow, lastRow, 1);
1462
+ };
1463
+
1464
+ /**
1465
+ * Duplicates all the text between `firstRow` and `lastRow`.
1466
+ * @param {Number} firstRow The starting row to duplicate
1467
+ * @param {Number} lastRow The final row to duplicate
1468
+ * @returns {Number} Returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
1469
+ *
1470
+ *
1471
+ **/
1472
+ this.duplicateLines = function(firstRow, lastRow) {
1473
+ return this.$moveLines(firstRow, lastRow, 0);
1474
+ };
1475
+
1476
+
1477
+ this.$clipRowToDocument = function(row) {
1478
+ return Math.max(0, Math.min(row, this.doc.getLength()-1));
1479
+ };
1480
+
1481
+ this.$clipColumnToRow = function(row, column) {
1482
+ if (column < 0)
1483
+ return 0;
1484
+ return Math.min(this.doc.getLine(row).length, column);
1485
+ };
1486
+
1487
+
1488
+ this.$clipPositionToDocument = function(row, column) {
1489
+ column = Math.max(0, column);
1490
+
1491
+ if (row < 0) {
1492
+ row = 0;
1493
+ column = 0;
1494
+ } else {
1495
+ var len = this.doc.getLength();
1496
+ if (row >= len) {
1497
+ row = len - 1;
1498
+ column = this.doc.getLine(len-1).length;
1499
+ } else {
1500
+ column = Math.min(this.doc.getLine(row).length, column);
1501
+ }
1502
+ }
1503
+
1504
+ return {
1505
+ row: row,
1506
+ column: column
1507
+ };
1508
+ };
1509
+
1510
+ this.$clipRangeToDocument = function(range) {
1511
+ if (range.start.row < 0) {
1512
+ range.start.row = 0;
1513
+ range.start.column = 0;
1514
+ } else {
1515
+ range.start.column = this.$clipColumnToRow(
1516
+ range.start.row,
1517
+ range.start.column
1518
+ );
1519
+ }
1520
+
1521
+ var len = this.doc.getLength() - 1;
1522
+ if (range.end.row > len) {
1523
+ range.end.row = len;
1524
+ range.end.column = this.doc.getLine(len).length;
1525
+ } else {
1526
+ range.end.column = this.$clipColumnToRow(
1527
+ range.end.row,
1528
+ range.end.column
1529
+ );
1530
+ }
1531
+ return range;
1532
+ };
1533
+
1534
+ // WRAPMODE
1535
+ this.$wrapLimit = 80;
1536
+ this.$useWrapMode = false;
1537
+ this.$wrapLimitRange = {
1538
+ min : null,
1539
+ max : null
1540
+ };
1541
+
1542
+ /**
1543
+ * Sets whether or not line wrapping is enabled. If `useWrapMode` is different than the current value, the `'changeWrapMode'` event is emitted.
1544
+ * @param {Boolean} useWrapMode Enable (or disable) wrap mode
1545
+ *
1546
+ *
1547
+ **/
1548
+ this.setUseWrapMode = function(useWrapMode) {
1549
+ if (useWrapMode != this.$useWrapMode) {
1550
+ this.$useWrapMode = useWrapMode;
1551
+ this.$modified = true;
1552
+ this.$resetRowCache(0);
1553
+
1554
+ // If wrapMode is activaed, the wrapData array has to be initialized.
1555
+ if (useWrapMode) {
1556
+ var len = this.getLength();
1557
+ this.$wrapData = Array(len);
1558
+ this.$updateWrapData(0, len - 1);
1559
+ }
1560
+
1561
+ this._signal("changeWrapMode");
1562
+ }
1563
+ };
1564
+
1565
+ /**
1566
+ * Returns `true` if wrap mode is being used; `false` otherwise.
1567
+ * @returns {Boolean}
1568
+ **/
1569
+ this.getUseWrapMode = function() {
1570
+ return this.$useWrapMode;
1571
+ };
1572
+
1573
+ // Allow the wrap limit to move freely between min and max. Either
1574
+ // parameter can be null to allow the wrap limit to be unconstrained
1575
+ // in that direction. Or set both parameters to the same number to pin
1576
+ // the limit to that value.
1577
+ /**
1578
+ * Sets the boundaries of wrap. Either value can be `null` to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for `min` or `max` are different, this method also emits the `'changeWrapMode'` event.
1579
+ * @param {Number} min The minimum wrap value (the left side wrap)
1580
+ * @param {Number} max The maximum wrap value (the right side wrap)
1581
+ *
1582
+ *
1583
+ **/
1584
+ this.setWrapLimitRange = function(min, max) {
1585
+ if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
1586
+ this.$wrapLimitRange = {
1587
+ min: min,
1588
+ max: max
1589
+ };
1590
+ this.$modified = true;
1591
+ // This will force a recalculation of the wrap limit
1592
+ this._signal("changeWrapMode");
1593
+ }
1594
+ };
1595
+
1596
+ /**
1597
+ * This should generally only be called by the renderer when a resize is detected.
1598
+ * @param {Number} desiredLimit The new wrap limit
1599
+ * @returns {Boolean}
1600
+ *
1601
+ * @private
1602
+ **/
1603
+ this.adjustWrapLimit = function(desiredLimit, $printMargin) {
1604
+ var limits = this.$wrapLimitRange;
1605
+ if (limits.max < 0)
1606
+ limits = {min: $printMargin, max: $printMargin};
1607
+ var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
1608
+ if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
1609
+ this.$wrapLimit = wrapLimit;
1610
+ this.$modified = true;
1611
+ if (this.$useWrapMode) {
1612
+ this.$updateWrapData(0, this.getLength() - 1);
1613
+ this.$resetRowCache(0);
1614
+ this._signal("changeWrapLimit");
1615
+ }
1616
+ return true;
1617
+ }
1618
+ return false;
1619
+ };
1620
+
1621
+ this.$constrainWrapLimit = function(wrapLimit, min, max) {
1622
+ if (min)
1623
+ wrapLimit = Math.max(min, wrapLimit);
1624
+
1625
+ if (max)
1626
+ wrapLimit = Math.min(max, wrapLimit);
1627
+
1628
+ return wrapLimit;
1629
+ };
1630
+
1631
+ /**
1632
+ * Returns the value of wrap limit.
1633
+ * @returns {Number} The wrap limit.
1634
+ **/
1635
+ this.getWrapLimit = function() {
1636
+ return this.$wrapLimit;
1637
+ };
1638
+
1639
+ /**
1640
+ * Sets the line length for soft wrap in the editor. Lines will break
1641
+ * at a minimum of the given length minus 20 chars and at a maximum
1642
+ * of the given number of chars.
1643
+ * @param {number} limit The maximum line length in chars, for soft wrapping lines.
1644
+ */
1645
+ this.setWrapLimit = function (limit) {
1646
+ this.setWrapLimitRange(limit, limit);
1647
+ };
1648
+
1649
+ /**
1650
+ * Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
1651
+ *
1652
+ * { min: wrapLimitRange_min, max: wrapLimitRange_max }
1653
+ *
1654
+ * @returns {Object}
1655
+ **/
1656
+ this.getWrapLimitRange = function() {
1657
+ // Avoid unexpected mutation by returning a copy
1658
+ return {
1659
+ min : this.$wrapLimitRange.min,
1660
+ max : this.$wrapLimitRange.max
1661
+ };
1662
+ };
1663
+
1664
+ this.$updateInternalDataOnChange = function(e) {
1665
+ var useWrapMode = this.$useWrapMode;
1666
+ var len;
1667
+ var action = e.data.action;
1668
+ var firstRow = e.data.range.start.row;
1669
+ var lastRow = e.data.range.end.row;
1670
+ var start = e.data.range.start;
1671
+ var end = e.data.range.end;
1672
+ var removedFolds = null;
1673
+
1674
+ if (action.indexOf("Lines") != -1) {
1675
+ if (action == "insertLines") {
1676
+ lastRow = firstRow + (e.data.lines.length);
1677
+ } else {
1678
+ lastRow = firstRow;
1679
+ }
1680
+ len = e.data.lines ? e.data.lines.length : lastRow - firstRow;
1681
+ } else {
1682
+ len = lastRow - firstRow;
1683
+ }
1684
+
1685
+ this.$updating = true;
1686
+ if (len != 0) {
1687
+ if (action.indexOf("remove") != -1) {
1688
+ this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
1689
+
1690
+ var foldLines = this.$foldData;
1691
+ removedFolds = this.getFoldsInRange(e.data.range);
1692
+ this.removeFolds(removedFolds);
1693
+
1694
+ var foldLine = this.getFoldLine(end.row);
1695
+ var idx = 0;
1696
+ if (foldLine) {
1697
+ foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
1698
+ foldLine.shiftRow(-len);
1699
+
1700
+ var foldLineBefore = this.getFoldLine(firstRow);
1701
+ if (foldLineBefore && foldLineBefore !== foldLine) {
1702
+ foldLineBefore.merge(foldLine);
1703
+ foldLine = foldLineBefore;
1704
+ }
1705
+ idx = foldLines.indexOf(foldLine) + 1;
1706
+ }
1707
+
1708
+ for (idx; idx < foldLines.length; idx++) {
1709
+ var foldLine = foldLines[idx];
1710
+ if (foldLine.start.row >= end.row) {
1711
+ foldLine.shiftRow(-len);
1712
+ }
1713
+ }
1714
+
1715
+ lastRow = firstRow;
1716
+ } else {
1717
+ var args = Array(len);
1718
+ args.unshift(firstRow, 0);
1719
+ var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache
1720
+ arr.splice.apply(arr, args);
1721
+
1722
+ // If some new line is added inside of a foldLine, then split
1723
+ // the fold line up.
1724
+ var foldLines = this.$foldData;
1725
+ var foldLine = this.getFoldLine(firstRow);
1726
+ var idx = 0;
1727
+ if (foldLine) {
1728
+ var cmp = foldLine.range.compareInside(start.row, start.column);
1729
+ // Inside of the foldLine range. Need to split stuff up.
1730
+ if (cmp == 0) {
1731
+ foldLine = foldLine.split(start.row, start.column);
1732
+ if (foldLine) {
1733
+ foldLine.shiftRow(len);
1734
+ foldLine.addRemoveChars(lastRow, 0, end.column - start.column);
1735
+ }
1736
+ } else
1737
+ // Infront of the foldLine but same row. Need to shift column.
1738
+ if (cmp == -1) {
1739
+ foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
1740
+ foldLine.shiftRow(len);
1741
+ }
1742
+ // Nothing to do if the insert is after the foldLine.
1743
+ idx = foldLines.indexOf(foldLine) + 1;
1744
+ }
1745
+
1746
+ for (idx; idx < foldLines.length; idx++) {
1747
+ var foldLine = foldLines[idx];
1748
+ if (foldLine.start.row >= firstRow) {
1749
+ foldLine.shiftRow(len);
1750
+ }
1751
+ }
1752
+ }
1753
+ } else {
1754
+ // Realign folds. E.g. if you add some new chars before a fold, the
1755
+ // fold should "move" to the right.
1756
+ len = Math.abs(e.data.range.start.column - e.data.range.end.column);
1757
+ if (action.indexOf("remove") != -1) {
1758
+ // Get all the folds in the change range and remove them.
1759
+ removedFolds = this.getFoldsInRange(e.data.range);
1760
+ this.removeFolds(removedFolds);
1761
+
1762
+ len = -len;
1763
+ }
1764
+ var foldLine = this.getFoldLine(firstRow);
1765
+ if (foldLine) {
1766
+ foldLine.addRemoveChars(firstRow, start.column, len);
1767
+ }
1768
+ }
1769
+
1770
+ if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
1771
+ console.error("doc.getLength() and $wrapData.length have to be the same!");
1772
+ }
1773
+ this.$updating = false;
1774
+
1775
+ if (useWrapMode)
1776
+ this.$updateWrapData(firstRow, lastRow);
1777
+ else
1778
+ this.$updateRowLengthCache(firstRow, lastRow);
1779
+
1780
+ return removedFolds;
1781
+ };
1782
+
1783
+ this.$updateRowLengthCache = function(firstRow, lastRow, b) {
1784
+ this.$rowLengthCache[firstRow] = null;
1785
+ this.$rowLengthCache[lastRow] = null;
1786
+ };
1787
+
1788
+ this.$updateWrapData = function(firstRow, lastRow) {
1789
+ var lines = this.doc.getAllLines();
1790
+ var tabSize = this.getTabSize();
1791
+ var wrapData = this.$wrapData;
1792
+ var wrapLimit = this.$wrapLimit;
1793
+ var tokens;
1794
+ var foldLine;
1795
+
1796
+ var row = firstRow;
1797
+ lastRow = Math.min(lastRow, lines.length - 1);
1798
+ while (row <= lastRow) {
1799
+ foldLine = this.getFoldLine(row, foldLine);
1800
+ if (!foldLine) {
1801
+ tokens = this.$getDisplayTokens(lines[row]);
1802
+ wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
1803
+ row ++;
1804
+ } else {
1805
+ tokens = [];
1806
+ foldLine.walk(function(placeholder, row, column, lastColumn) {
1807
+ var walkTokens;
1808
+ if (placeholder != null) {
1809
+ walkTokens = this.$getDisplayTokens(
1810
+ placeholder, tokens.length);
1811
+ walkTokens[0] = PLACEHOLDER_START;
1812
+ for (var i = 1; i < walkTokens.length; i++) {
1813
+ walkTokens[i] = PLACEHOLDER_BODY;
1814
+ }
1815
+ } else {
1816
+ walkTokens = this.$getDisplayTokens(
1817
+ lines[row].substring(lastColumn, column),
1818
+ tokens.length);
1819
+ }
1820
+ tokens = tokens.concat(walkTokens);
1821
+ }.bind(this),
1822
+ foldLine.end.row,
1823
+ lines[foldLine.end.row].length + 1
1824
+ );
1825
+
1826
+ wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
1827
+ row = foldLine.end.row + 1;
1828
+ }
1829
+ }
1830
+ };
1831
+
1832
+ // "Tokens"
1833
+ var CHAR = 1,
1834
+ CHAR_EXT = 2,
1835
+ PLACEHOLDER_START = 3,
1836
+ PLACEHOLDER_BODY = 4,
1837
+ PUNCTUATION = 9,
1838
+ SPACE = 10,
1839
+ TAB = 11,
1840
+ TAB_SPACE = 12;
1841
+
1842
+
1843
+ this.$computeWrapSplits = function(tokens, wrapLimit) {
1844
+ if (tokens.length == 0) {
1845
+ return [];
1846
+ }
1847
+
1848
+ var splits = [];
1849
+ var displayLength = tokens.length;
1850
+ var lastSplit = 0, lastDocSplit = 0;
1851
+
1852
+ var isCode = this.$wrapAsCode;
1853
+
1854
+ function addSplit(screenPos) {
1855
+ var displayed = tokens.slice(lastSplit, screenPos);
1856
+
1857
+ // The document size is the current size - the extra width for tabs
1858
+ // and multipleWidth characters.
1859
+ var len = displayed.length;
1860
+ displayed.join("").
1861
+ // Get all the TAB_SPACEs.
1862
+ replace(/12/g, function() {
1863
+ len -= 1;
1864
+ }).
1865
+ // Get all the CHAR_EXT/multipleWidth characters.
1866
+ replace(/2/g, function() {
1867
+ len -= 1;
1868
+ });
1869
+
1870
+ lastDocSplit += len;
1871
+ splits.push(lastDocSplit);
1872
+ lastSplit = screenPos;
1873
+ }
1874
+
1875
+ while (displayLength - lastSplit > wrapLimit) {
1876
+ // This is, where the split should be.
1877
+ var split = lastSplit + wrapLimit;
1878
+
1879
+ // If there is a space or tab at this split position, then making
1880
+ // a split is simple.
1881
+ if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {
1882
+ /* disabled see https://github.com/ajaxorg/ace/issues/1186
1883
+ // Include all following spaces + tabs in this split as well.
1884
+ while (tokens[split] >= SPACE) {
1885
+ split ++;
1886
+ } */
1887
+ addSplit(split);
1888
+ continue;
1889
+ }
1890
+
1891
+ // === ELSE ===
1892
+ // Check if split is inside of a placeholder. Placeholder are
1893
+ // not splitable. Therefore, seek the beginning of the placeholder
1894
+ // and try to place the split beofre the placeholder's start.
1895
+ if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {
1896
+ // Seek the start of the placeholder and do the split
1897
+ // before the placeholder. By definition there always
1898
+ // a PLACEHOLDER_START between split and lastSplit.
1899
+ for (split; split != lastSplit - 1; split--) {
1900
+ if (tokens[split] == PLACEHOLDER_START) {
1901
+ // split++; << No incremental here as we want to
1902
+ // have the position before the Placeholder.
1903
+ break;
1904
+ }
1905
+ }
1906
+
1907
+ // If the PLACEHOLDER_START is not the index of the
1908
+ // last split, then we can do the split
1909
+ if (split > lastSplit) {
1910
+ addSplit(split);
1911
+ continue;
1912
+ }
1913
+
1914
+ // If the PLACEHOLDER_START IS the index of the last
1915
+ // split, then we have to place the split after the
1916
+ // placeholder. So, let's seek for the end of the placeholder.
1917
+ split = lastSplit + wrapLimit;
1918
+ for (split; split < tokens.length; split++) {
1919
+ if (tokens[split] != PLACEHOLDER_BODY) {
1920
+ break;
1921
+ }
1922
+ }
1923
+
1924
+ // If spilt == tokens.length, then the placeholder is the last
1925
+ // thing in the line and adding a new split doesn't make sense.
1926
+ if (split == tokens.length) {
1927
+ break; // Breaks the while-loop.
1928
+ }
1929
+
1930
+ // Finally, add the split...
1931
+ addSplit(split);
1932
+ continue;
1933
+ }
1934
+
1935
+ // === ELSE ===
1936
+ // Search for the first non space/tab/placeholder/punctuation token backwards.
1937
+ var minSplit = Math.max(split - (isCode ? 10 : wrapLimit-(wrapLimit>>2)), lastSplit - 1);
1938
+ while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
1939
+ split --;
1940
+ }
1941
+ if (isCode) {
1942
+ while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
1943
+ split --;
1944
+ }
1945
+ while (split > minSplit && tokens[split] == PUNCTUATION) {
1946
+ split --;
1947
+ }
1948
+ } else {
1949
+ while (split > minSplit && tokens[split] < SPACE) {
1950
+ split --;
1951
+ }
1952
+ }
1953
+ // If we found one, then add the split.
1954
+ if (split > minSplit) {
1955
+ addSplit(++split);
1956
+ continue;
1957
+ }
1958
+
1959
+ // === ELSE ===
1960
+ split = lastSplit + wrapLimit;
1961
+ // The split is inside of a CHAR or CHAR_EXT token and no space
1962
+ // around -> force a split.
1963
+ if (tokens[split] == CHAR_EXT)
1964
+ split--;
1965
+ addSplit(split);
1966
+ }
1967
+ return splits;
1968
+ };
1969
+
1970
+ /**
1971
+ * Given a string, returns an array of the display characters, including tabs and spaces.
1972
+ * @param {String} str The string to check
1973
+ * @param {Number} offset The value to start at
1974
+ *
1975
+ *
1976
+ **/
1977
+ this.$getDisplayTokens = function(str, offset) {
1978
+ var arr = [];
1979
+ var tabSize;
1980
+ offset = offset || 0;
1981
+
1982
+ for (var i = 0; i < str.length; i++) {
1983
+ var c = str.charCodeAt(i);
1984
+ // Tab
1985
+ if (c == 9) {
1986
+ tabSize = this.getScreenTabSize(arr.length + offset);
1987
+ arr.push(TAB);
1988
+ for (var n = 1; n < tabSize; n++) {
1989
+ arr.push(TAB_SPACE);
1990
+ }
1991
+ }
1992
+ // Space
1993
+ else if (c == 32) {
1994
+ arr.push(SPACE);
1995
+ } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
1996
+ arr.push(PUNCTUATION);
1997
+ }
1998
+ // full width characters
1999
+ else if (c >= 0x1100 && isFullWidth(c)) {
2000
+ arr.push(CHAR, CHAR_EXT);
2001
+ } else {
2002
+ arr.push(CHAR);
2003
+ }
2004
+ }
2005
+ return arr;
2006
+ };
2007
+
2008
+ /**
2009
+ * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen.
2010
+ * @param {String} str The string to calculate the screen width of
2011
+ * @param {Number} maxScreenColumn
2012
+ * @param {Number} screenColumn
2013
+ * @returns {[Number]} Returns an `int[]` array with two elements:<br/>
2014
+ * The first position indicates the number of columns for `str` on screen.<br/>
2015
+ * The second value contains the position of the document column that this function read until.
2016
+ *
2017
+ **/
2018
+ this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
2019
+ if (maxScreenColumn == 0)
2020
+ return [0, 0];
2021
+ if (maxScreenColumn == null)
2022
+ maxScreenColumn = Infinity;
2023
+ screenColumn = screenColumn || 0;
2024
+
2025
+ var c, column;
2026
+ for (column = 0; column < str.length; column++) {
2027
+ c = str.charCodeAt(column);
2028
+ // tab
2029
+ if (c == 9) {
2030
+ screenColumn += this.getScreenTabSize(screenColumn);
2031
+ }
2032
+ // full width characters
2033
+ else if (c >= 0x1100 && isFullWidth(c)) {
2034
+ screenColumn += 2;
2035
+ } else {
2036
+ screenColumn += 1;
2037
+ }
2038
+ if (screenColumn > maxScreenColumn) {
2039
+ break;
2040
+ }
2041
+ }
2042
+
2043
+ return [screenColumn, column];
2044
+ };
2045
+
2046
+ this.lineWidgets = null;
2047
+ /**
2048
+ * Returns number of screenrows in a wrapped line.
2049
+ * @param {Number} row The row number to check
2050
+ *
2051
+ * @returns {Number}
2052
+ **/
2053
+ this.getRowLength = function(row) {
2054
+ if (this.lineWidgets)
2055
+ var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
2056
+ else
2057
+ h = 0
2058
+ if (!this.$useWrapMode || !this.$wrapData[row]) {
2059
+ return 1 + h;
2060
+ } else {
2061
+ return this.$wrapData[row].length + 1 + h;
2062
+ }
2063
+ };
2064
+ this.getRowLineCount = function(row) {
2065
+ if (!this.$useWrapMode || !this.$wrapData[row]) {
2066
+ return 1;
2067
+ } else {
2068
+ return this.$wrapData[row].length + 1;
2069
+ }
2070
+ };
2071
+
2072
+ /**
2073
+ * Returns the position (on screen) for the last character in the provided screen row.
2074
+ * @param {Number} screenRow The screen row to check
2075
+ * @returns {Number}
2076
+ *
2077
+ * @related EditSession.documentToScreenColumn
2078
+ **/
2079
+ this.getScreenLastRowColumn = function(screenRow) {
2080
+ var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
2081
+ return this.documentToScreenColumn(pos.row, pos.column);
2082
+ };
2083
+
2084
+ /**
2085
+ * For the given document row and column, this returns the column position of the last screen row.
2086
+ * @param {Number} docRow
2087
+ *
2088
+ * @param {Number} docColumn
2089
+ **/
2090
+ this.getDocumentLastRowColumn = function(docRow, docColumn) {
2091
+ var screenRow = this.documentToScreenRow(docRow, docColumn);
2092
+ return this.getScreenLastRowColumn(screenRow);
2093
+ };
2094
+
2095
+ /**
2096
+ * For the given document row and column, this returns the document position of the last row.
2097
+ * @param {Number} docRow
2098
+ * @param {Number} docColumn
2099
+ *
2100
+ *
2101
+ **/
2102
+ this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
2103
+ var screenRow = this.documentToScreenRow(docRow, docColumn);
2104
+ return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
2105
+ };
2106
+
2107
+ /**
2108
+ * For the given row, this returns the split data.
2109
+ * @returns {String}
2110
+ **/
2111
+ this.getRowSplitData = function(row) {
2112
+ if (!this.$useWrapMode) {
2113
+ return undefined;
2114
+ } else {
2115
+ return this.$wrapData[row];
2116
+ }
2117
+ };
2118
+
2119
+ /**
2120
+ * The distance to the next tab stop at the specified screen column.
2121
+ * @param {Number} screenColumn The screen column to check
2122
+ *
2123
+ *
2124
+ * @returns {Number}
2125
+ **/
2126
+ this.getScreenTabSize = function(screenColumn) {
2127
+ return this.$tabSize - screenColumn % this.$tabSize;
2128
+ };
2129
+
2130
+
2131
+ this.screenToDocumentRow = function(screenRow, screenColumn) {
2132
+ return this.screenToDocumentPosition(screenRow, screenColumn).row;
2133
+ };
2134
+
2135
+
2136
+ this.screenToDocumentColumn = function(screenRow, screenColumn) {
2137
+ return this.screenToDocumentPosition(screenRow, screenColumn).column;
2138
+ };
2139
+
2140
+ /**
2141
+ * Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
2142
+ * @param {Number} screenRow The screen row to check
2143
+ * @param {Number} screenColumn The screen column to check
2144
+ * @returns {Object} The object returned has two properties: `row` and `column`.
2145
+ *
2146
+ *
2147
+ * @related EditSession.documentToScreenPosition
2148
+ *
2149
+ **/
2150
+ this.screenToDocumentPosition = function(screenRow, screenColumn) {
2151
+ if (screenRow < 0)
2152
+ return {row: 0, column: 0};
2153
+
2154
+ var line;
2155
+ var docRow = 0;
2156
+ var docColumn = 0;
2157
+ var column;
2158
+ var row = 0;
2159
+ var rowLength = 0;
2160
+
2161
+ var rowCache = this.$screenRowCache;
2162
+ var i = this.$getRowCacheIndex(rowCache, screenRow);
2163
+ var l = rowCache.length;
2164
+ if (l && i >= 0) {
2165
+ var row = rowCache[i];
2166
+ var docRow = this.$docRowCache[i];
2167
+ var doCache = screenRow > rowCache[l - 1];
2168
+ } else {
2169
+ var doCache = !l;
2170
+ }
2171
+
2172
+ var maxRow = this.getLength() - 1;
2173
+ var foldLine = this.getNextFoldLine(docRow);
2174
+ var foldStart = foldLine ? foldLine.start.row : Infinity;
2175
+
2176
+ while (row <= screenRow) {
2177
+ rowLength = this.getRowLength(docRow);
2178
+ if (row + rowLength > screenRow || docRow >= maxRow) {
2179
+ break;
2180
+ } else {
2181
+ row += rowLength;
2182
+ docRow++;
2183
+ if (docRow > foldStart) {
2184
+ docRow = foldLine.end.row+1;
2185
+ foldLine = this.getNextFoldLine(docRow, foldLine);
2186
+ foldStart = foldLine ? foldLine.start.row : Infinity;
2187
+ }
2188
+ }
2189
+
2190
+ if (doCache) {
2191
+ this.$docRowCache.push(docRow);
2192
+ this.$screenRowCache.push(row);
2193
+ }
2194
+ }
2195
+
2196
+ if (foldLine && foldLine.start.row <= docRow) {
2197
+ line = this.getFoldDisplayLine(foldLine);
2198
+ docRow = foldLine.start.row;
2199
+ } else if (row + rowLength <= screenRow || docRow > maxRow) {
2200
+ // clip at the end of the document
2201
+ return {
2202
+ row: maxRow,
2203
+ column: this.getLine(maxRow).length
2204
+ };
2205
+ } else {
2206
+ line = this.getLine(docRow);
2207
+ foldLine = null;
2208
+ }
2209
+
2210
+ if (this.$useWrapMode) {
2211
+ var splits = this.$wrapData[docRow];
2212
+ if (splits) {
2213
+ var splitIndex = Math.floor(screenRow - row);
2214
+ column = splits[splitIndex];
2215
+ if(splitIndex > 0 && splits.length) {
2216
+ docColumn = splits[splitIndex - 1] || splits[splits.length - 1];
2217
+ line = line.substring(docColumn);
2218
+ }
2219
+ }
2220
+ }
2221
+
2222
+ docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
2223
+
2224
+ // We remove one character at the end so that the docColumn
2225
+ // position returned is not associated to the next row on the screen.
2226
+ if (this.$useWrapMode && docColumn >= column)
2227
+ docColumn = column - 1;
2228
+
2229
+ if (foldLine)
2230
+ return foldLine.idxToPosition(docColumn);
2231
+
2232
+ return {row: docRow, column: docColumn};
2233
+ };
2234
+
2235
+ /**
2236
+ * Converts document coordinates to screen coordinates. {:conversionConsiderations}
2237
+ * @param {Number} docRow The document row to check
2238
+ * @param {Number} docColumn The document column to check
2239
+ * @returns {Object} The object returned by this method has two properties: `row` and `column`.
2240
+ *
2241
+ *
2242
+ * @related EditSession.screenToDocumentPosition
2243
+ *
2244
+ **/
2245
+ this.documentToScreenPosition = function(docRow, docColumn) {
2246
+ // Normalize the passed in arguments.
2247
+ if (typeof docColumn === "undefined")
2248
+ var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
2249
+ else
2250
+ pos = this.$clipPositionToDocument(docRow, docColumn);
2251
+
2252
+ docRow = pos.row;
2253
+ docColumn = pos.column;
2254
+
2255
+ var screenRow = 0;
2256
+ var foldStartRow = null;
2257
+ var fold = null;
2258
+
2259
+ // Clamp the docRow position in case it's inside of a folded block.
2260
+ fold = this.getFoldAt(docRow, docColumn, 1);
2261
+ if (fold) {
2262
+ docRow = fold.start.row;
2263
+ docColumn = fold.start.column;
2264
+ }
2265
+
2266
+ var rowEnd, row = 0;
2267
+
2268
+
2269
+ var rowCache = this.$docRowCache;
2270
+ var i = this.$getRowCacheIndex(rowCache, docRow);
2271
+ var l = rowCache.length;
2272
+ if (l && i >= 0) {
2273
+ var row = rowCache[i];
2274
+ var screenRow = this.$screenRowCache[i];
2275
+ var doCache = docRow > rowCache[l - 1];
2276
+ } else {
2277
+ var doCache = !l;
2278
+ }
2279
+
2280
+ var foldLine = this.getNextFoldLine(row);
2281
+ var foldStart = foldLine ?foldLine.start.row :Infinity;
2282
+
2283
+ while (row < docRow) {
2284
+ if (row >= foldStart) {
2285
+ rowEnd = foldLine.end.row + 1;
2286
+ if (rowEnd > docRow)
2287
+ break;
2288
+ foldLine = this.getNextFoldLine(rowEnd, foldLine);
2289
+ foldStart = foldLine ?foldLine.start.row :Infinity;
2290
+ }
2291
+ else {
2292
+ rowEnd = row + 1;
2293
+ }
2294
+
2295
+ screenRow += this.getRowLength(row);
2296
+ row = rowEnd;
2297
+
2298
+ if (doCache) {
2299
+ this.$docRowCache.push(row);
2300
+ this.$screenRowCache.push(screenRow);
2301
+ }
2302
+ }
2303
+
2304
+ // Calculate the text line that is displayed in docRow on the screen.
2305
+ var textLine = "";
2306
+ // Check if the final row we want to reach is inside of a fold.
2307
+ if (foldLine && row >= foldStart) {
2308
+ textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
2309
+ foldStartRow = foldLine.start.row;
2310
+ } else {
2311
+ textLine = this.getLine(docRow).substring(0, docColumn);
2312
+ foldStartRow = docRow;
2313
+ }
2314
+ // Clamp textLine if in wrapMode.
2315
+ if (this.$useWrapMode) {
2316
+ var wrapRow = this.$wrapData[foldStartRow];
2317
+ if (wrapRow) {
2318
+ var screenRowOffset = 0;
2319
+ while (textLine.length >= wrapRow[screenRowOffset]) {
2320
+ screenRow ++;
2321
+ screenRowOffset++;
2322
+ }
2323
+ textLine = textLine.substring(
2324
+ wrapRow[screenRowOffset - 1] || 0, textLine.length
2325
+ );
2326
+ }
2327
+ }
2328
+
2329
+ return {
2330
+ row: screenRow,
2331
+ column: this.$getStringScreenWidth(textLine)[0]
2332
+ };
2333
+ };
2334
+
2335
+ /**
2336
+ * For the given document row and column, returns the screen column.
2337
+ * @param {Number} row
2338
+ * @param {Number} docColumn
2339
+ * @returns {Number}
2340
+ *
2341
+ **/
2342
+ this.documentToScreenColumn = function(row, docColumn) {
2343
+ return this.documentToScreenPosition(row, docColumn).column;
2344
+ };
2345
+
2346
+ /**
2347
+ * For the given document row and column, returns the screen row.
2348
+ * @param {Number} docRow
2349
+ * @param {Number} docColumn
2350
+ *
2351
+ *
2352
+ **/
2353
+ this.documentToScreenRow = function(docRow, docColumn) {
2354
+ return this.documentToScreenPosition(docRow, docColumn).row;
2355
+ };
2356
+
2357
+ /**
2358
+ * Returns the length of the screen.
2359
+ * @returns {Number}
2360
+ **/
2361
+ this.getScreenLength = function() {
2362
+ var screenRows = 0;
2363
+ var fold = null;
2364
+ if (!this.$useWrapMode) {
2365
+ screenRows = this.getLength();
2366
+
2367
+ // Remove the folded lines again.
2368
+ var foldData = this.$foldData;
2369
+ for (var i = 0; i < foldData.length; i++) {
2370
+ fold = foldData[i];
2371
+ screenRows -= fold.end.row - fold.start.row;
2372
+ }
2373
+ } else {
2374
+ var lastRow = this.$wrapData.length;
2375
+ var row = 0, i = 0;
2376
+ var fold = this.$foldData[i++];
2377
+ var foldStart = fold ? fold.start.row :Infinity;
2378
+
2379
+ while (row < lastRow) {
2380
+ var splits = this.$wrapData[row];
2381
+ screenRows += splits ? splits.length + 1 : 1;
2382
+ row ++;
2383
+ if (row > foldStart) {
2384
+ row = fold.end.row+1;
2385
+ fold = this.$foldData[i++];
2386
+ foldStart = fold ?fold.start.row :Infinity;
2387
+ }
2388
+ }
2389
+ }
2390
+
2391
+ // todo
2392
+ if (this.lineWidgets)
2393
+ screenRows += this.$getWidgetScreenLength();
2394
+
2395
+ return screenRows;
2396
+ };
2397
+
2398
+ /**
2399
+ * @private
2400
+ *
2401
+ */
2402
+ this.$setFontMetrics = function(fm) {
2403
+ // todo
2404
+ };
2405
+
2406
+ this.destroy = function() {
2407
+ if (this.bgTokenizer) {
2408
+ this.bgTokenizer.setDocument(null);
2409
+ this.bgTokenizer = null;
2410
+ }
2411
+ this.$stopWorker();
2412
+ };
2413
+
2414
+ // For every keystroke this gets called once per char in the whole doc!!
2415
+ // Wouldn't hurt to make it a bit faster for c >= 0x1100
2416
+ function isFullWidth(c) {
2417
+ if (c < 0x1100)
2418
+ return false;
2419
+ return c >= 0x1100 && c <= 0x115F ||
2420
+ c >= 0x11A3 && c <= 0x11A7 ||
2421
+ c >= 0x11FA && c <= 0x11FF ||
2422
+ c >= 0x2329 && c <= 0x232A ||
2423
+ c >= 0x2E80 && c <= 0x2E99 ||
2424
+ c >= 0x2E9B && c <= 0x2EF3 ||
2425
+ c >= 0x2F00 && c <= 0x2FD5 ||
2426
+ c >= 0x2FF0 && c <= 0x2FFB ||
2427
+ c >= 0x3000 && c <= 0x303E ||
2428
+ c >= 0x3041 && c <= 0x3096 ||
2429
+ c >= 0x3099 && c <= 0x30FF ||
2430
+ c >= 0x3105 && c <= 0x312D ||
2431
+ c >= 0x3131 && c <= 0x318E ||
2432
+ c >= 0x3190 && c <= 0x31BA ||
2433
+ c >= 0x31C0 && c <= 0x31E3 ||
2434
+ c >= 0x31F0 && c <= 0x321E ||
2435
+ c >= 0x3220 && c <= 0x3247 ||
2436
+ c >= 0x3250 && c <= 0x32FE ||
2437
+ c >= 0x3300 && c <= 0x4DBF ||
2438
+ c >= 0x4E00 && c <= 0xA48C ||
2439
+ c >= 0xA490 && c <= 0xA4C6 ||
2440
+ c >= 0xA960 && c <= 0xA97C ||
2441
+ c >= 0xAC00 && c <= 0xD7A3 ||
2442
+ c >= 0xD7B0 && c <= 0xD7C6 ||
2443
+ c >= 0xD7CB && c <= 0xD7FB ||
2444
+ c >= 0xF900 && c <= 0xFAFF ||
2445
+ c >= 0xFE10 && c <= 0xFE19 ||
2446
+ c >= 0xFE30 && c <= 0xFE52 ||
2447
+ c >= 0xFE54 && c <= 0xFE66 ||
2448
+ c >= 0xFE68 && c <= 0xFE6B ||
2449
+ c >= 0xFF01 && c <= 0xFF60 ||
2450
+ c >= 0xFFE0 && c <= 0xFFE6;
2451
+ };
2452
+
2453
+ }).call(EditSession.prototype);
2454
+
2455
+ require("./edit_session/folding").Folding.call(EditSession.prototype);
2456
+ require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
2457
+
2458
+
2459
+ config.defineOptions(EditSession.prototype, "session", {
2460
+ wrap: {
2461
+ set: function(value) {
2462
+ if (!value || value == "off")
2463
+ value = false;
2464
+ else if (value == "free")
2465
+ value = true;
2466
+ else if (value == "printMargin")
2467
+ value = -1;
2468
+ else if (typeof value == "string")
2469
+ value = parseInt(value, 10) || false;
2470
+
2471
+ if (this.$wrap == value)
2472
+ return;
2473
+ if (!value) {
2474
+ this.setUseWrapMode(false);
2475
+ } else {
2476
+ var col = typeof value == "number" ? value : null;
2477
+ this.setWrapLimitRange(col, col);
2478
+ this.setUseWrapMode(true);
2479
+ }
2480
+ this.$wrap = value;
2481
+ },
2482
+ get: function() {
2483
+ if (this.getUseWrapMode()) {
2484
+ if (this.$wrap == -1)
2485
+ return "printMargin";
2486
+ if (!this.getWrapLimitRange().min)
2487
+ return "free";
2488
+ return this.$wrap;
2489
+ }
2490
+ return "off";
2491
+ },
2492
+ handlesSet: true
2493
+ },
2494
+ wrapMethod: {
2495
+ // code|text|auto
2496
+ set: function(val) {
2497
+ val = val == "auto"
2498
+ ? this.$mode.type != "text"
2499
+ : val != "text";
2500
+ if (val != this.$wrapAsCode) {
2501
+ this.$wrapAsCode = val;
2502
+ if (this.$useWrapMode) {
2503
+ this.$modified = true;
2504
+ this.$resetRowCache(0);
2505
+ this.$updateWrapData(0, this.getLength() - 1);
2506
+ }
2507
+ }
2508
+ },
2509
+ initialValue: "auto"
2510
+ },
2511
+ firstLineNumber: {
2512
+ set: function() {this._signal("changeBreakpoint");},
2513
+ initialValue: 1
2514
+ },
2515
+ useWorker: {
2516
+ set: function(useWorker) {
2517
+ this.$useWorker = useWorker;
2518
+
2519
+ this.$stopWorker();
2520
+ if (useWorker)
2521
+ this.$startWorker();
2522
+ },
2523
+ initialValue: true
2524
+ },
2525
+ useSoftTabs: {initialValue: true},
2526
+ tabSize: {
2527
+ set: function(tabSize) {
2528
+ if (isNaN(tabSize) || this.$tabSize === tabSize) return;
2529
+
2530
+ this.$modified = true;
2531
+ this.$rowLengthCache = [];
2532
+ this.$tabSize = tabSize;
2533
+ this._signal("changeTabSize");
2534
+ },
2535
+ initialValue: 4,
2536
+ handlesSet: true
2537
+ },
2538
+ overwrite: {
2539
+ set: function(val) {this._signal("changeOverwrite");},
2540
+ initialValue: false
2541
+ },
2542
+ newLineMode: {
2543
+ set: function(val) {this.doc.setNewLineMode(val)},
2544
+ get: function() {return this.doc.getNewLineMode()},
2545
+ handlesSet: true
2546
+ },
2547
+ mode: {
2548
+ set: function(val) { this.setMode(val) },
2549
+ get: function() { return this.$modeId }
2550
+ }
2551
+ });
2552
+
2553
+ exports.EditSession = EditSession;
2554
+ });