gollum 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gollum might be problematic. Click here for more details.
- data/README.md +44 -7
- data/Rakefile +1 -1
- data/bin/gollum +20 -1
- data/gollum.gemspec +400 -5
- data/lib/gollum.rb +2 -1
- data/lib/gollum/blob_entry.rb +13 -1
- data/lib/gollum/committer.rb +10 -1
- data/lib/gollum/file.rb +15 -2
- data/lib/gollum/file_view.rb +145 -0
- data/lib/gollum/frontend/app.rb +217 -69
- data/lib/gollum/frontend/helpers.rb +21 -0
- data/lib/gollum/frontend/public/gollum/css/_styles.css +121 -0
- data/lib/gollum/frontend/public/gollum/css/editor.css +17 -8
- data/lib/gollum/frontend/public/gollum/css/gollum.css +440 -402
- data/lib/gollum/frontend/public/gollum/css/template.css +540 -289
- data/lib/gollum/frontend/public/gollum/images/dirty-shade.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/document.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/folder-horizontal.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/para.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-16.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-20.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-24.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-32.png +0 -0
- data/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +31 -7
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js +18 -6
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js +3 -0
- data/lib/gollum/frontend/public/gollum/javascript/gollum.js +78 -16
- data/lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js +4 -0
- data/lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js +8 -0
- data/lib/gollum/frontend/public/gollum/livepreview/css/custom.css +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/save_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/index.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js +254 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +184 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +261 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +460 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js +124 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +327 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js +617 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js +314 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +2419 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +252 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +276 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +759 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +981 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js +2163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +231 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +562 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static.css +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +536 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +367 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +143 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +257 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +315 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +556 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +611 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +134 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js +49 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +187 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +214 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +595 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +106 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +292 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +1059 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +317 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +62 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +180 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +235 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +739 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +2756 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +603 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +342 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +154 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +227 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +135 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +110 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +9014 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +242 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js +75 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js +127 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +95 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js +76 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +115 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +169 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +262 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js +24 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +183 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +471 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js +346 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +111 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js +53 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +57 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +38 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +279 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +220 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js +91 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +436 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +355 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +583 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +1165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +147 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +194 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +179 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +304 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +89 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +82 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +120 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md +6 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js +1686 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js +2993 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js +69 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js +10363 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +42525 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js +6177 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js +55 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +64 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +354 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +762 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js +696 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js +598 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js +2072 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +278 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js +581 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js +230 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js +198 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js +398 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js +451 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js +886 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +472 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js +411 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +136 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js +313 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js +529 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js +13 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js +10 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +204 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +118 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +151 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +149 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js +45 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +102 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js +48 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +133 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +137 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +146 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +150 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +131 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +130 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js +47 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +160 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +141 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js +219 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +1402 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js +4469 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js +6396 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js +43 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +176 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js +2 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +456 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/md_sundown.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/requirejs.min.js +35 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/sundown.js +1 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt +476 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt +9 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/gollum/LICENSE.txt +21 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt +20 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/notepages/LICENSE.txt +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/requirejs/LICENSE.txt +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt +359 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt +4 -0
- data/lib/gollum/frontend/public/gollum/livepreview/readme.md +44 -0
- data/lib/gollum/frontend/templates/compare.mustache +9 -9
- data/lib/gollum/frontend/templates/create.mustache +4 -1
- data/lib/gollum/frontend/templates/edit.mustache +6 -3
- data/lib/gollum/frontend/templates/editor.mustache +30 -14
- data/lib/gollum/frontend/templates/file_view.mustache +32 -0
- data/lib/gollum/frontend/templates/history.mustache +8 -8
- data/lib/gollum/frontend/templates/layout.mustache +21 -14
- data/lib/gollum/frontend/templates/page.mustache +37 -14
- data/lib/gollum/frontend/templates/pages.mustache +14 -10
- data/lib/gollum/frontend/templates/search.mustache +2 -2
- data/lib/gollum/frontend/templates/searchbar.mustache +1 -1
- data/lib/gollum/frontend/uri_encode_component.rb +172 -0
- data/lib/gollum/frontend/views/compare.rb +2 -4
- data/lib/gollum/frontend/views/create.rb +5 -0
- data/lib/gollum/frontend/views/edit.rb +12 -0
- data/lib/gollum/frontend/views/file_view.rb +19 -0
- data/lib/gollum/frontend/views/has_page.rb +15 -0
- data/lib/gollum/frontend/views/history.rb +8 -4
- data/lib/gollum/frontend/views/layout.rb +9 -1
- data/lib/gollum/frontend/views/page.rb +37 -10
- data/lib/gollum/frontend/views/pages.rb +48 -0
- data/lib/gollum/git_access.rb +2 -2
- data/lib/gollum/markup.rb +115 -19
- data/lib/gollum/page.rb +79 -9
- data/lib/gollum/tex.rb +319 -42
- data/lib/gollum/wiki.rb +92 -12
- data/licenses/css_tree_menu_thecssninja/license.txt +50 -0
- data/licenses/licenses.txt +23 -0
- data/licenses/unity_asset_pool/COPYRIGHT +286 -0
- data/test/examples/lotr.git/config +1 -1
- data/test/examples/lotr.git/logs/HEAD +4 -0
- data/test/examples/lotr.git/logs/refs/heads/master +4 -0
- data/test/examples/lotr.git/objects/0d/c9016ca928c78d5421a99a53b379b53929221e +0 -0
- data/test/examples/lotr.git/objects/1c/79ddc69707f7b164bc2ea58beb5d8965ff6bd0 +0 -0
- data/test/examples/lotr.git/objects/27/680b0fce1abfbc528e7aa53d92645852d52eb6 +0 -0
- data/test/examples/lotr.git/objects/45/3b250f979c7bd6dfb62640c944c982ae6721ee +0 -0
- data/test/examples/lotr.git/objects/45/f319ee12f2b551b901b22e72602963c366fff1 +0 -0
- data/test/examples/lotr.git/objects/46/a697caf435815bb07bbce947fc2d58be15f087 +0 -0
- data/test/examples/lotr.git/objects/4c/45c2b4e297a726c3d3f66886f35373e48fe1c5 +2 -0
- data/test/examples/lotr.git/objects/4e/023f460ce466e154ca09d8774c79ad5a53fc15 +0 -0
- data/test/examples/lotr.git/objects/62/9aa678272b017a4d136d35e77ac94d80b08dc2 +1 -0
- data/test/examples/lotr.git/objects/6e/48abfc56565574859e081ee58eae655d48cf71 +0 -0
- data/test/examples/lotr.git/objects/7b/60c5a20a501a70f2317fa0ef763e1e2ce22d6b +0 -0
- data/test/examples/lotr.git/objects/7d/981cd984ad589e3cf00d8122170c6f7d685979 +0 -0
- data/test/examples/lotr.git/objects/94/9a9cc3119b9c98817f375e976d2bb5e2a42809 +0 -0
- data/test/examples/lotr.git/objects/9b/e95b960ac388d4e7db55f610f828e9c31344e6 +0 -0
- data/test/examples/lotr.git/objects/b0/de6e794dfdc7ef3400e894225bfe23308aae5c +0 -0
- data/test/examples/lotr.git/objects/b1/6b3d9fad9d78e5a669e7f33d94c96da374eccd +0 -0
- data/test/examples/lotr.git/objects/c9/6a7645db5d4c76389e77cd103ef3ed77d81e4c +0 -0
- data/test/examples/lotr.git/objects/ca/7355dc497e9729fbaf0c0e3f424b86afef5614 +0 -0
- data/test/examples/lotr.git/objects/cf/ea406f5f77afc7fb673a43e97721234385b1bd +2 -0
- data/test/examples/lotr.git/objects/d5/29304506d37f544675244c335d85cab5d29966 +0 -0
- data/test/examples/lotr.git/objects/fb/c5dd7d807707b4a0a97c1182fecfef1eced5df +1 -0
- data/test/examples/lotr.git/objects/fc/3eee516ff72dc9099ba00d4611eb02e5c9e634 +0 -0
- data/test/examples/lotr.git/objects/ff/6f7de62644369380ba73b4e4297c1a2d6f0b66 +0 -0
- data/test/examples/lotr.git/refs/heads/master +1 -1
- data/test/examples/revert.git/COMMIT_EDITMSG +1 -1
- data/test/examples/revert.git/index +0 -0
- data/test/examples/revert.git/logs/HEAD +1 -0
- data/test/examples/revert.git/logs/refs/heads/master +1 -0
- data/test/examples/revert.git/objects/10/2685c42018f802557f05db171f44443e8dacab +0 -0
- data/test/examples/revert.git/objects/8e/83f898e5e16ae400db59dda1017acad540f3aa +0 -0
- data/test/examples/revert.git/objects/ed/6c9f63b98acf73c25b5ffbb38da557d3682023 +3 -0
- data/test/examples/revert.git/refs/heads/master +1 -1
- data/test/file_view/1_file.txt +3 -0
- data/test/file_view/1_file_1_folder.txt +8 -0
- data/test/file_view/1_folder.txt +8 -0
- data/test/file_view/2_files_2_folders.txt +12 -0
- data/test/file_view/2_files_2_folders_1_root.txt +13 -0
- data/test/file_view/nested_folders.txt +28 -0
- data/test/test_app.rb +162 -12
- data/test/test_app_helpers.rb +13 -0
- data/test/test_committer.rb +1 -1
- data/test/test_file_view.rb +102 -0
- data/test/test_git_access.rb +3 -2
- data/test/test_markup.rb +45 -12
- data/test/test_page.rb +65 -1
- data/test/test_page_revert.rb +14 -2
- data/test/test_pages_view.rb +37 -0
- data/test/test_unicode.rb +110 -0
- data/test/test_wiki.rb +51 -4
- metadata +658 -239
- data/lib/gollum/frontend/public/gollum/javascript/jquery.js +0 -7179
@@ -0,0 +1,2163 @@
|
|
1
|
+
/* vim:ts=4:sts=4:sw=4:
|
2
|
+
* ***** BEGIN LICENSE BLOCK *****
|
3
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
4
|
+
*
|
5
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
6
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
7
|
+
* the License. You may obtain a copy of the License at
|
8
|
+
* http://www.mozilla.org/MPL/
|
9
|
+
*
|
10
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
11
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
12
|
+
* for the specific language governing rights and limitations under the
|
13
|
+
* License.
|
14
|
+
*
|
15
|
+
* The Original Code is Ajax.org Code Editor (ACE).
|
16
|
+
*
|
17
|
+
* The Initial Developer of the Original Code is
|
18
|
+
* Ajax.org B.V.
|
19
|
+
* Portions created by the Initial Developer are Copyright (C) 2010
|
20
|
+
* the Initial Developer. All Rights Reserved.
|
21
|
+
*
|
22
|
+
* Contributor(s):
|
23
|
+
* Fabian Jakobs <fabian AT ajax DOT org>
|
24
|
+
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
25
|
+
* Julian Viereck <julian.viereck@gmail.com>
|
26
|
+
*
|
27
|
+
* Alternatively, the contents of this file may be used under the terms of
|
28
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
29
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
30
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
31
|
+
* of those above. If you wish to allow use of your version of this file only
|
32
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
33
|
+
* use your version of this file under the terms of the MPL, indicate your
|
34
|
+
* decision by deleting the provisions above and replace them with the notice
|
35
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
36
|
+
* the provisions above, a recipient may use your version of this file under
|
37
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
38
|
+
*
|
39
|
+
* ***** END LICENSE BLOCK ***** */
|
40
|
+
|
41
|
+
define(function(require, exports, module) {
|
42
|
+
"use strict";
|
43
|
+
|
44
|
+
require("./lib/fixoldbrowsers");
|
45
|
+
|
46
|
+
var oop = require("./lib/oop");
|
47
|
+
var lang = require("./lib/lang");
|
48
|
+
var useragent = require("./lib/useragent");
|
49
|
+
var TextInput = require("./keyboard/textinput").TextInput;
|
50
|
+
var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
|
51
|
+
var FoldHandler = require("./mouse/fold_handler").FoldHandler;
|
52
|
+
//var TouchHandler = require("./touch_handler").TouchHandler;
|
53
|
+
var KeyBinding = require("./keyboard/keybinding").KeyBinding;
|
54
|
+
var EditSession = require("./edit_session").EditSession;
|
55
|
+
var Search = require("./search").Search;
|
56
|
+
var Range = require("./range").Range;
|
57
|
+
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
58
|
+
var CommandManager = require("./commands/command_manager").CommandManager;
|
59
|
+
var defaultCommands = require("./commands/default_commands").commands;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* class Editor
|
63
|
+
*
|
64
|
+
* The main entry point into the Ace functionality. The `Editor` manages the `EditSession` (which manages `Document`s), as well as the `VirtualRenderer`, which draws everything to the screen. Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
|
65
|
+
*
|
66
|
+
**/
|
67
|
+
|
68
|
+
/**
|
69
|
+
* new Editor(renderer, session)
|
70
|
+
* - renderer (VirtualRenderer): Associated `VirtualRenderer` that draws everything
|
71
|
+
* - session (EditSession): The `EditSession` to refer to
|
72
|
+
*
|
73
|
+
* Creates a new `Editor` object.
|
74
|
+
*
|
75
|
+
**/
|
76
|
+
var Editor = function(renderer, session) {
|
77
|
+
var container = renderer.getContainerElement();
|
78
|
+
this.container = container;
|
79
|
+
this.renderer = renderer;
|
80
|
+
|
81
|
+
this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
|
82
|
+
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
|
83
|
+
this.renderer.textarea = this.textInput.getElement();
|
84
|
+
this.keyBinding = new KeyBinding(this);
|
85
|
+
|
86
|
+
// TODO detect touch event support
|
87
|
+
if (useragent.isIPad) {
|
88
|
+
//this.$mouseHandler = new TouchHandler(this);
|
89
|
+
} else {
|
90
|
+
this.$mouseHandler = new MouseHandler(this);
|
91
|
+
new FoldHandler(this);
|
92
|
+
}
|
93
|
+
|
94
|
+
this.$blockScrolling = 0;
|
95
|
+
this.$search = new Search().set({
|
96
|
+
wrap: true
|
97
|
+
});
|
98
|
+
|
99
|
+
this.setSession(session || new EditSession(""));
|
100
|
+
};
|
101
|
+
|
102
|
+
(function(){
|
103
|
+
|
104
|
+
oop.implement(this, EventEmitter);
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Editor.setKeyboardHandler(keyboardHandler)
|
108
|
+
*
|
109
|
+
* Sets a new keyboard handler.
|
110
|
+
**/
|
111
|
+
this.setKeyboardHandler = function(keyboardHandler) {
|
112
|
+
this.keyBinding.setKeyboardHandler(keyboardHandler);
|
113
|
+
};
|
114
|
+
|
115
|
+
/** related to: KeyBinding
|
116
|
+
* Editor.getKeyboardHandler() -> String
|
117
|
+
*
|
118
|
+
* Returns the keyboard handler.
|
119
|
+
**/
|
120
|
+
this.getKeyboardHandler = function() {
|
121
|
+
return this.keyBinding.getKeyboardHandler();
|
122
|
+
};
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Editor.setSession(session)
|
126
|
+
* - session (EditSession): The new session to use
|
127
|
+
*
|
128
|
+
* Sets a new editsession to use. This method also emits the `'changeSession'` event.
|
129
|
+
**/
|
130
|
+
this.setSession = function(session) {
|
131
|
+
if (this.session == session)
|
132
|
+
return;
|
133
|
+
|
134
|
+
if (this.session) {
|
135
|
+
var oldSession = this.session;
|
136
|
+
this.session.removeEventListener("change", this.$onDocumentChange);
|
137
|
+
this.session.removeEventListener("changeMode", this.$onChangeMode);
|
138
|
+
this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
|
139
|
+
this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
|
140
|
+
this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
|
141
|
+
this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
|
142
|
+
this.session.removeEventListener("onChangeFold", this.$onChangeFold);
|
143
|
+
this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
144
|
+
this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
|
145
|
+
this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
|
146
|
+
this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
|
147
|
+
this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
|
148
|
+
this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
|
149
|
+
this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange);
|
150
|
+
|
151
|
+
var selection = this.session.getSelection();
|
152
|
+
selection.removeEventListener("changeCursor", this.$onCursorChange);
|
153
|
+
selection.removeEventListener("changeSelection", this.$onSelectionChange);
|
154
|
+
}
|
155
|
+
|
156
|
+
this.session = session;
|
157
|
+
|
158
|
+
this.$onDocumentChange = this.onDocumentChange.bind(this);
|
159
|
+
session.addEventListener("change", this.$onDocumentChange);
|
160
|
+
this.renderer.setSession(session);
|
161
|
+
|
162
|
+
this.$onChangeMode = this.onChangeMode.bind(this);
|
163
|
+
session.addEventListener("changeMode", this.$onChangeMode);
|
164
|
+
|
165
|
+
this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
|
166
|
+
session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
|
167
|
+
|
168
|
+
this.$onChangeTabSize = this.renderer.updateText.bind(this.renderer);
|
169
|
+
session.addEventListener("changeTabSize", this.$onChangeTabSize);
|
170
|
+
|
171
|
+
this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
|
172
|
+
session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
|
173
|
+
|
174
|
+
this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
|
175
|
+
session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
|
176
|
+
|
177
|
+
this.$onChangeFold = this.onChangeFold.bind(this);
|
178
|
+
session.addEventListener("changeFold", this.$onChangeFold);
|
179
|
+
|
180
|
+
this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
|
181
|
+
this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
182
|
+
|
183
|
+
this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
|
184
|
+
this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
|
185
|
+
|
186
|
+
this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
|
187
|
+
this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
|
188
|
+
|
189
|
+
this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
|
190
|
+
this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
|
191
|
+
|
192
|
+
this.$onCursorChange = this.onCursorChange.bind(this);
|
193
|
+
this.session.addEventListener("changeOverwrite", this.$onCursorChange);
|
194
|
+
|
195
|
+
this.$onScrollTopChange = this.onScrollTopChange.bind(this);
|
196
|
+
this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
|
197
|
+
|
198
|
+
this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
|
199
|
+
this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
|
200
|
+
|
201
|
+
this.selection = session.getSelection();
|
202
|
+
this.selection.addEventListener("changeCursor", this.$onCursorChange);
|
203
|
+
|
204
|
+
this.$onSelectionChange = this.onSelectionChange.bind(this);
|
205
|
+
this.selection.addEventListener("changeSelection", this.$onSelectionChange);
|
206
|
+
|
207
|
+
this.onChangeMode();
|
208
|
+
|
209
|
+
this.$blockScrolling += 1;
|
210
|
+
this.onCursorChange();
|
211
|
+
this.$blockScrolling -= 1;
|
212
|
+
|
213
|
+
this.onScrollTopChange();
|
214
|
+
this.onScrollLeftChange();
|
215
|
+
this.onSelectionChange();
|
216
|
+
this.onChangeFrontMarker();
|
217
|
+
this.onChangeBackMarker();
|
218
|
+
this.onChangeBreakpoint();
|
219
|
+
this.onChangeAnnotation();
|
220
|
+
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
221
|
+
this.renderer.updateFull();
|
222
|
+
|
223
|
+
this._emit("changeSession", {
|
224
|
+
session: session,
|
225
|
+
oldSession: oldSession
|
226
|
+
});
|
227
|
+
};
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Editor.getSession() -> EditSession
|
231
|
+
*
|
232
|
+
* Returns the current session being used.
|
233
|
+
**/
|
234
|
+
this.getSession = function() {
|
235
|
+
return this.session;
|
236
|
+
};
|
237
|
+
|
238
|
+
/** related to: Document.setValue
|
239
|
+
* Editor.setValue(val [,dontSelect]) -> String
|
240
|
+
* - val (String): The new value to set for the document
|
241
|
+
* - cursorPos (number): 0: selectAll, -1 document start, 1 end
|
242
|
+
*
|
243
|
+
* Sets the current document to `val`.
|
244
|
+
**/
|
245
|
+
this.setValue = function(val, cursorPos) {
|
246
|
+
this.session.doc.setValue(val);
|
247
|
+
|
248
|
+
if (!cursorPos)
|
249
|
+
this.selectAll();
|
250
|
+
else if (cursorPos == 1)
|
251
|
+
this.navigateFileEnd();
|
252
|
+
else if (cursorPos == -1)
|
253
|
+
this.navigateFileStart();
|
254
|
+
|
255
|
+
return val;
|
256
|
+
};
|
257
|
+
|
258
|
+
/** related to: EditSession.getValue
|
259
|
+
* Editor.getValue() -> String
|
260
|
+
*
|
261
|
+
* Returns the current session's content.
|
262
|
+
**/
|
263
|
+
this.getValue = function() {
|
264
|
+
return this.session.getValue();
|
265
|
+
};
|
266
|
+
|
267
|
+
/**
|
268
|
+
* Editor.getSelection() -> String
|
269
|
+
*
|
270
|
+
* Returns the currently highlighted selection.
|
271
|
+
**/
|
272
|
+
this.getSelection = function() {
|
273
|
+
return this.selection;
|
274
|
+
};
|
275
|
+
|
276
|
+
/** related to: VirtualRenderer.onResize
|
277
|
+
* Editor.resize()
|
278
|
+
*
|
279
|
+
* {:VirtualRenderer.onResize}
|
280
|
+
**/
|
281
|
+
this.resize = function(force) {
|
282
|
+
this.renderer.onResize(force);
|
283
|
+
};
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Editor.setTheme(theme)
|
287
|
+
*
|
288
|
+
* {:VirtualRenderer.setTheme}
|
289
|
+
**/
|
290
|
+
this.setTheme = function(theme) {
|
291
|
+
this.renderer.setTheme(theme);
|
292
|
+
};
|
293
|
+
|
294
|
+
/** related to: VirtualRenderer.getTheme
|
295
|
+
* Editor.getTheme() -> String
|
296
|
+
*
|
297
|
+
* {:VirtualRenderer.getTheme}
|
298
|
+
**/
|
299
|
+
this.getTheme = function() {
|
300
|
+
return this.renderer.getTheme();
|
301
|
+
};
|
302
|
+
|
303
|
+
/** related to: VirtualRenderer.setStyle
|
304
|
+
* Editor.setStyle(style)
|
305
|
+
*
|
306
|
+
* {:VirtualRenderer.setStyle}
|
307
|
+
**/
|
308
|
+
this.setStyle = function(style) {
|
309
|
+
this.renderer.setStyle(style);
|
310
|
+
};
|
311
|
+
|
312
|
+
/** related to: VirtualRenderer.unsetStyle
|
313
|
+
* Editor.unsetStyle(style)
|
314
|
+
*
|
315
|
+
* {:VirtualRenderer.unsetStyle}
|
316
|
+
**/
|
317
|
+
this.unsetStyle = function(style) {
|
318
|
+
this.renderer.unsetStyle(style);
|
319
|
+
};
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Editor.setFontSize(size)
|
323
|
+
* - size (Number): A font size
|
324
|
+
*
|
325
|
+
* Set a new font size (in pixels) for the editor text.
|
326
|
+
**/
|
327
|
+
this.setFontSize = function(size) {
|
328
|
+
this.container.style.fontSize = size;
|
329
|
+
this.renderer.updateFontSize();
|
330
|
+
};
|
331
|
+
|
332
|
+
/** internal, hide
|
333
|
+
* Editor.$highlightBrackets()
|
334
|
+
*
|
335
|
+
**/
|
336
|
+
this.$highlightBrackets = function() {
|
337
|
+
if (this.session.$bracketHighlight) {
|
338
|
+
this.session.removeMarker(this.session.$bracketHighlight);
|
339
|
+
this.session.$bracketHighlight = null;
|
340
|
+
}
|
341
|
+
|
342
|
+
if (this.$highlightPending) {
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
|
346
|
+
// perform highlight async to not block the browser during navigation
|
347
|
+
var self = this;
|
348
|
+
this.$highlightPending = true;
|
349
|
+
setTimeout(function() {
|
350
|
+
self.$highlightPending = false;
|
351
|
+
|
352
|
+
var pos = self.session.findMatchingBracket(self.getCursorPosition());
|
353
|
+
if (pos) {
|
354
|
+
var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
|
355
|
+
self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
|
356
|
+
}
|
357
|
+
}, 10);
|
358
|
+
};
|
359
|
+
|
360
|
+
/**
|
361
|
+
* Editor.focus()
|
362
|
+
*
|
363
|
+
* Brings the current `textInput` into focus.
|
364
|
+
**/
|
365
|
+
this.focus = function() {
|
366
|
+
// Safari needs the timeout
|
367
|
+
// iOS and Firefox need it called immediately
|
368
|
+
// to be on the save side we do both
|
369
|
+
var _self = this;
|
370
|
+
setTimeout(function() {
|
371
|
+
_self.textInput.focus();
|
372
|
+
});
|
373
|
+
this.textInput.focus();
|
374
|
+
};
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Editor.isFocused() -> Boolean
|
378
|
+
*
|
379
|
+
* Returns true if the current `textInput` is in focus.
|
380
|
+
**/
|
381
|
+
this.isFocused = function() {
|
382
|
+
return this.textInput.isFocused();
|
383
|
+
};
|
384
|
+
|
385
|
+
/**
|
386
|
+
* Editor.blur()
|
387
|
+
*
|
388
|
+
* Blurs the current `textInput`.
|
389
|
+
**/
|
390
|
+
this.blur = function() {
|
391
|
+
this.textInput.blur();
|
392
|
+
};
|
393
|
+
|
394
|
+
/**
|
395
|
+
* Editor@onFocus()
|
396
|
+
*
|
397
|
+
* Emitted once the editor comes into focus.
|
398
|
+
**/
|
399
|
+
this.onFocus = function() {
|
400
|
+
if (this.$isFocused)
|
401
|
+
return;
|
402
|
+
this.$isFocused = true;
|
403
|
+
this.renderer.showCursor();
|
404
|
+
this.renderer.visualizeFocus();
|
405
|
+
this._emit("focus");
|
406
|
+
};
|
407
|
+
|
408
|
+
/**
|
409
|
+
* Editor@onBlur()
|
410
|
+
*
|
411
|
+
* Emitted once the editor has been blurred.
|
412
|
+
**/
|
413
|
+
this.onBlur = function() {
|
414
|
+
if (!this.$isFocused)
|
415
|
+
return;
|
416
|
+
this.$isFocused = false;
|
417
|
+
this.renderer.hideCursor();
|
418
|
+
this.renderer.visualizeBlur();
|
419
|
+
this._emit("blur");
|
420
|
+
};
|
421
|
+
|
422
|
+
this.$cursorChange = function() {
|
423
|
+
this.renderer.updateCursor();
|
424
|
+
};
|
425
|
+
|
426
|
+
/**
|
427
|
+
* Editor@onDocumentChange(e)
|
428
|
+
* - e (Object): Contains a single property, `data`, which has the delta of changes
|
429
|
+
*
|
430
|
+
* Emitted whenever the document is changed.
|
431
|
+
*
|
432
|
+
**/
|
433
|
+
this.onDocumentChange = function(e) {
|
434
|
+
var delta = e.data;
|
435
|
+
var range = delta.range;
|
436
|
+
var lastRow;
|
437
|
+
|
438
|
+
if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
|
439
|
+
lastRow = range.end.row;
|
440
|
+
else
|
441
|
+
lastRow = Infinity;
|
442
|
+
this.renderer.updateLines(range.start.row, lastRow);
|
443
|
+
|
444
|
+
this._emit("change", e);
|
445
|
+
|
446
|
+
// update cursor because tab characters can influence the cursor position
|
447
|
+
this.$cursorChange();
|
448
|
+
};
|
449
|
+
|
450
|
+
/**
|
451
|
+
* Editor@onTokenizerUpdate(e)
|
452
|
+
* - e (Object): Contains a single property, `data`, which indicates the changed rows
|
453
|
+
*
|
454
|
+
* Emitted when the a tokenizer is updated.
|
455
|
+
**/
|
456
|
+
this.onTokenizerUpdate = function(e) {
|
457
|
+
var rows = e.data;
|
458
|
+
this.renderer.updateLines(rows.first, rows.last);
|
459
|
+
};
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Editor@onScrollTopChange()
|
463
|
+
*
|
464
|
+
* Emitted when the scroll top changes.
|
465
|
+
**/
|
466
|
+
this.onScrollTopChange = function() {
|
467
|
+
this.renderer.scrollToY(this.session.getScrollTop());
|
468
|
+
};
|
469
|
+
|
470
|
+
/**
|
471
|
+
* Editor@onScrollLeftChange()
|
472
|
+
*
|
473
|
+
* Emitted when the scroll left changes.
|
474
|
+
**/
|
475
|
+
this.onScrollLeftChange = function() {
|
476
|
+
this.renderer.scrollToX(this.session.getScrollLeft());
|
477
|
+
};
|
478
|
+
|
479
|
+
/**
|
480
|
+
* Editor@onCursorChange()
|
481
|
+
*
|
482
|
+
* Emitted when the cursor changes.
|
483
|
+
**/
|
484
|
+
this.onCursorChange = function() {
|
485
|
+
this.$cursorChange();
|
486
|
+
|
487
|
+
if (!this.$blockScrolling) {
|
488
|
+
this.renderer.scrollCursorIntoView();
|
489
|
+
}
|
490
|
+
|
491
|
+
this.$highlightBrackets();
|
492
|
+
this.$updateHighlightActiveLine();
|
493
|
+
};
|
494
|
+
|
495
|
+
/** internal, hide
|
496
|
+
* Editor.$updateHighlightActiveLine()
|
497
|
+
*
|
498
|
+
*
|
499
|
+
**/
|
500
|
+
this.$updateHighlightActiveLine = function() {
|
501
|
+
var session = this.getSession();
|
502
|
+
|
503
|
+
if (session.$highlightLineMarker)
|
504
|
+
session.removeMarker(session.$highlightLineMarker);
|
505
|
+
|
506
|
+
session.$highlightLineMarker = null;
|
507
|
+
|
508
|
+
if (this.$highlightActiveLine) {
|
509
|
+
var cursor = this.getCursorPosition();
|
510
|
+
var foldLine = this.session.getFoldLine(cursor.row);
|
511
|
+
|
512
|
+
if ((this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
513
|
+
var range;
|
514
|
+
if (foldLine) {
|
515
|
+
range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
|
516
|
+
} else {
|
517
|
+
range = new Range(cursor.row, 0, cursor.row+1, 0);
|
518
|
+
}
|
519
|
+
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
|
520
|
+
}
|
521
|
+
}
|
522
|
+
};
|
523
|
+
|
524
|
+
|
525
|
+
/**
|
526
|
+
* Editor@onSelectionChange(e)
|
527
|
+
* - e (Object): Contains a single property, `data`, which has the delta of changes
|
528
|
+
*
|
529
|
+
* Emitted when a selection has changed.
|
530
|
+
**/
|
531
|
+
this.onSelectionChange = function(e) {
|
532
|
+
var session = this.session;
|
533
|
+
|
534
|
+
if (session.$selectionMarker) {
|
535
|
+
session.removeMarker(session.$selectionMarker);
|
536
|
+
}
|
537
|
+
session.$selectionMarker = null;
|
538
|
+
|
539
|
+
if (!this.selection.isEmpty()) {
|
540
|
+
var range = this.selection.getRange();
|
541
|
+
var style = this.getSelectionStyle();
|
542
|
+
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
|
543
|
+
} else {
|
544
|
+
this.$updateHighlightActiveLine();
|
545
|
+
}
|
546
|
+
|
547
|
+
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
|
548
|
+
this.session.highlight(re);
|
549
|
+
};
|
550
|
+
|
551
|
+
this.$getSelectionHighLightRegexp = function() {
|
552
|
+
var session = this.session;
|
553
|
+
|
554
|
+
var selection = this.getSelectionRange();
|
555
|
+
if (selection.isEmpty() || selection.isMultiLine())
|
556
|
+
return;
|
557
|
+
|
558
|
+
var startOuter = selection.start.column - 1;
|
559
|
+
var endOuter = selection.end.column + 1;
|
560
|
+
var line = session.getLine(selection.start.row);
|
561
|
+
var lineCols = line.length;
|
562
|
+
var needle = line.substring(Math.max(startOuter, 0),
|
563
|
+
Math.min(endOuter, lineCols));
|
564
|
+
|
565
|
+
// Make sure the outer characters are not part of the word.
|
566
|
+
if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
|
567
|
+
(endOuter <= lineCols && /[\w\d]$/.test(needle)))
|
568
|
+
return;
|
569
|
+
|
570
|
+
needle = line.substring(selection.start.column, selection.end.column);
|
571
|
+
if (!/^[\w\d]+$/.test(needle))
|
572
|
+
return;
|
573
|
+
|
574
|
+
var re = this.$search.$assembleRegExp({
|
575
|
+
wholeWord: true,
|
576
|
+
caseSensitive: true,
|
577
|
+
needle: needle
|
578
|
+
});
|
579
|
+
|
580
|
+
return re;
|
581
|
+
};
|
582
|
+
|
583
|
+
/**
|
584
|
+
* Editor@onChangeFrontMarker()
|
585
|
+
*
|
586
|
+
* Emitted when a front marker changes.
|
587
|
+
**/
|
588
|
+
this.onChangeFrontMarker = function() {
|
589
|
+
this.renderer.updateFrontMarkers();
|
590
|
+
};
|
591
|
+
|
592
|
+
/**
|
593
|
+
* Editor@onChangeBackMarker()
|
594
|
+
*
|
595
|
+
* Emitted when a back marker changes.
|
596
|
+
**/
|
597
|
+
this.onChangeBackMarker = function() {
|
598
|
+
this.renderer.updateBackMarkers();
|
599
|
+
};
|
600
|
+
|
601
|
+
/**
|
602
|
+
* Editor@onChangeBreakpoint()
|
603
|
+
*
|
604
|
+
* Emitted when a breakpoint changes.
|
605
|
+
**/
|
606
|
+
this.onChangeBreakpoint = function() {
|
607
|
+
this.renderer.updateBreakpoints();
|
608
|
+
};
|
609
|
+
|
610
|
+
/**
|
611
|
+
* Editor@onChangeAnnotation()
|
612
|
+
*
|
613
|
+
* Emitted when an annotation changes.
|
614
|
+
**/
|
615
|
+
this.onChangeAnnotation = function() {
|
616
|
+
this.renderer.setAnnotations(this.session.getAnnotations());
|
617
|
+
};
|
618
|
+
|
619
|
+
/**
|
620
|
+
* Editor@onChangeMode()
|
621
|
+
*
|
622
|
+
* Emitted when the mode changes.
|
623
|
+
**/
|
624
|
+
this.onChangeMode = function() {
|
625
|
+
this.renderer.updateText();
|
626
|
+
};
|
627
|
+
|
628
|
+
/**
|
629
|
+
* Editor@onChangeWrapLimit()
|
630
|
+
*
|
631
|
+
* Emitted when the wrap limit changes.
|
632
|
+
**/
|
633
|
+
this.onChangeWrapLimit = function() {
|
634
|
+
this.renderer.updateFull();
|
635
|
+
};
|
636
|
+
|
637
|
+
/**
|
638
|
+
* Editor@onChangeWrapMode()
|
639
|
+
*
|
640
|
+
* Emitted when the wrap mode changes.
|
641
|
+
**/
|
642
|
+
this.onChangeWrapMode = function() {
|
643
|
+
this.renderer.onResize(true);
|
644
|
+
};
|
645
|
+
|
646
|
+
/**
|
647
|
+
* Editor@onChangeFold()
|
648
|
+
*
|
649
|
+
* Emitted when the code folds change.
|
650
|
+
**/
|
651
|
+
this.onChangeFold = function() {
|
652
|
+
// Update the active line marker as due to folding changes the current
|
653
|
+
// line range on the screen might have changed.
|
654
|
+
this.$updateHighlightActiveLine();
|
655
|
+
// TODO: This might be too much updating. Okay for now.
|
656
|
+
this.renderer.updateFull();
|
657
|
+
};
|
658
|
+
|
659
|
+
/**
|
660
|
+
* Editor.getCopyText() -> String
|
661
|
+
*
|
662
|
+
* Returns the string of text currently highlighted.
|
663
|
+
**/
|
664
|
+
this.getCopyText = function() {
|
665
|
+
var text = "";
|
666
|
+
if (!this.selection.isEmpty())
|
667
|
+
text = this.session.getTextRange(this.getSelectionRange());
|
668
|
+
|
669
|
+
this._emit("copy", text);
|
670
|
+
return text;
|
671
|
+
};
|
672
|
+
|
673
|
+
/**
|
674
|
+
* Editor.onCopy()
|
675
|
+
*
|
676
|
+
* Called whenever a text "copy" happens.
|
677
|
+
**/
|
678
|
+
this.onCopy = function() {
|
679
|
+
this.commands.exec("copy", this);
|
680
|
+
};
|
681
|
+
|
682
|
+
/**
|
683
|
+
* Editor.onCut()
|
684
|
+
*
|
685
|
+
* called whenever a text "cut" happens.
|
686
|
+
**/
|
687
|
+
this.onCut = function() {
|
688
|
+
this.commands.exec("cut", this);
|
689
|
+
};
|
690
|
+
|
691
|
+
/**
|
692
|
+
* Editor.onPaste()
|
693
|
+
*
|
694
|
+
* called whenever a text "paste" happens.
|
695
|
+
**/
|
696
|
+
this.onPaste = function(text) {
|
697
|
+
this._emit("paste", text);
|
698
|
+
this.insert(text);
|
699
|
+
};
|
700
|
+
|
701
|
+
/**
|
702
|
+
* Editor.insert(text)
|
703
|
+
* - text (String): The new text to add
|
704
|
+
*
|
705
|
+
* Inserts `text` into wherever the cursor is pointing.
|
706
|
+
**/
|
707
|
+
this.insert = function(text) {
|
708
|
+
var session = this.session;
|
709
|
+
var mode = session.getMode();
|
710
|
+
|
711
|
+
var cursor = this.getCursorPosition();
|
712
|
+
|
713
|
+
if (this.getBehavioursEnabled()) {
|
714
|
+
// Get a transform if the current mode wants one.
|
715
|
+
var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
|
716
|
+
if (transform)
|
717
|
+
text = transform.text;
|
718
|
+
}
|
719
|
+
|
720
|
+
text = text.replace("\t", this.session.getTabString());
|
721
|
+
|
722
|
+
// remove selected text
|
723
|
+
if (!this.selection.isEmpty()) {
|
724
|
+
cursor = this.session.remove(this.getSelectionRange());
|
725
|
+
this.clearSelection();
|
726
|
+
}
|
727
|
+
else if (this.session.getOverwrite()) {
|
728
|
+
var range = new Range.fromPoints(cursor, cursor);
|
729
|
+
range.end.column += text.length;
|
730
|
+
this.session.remove(range);
|
731
|
+
}
|
732
|
+
|
733
|
+
this.clearSelection();
|
734
|
+
|
735
|
+
var start = cursor.column;
|
736
|
+
var lineState = session.getState(cursor.row);
|
737
|
+
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
|
738
|
+
var line = session.getLine(cursor.row);
|
739
|
+
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
740
|
+
var end = session.insert(cursor, text);
|
741
|
+
|
742
|
+
if (transform && transform.selection) {
|
743
|
+
if (transform.selection.length == 2) { // Transform relative to the current column
|
744
|
+
this.selection.setSelectionRange(
|
745
|
+
new Range(cursor.row, start + transform.selection[0],
|
746
|
+
cursor.row, start + transform.selection[1]));
|
747
|
+
} else { // Transform relative to the current row.
|
748
|
+
this.selection.setSelectionRange(
|
749
|
+
new Range(cursor.row + transform.selection[0],
|
750
|
+
transform.selection[1],
|
751
|
+
cursor.row + transform.selection[2],
|
752
|
+
transform.selection[3]));
|
753
|
+
}
|
754
|
+
}
|
755
|
+
|
756
|
+
var lineState = session.getState(cursor.row);
|
757
|
+
|
758
|
+
// TODO disabled multiline auto indent
|
759
|
+
// possibly doing the indent before inserting the text
|
760
|
+
// if (cursor.row !== end.row) {
|
761
|
+
if (session.getDocument().isNewLine(text)) {
|
762
|
+
this.moveCursorTo(cursor.row+1, 0);
|
763
|
+
|
764
|
+
var size = session.getTabSize();
|
765
|
+
var minIndent = Number.MAX_VALUE;
|
766
|
+
|
767
|
+
for (var row = cursor.row + 1; row <= end.row; ++row) {
|
768
|
+
var indent = 0;
|
769
|
+
|
770
|
+
line = session.getLine(row);
|
771
|
+
for (var i = 0; i < line.length; ++i)
|
772
|
+
if (line.charAt(i) == '\t')
|
773
|
+
indent += size;
|
774
|
+
else if (line.charAt(i) == ' ')
|
775
|
+
indent += 1;
|
776
|
+
else
|
777
|
+
break;
|
778
|
+
if (/[^\s]/.test(line))
|
779
|
+
minIndent = Math.min(indent, minIndent);
|
780
|
+
}
|
781
|
+
|
782
|
+
for (var row = cursor.row + 1; row <= end.row; ++row) {
|
783
|
+
var outdent = minIndent;
|
784
|
+
|
785
|
+
line = session.getLine(row);
|
786
|
+
for (var i = 0; i < line.length && outdent > 0; ++i)
|
787
|
+
if (line.charAt(i) == '\t')
|
788
|
+
outdent -= size;
|
789
|
+
else if (line.charAt(i) == ' ')
|
790
|
+
outdent -= 1;
|
791
|
+
session.remove(new Range(row, 0, row, i));
|
792
|
+
}
|
793
|
+
session.indentRows(cursor.row + 1, end.row, lineIndent);
|
794
|
+
}
|
795
|
+
if (shouldOutdent)
|
796
|
+
mode.autoOutdent(lineState, session, cursor.row);
|
797
|
+
};
|
798
|
+
|
799
|
+
/**
|
800
|
+
* Editor@onTextInput(text, pasted)
|
801
|
+
* - text (String): The text entered
|
802
|
+
* - pasted (Boolean): Identifies whether the text was pasted (`true`) or not
|
803
|
+
*
|
804
|
+
* Emitted when text is entered.
|
805
|
+
**/
|
806
|
+
this.onTextInput = function(text) {
|
807
|
+
this.keyBinding.onTextInput(text);
|
808
|
+
};
|
809
|
+
|
810
|
+
/**
|
811
|
+
* Editor@onCommandKey(e, hashId, keyCode)
|
812
|
+
*
|
813
|
+
* Emitted when the command-key is pressed.
|
814
|
+
**/
|
815
|
+
this.onCommandKey = function(e, hashId, keyCode) {
|
816
|
+
this.keyBinding.onCommandKey(e, hashId, keyCode);
|
817
|
+
};
|
818
|
+
|
819
|
+
/** related to: EditSession.setOverwrite
|
820
|
+
* Editor.setOverwrite(overwrite)
|
821
|
+
* - overwrite (Boolean): Defines wheter or not to set overwrites
|
822
|
+
*
|
823
|
+
* Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
|
824
|
+
*
|
825
|
+
**/
|
826
|
+
this.setOverwrite = function(overwrite) {
|
827
|
+
this.session.setOverwrite(overwrite);
|
828
|
+
};
|
829
|
+
|
830
|
+
/** related to: EditSession.getOverwrite
|
831
|
+
* Editor.getOverwrite() -> Boolean
|
832
|
+
*
|
833
|
+
* Returns `true` if overwrites are enabled; `false` otherwise.
|
834
|
+
**/
|
835
|
+
this.getOverwrite = function() {
|
836
|
+
return this.session.getOverwrite();
|
837
|
+
};
|
838
|
+
|
839
|
+
/** related to: EditSession.toggleOverwrite
|
840
|
+
* Editor.toggleOverwrite()
|
841
|
+
*
|
842
|
+
* Sets the value of overwrite to the opposite of whatever it currently is.
|
843
|
+
**/
|
844
|
+
this.toggleOverwrite = function() {
|
845
|
+
this.session.toggleOverwrite();
|
846
|
+
};
|
847
|
+
|
848
|
+
/**
|
849
|
+
* Editor.setScrollSpeed(speed)
|
850
|
+
* - speed (Number): A value indicating the new speed
|
851
|
+
*
|
852
|
+
* Sets how fast the mouse scrolling should do.
|
853
|
+
*
|
854
|
+
**/
|
855
|
+
this.setScrollSpeed = function(speed) {
|
856
|
+
this.$mouseHandler.setScrollSpeed(speed);
|
857
|
+
};
|
858
|
+
|
859
|
+
/**
|
860
|
+
* Editor.getScrollSpeed() -> Number
|
861
|
+
*
|
862
|
+
* Returns the value indicating how fast the mouse scroll speed is.
|
863
|
+
**/
|
864
|
+
this.getScrollSpeed = function() {
|
865
|
+
return this.$mouseHandler.getScrollSpeed();
|
866
|
+
};
|
867
|
+
|
868
|
+
/**
|
869
|
+
* Editor.setDragDelay(dragDelay)
|
870
|
+
* - dragDelay (Number): A value indicating the new delay
|
871
|
+
*
|
872
|
+
* Sets the delay (in milliseconds) of the mouse drag.
|
873
|
+
*
|
874
|
+
**/
|
875
|
+
this.setDragDelay = function(dragDelay) {
|
876
|
+
this.$mouseHandler.setDragDelay(dragDelay);
|
877
|
+
};
|
878
|
+
|
879
|
+
/**
|
880
|
+
* Editor.getDragDelay() -> Number
|
881
|
+
*
|
882
|
+
* Returns the current mouse drag delay.
|
883
|
+
**/
|
884
|
+
this.getDragDelay = function() {
|
885
|
+
return this.$mouseHandler.getDragDelay();
|
886
|
+
};
|
887
|
+
|
888
|
+
this.$selectionStyle = "line";
|
889
|
+
/**
|
890
|
+
* Editor.setSelectionStyle(style)
|
891
|
+
* - style (String): The new selection style
|
892
|
+
*
|
893
|
+
* Indicates how selections should occur. By default, selections are set to "line". This function also emits the `'changeSelectionStyle'` event.
|
894
|
+
*
|
895
|
+
**/
|
896
|
+
this.setSelectionStyle = function(style) {
|
897
|
+
if (this.$selectionStyle == style) return;
|
898
|
+
|
899
|
+
this.$selectionStyle = style;
|
900
|
+
this.onSelectionChange();
|
901
|
+
this._emit("changeSelectionStyle", {data: style});
|
902
|
+
};
|
903
|
+
|
904
|
+
/**
|
905
|
+
* Editor.getSelectionStyle() -> String
|
906
|
+
*
|
907
|
+
* Returns the current selection style.
|
908
|
+
**/
|
909
|
+
this.getSelectionStyle = function() {
|
910
|
+
return this.$selectionStyle;
|
911
|
+
};
|
912
|
+
|
913
|
+
this.$highlightActiveLine = true;
|
914
|
+
|
915
|
+
/**
|
916
|
+
* Editor.setHighlightActiveLine(shouldHighlight)
|
917
|
+
* - shouldHighlight (Boolean): Set to `true` to highlight the current line
|
918
|
+
*
|
919
|
+
* Determines whether or not the current line should be highlighted.
|
920
|
+
*
|
921
|
+
**/
|
922
|
+
this.setHighlightActiveLine = function(shouldHighlight) {
|
923
|
+
if (this.$highlightActiveLine == shouldHighlight)
|
924
|
+
return;
|
925
|
+
|
926
|
+
this.$highlightActiveLine = shouldHighlight;
|
927
|
+
this.$updateHighlightActiveLine();
|
928
|
+
};
|
929
|
+
|
930
|
+
/**
|
931
|
+
* Editor.getHighlightActiveLine() -> Boolean
|
932
|
+
*
|
933
|
+
* Returns `true` if current lines are always highlighted.
|
934
|
+
**/
|
935
|
+
this.getHighlightActiveLine = function() {
|
936
|
+
return this.$highlightActiveLine;
|
937
|
+
};
|
938
|
+
|
939
|
+
this.$highlightGutterLine = true;
|
940
|
+
this.setHighlightGutterLine = function(shouldHighlight) {
|
941
|
+
if (this.$highlightGutterLine == shouldHighlight)
|
942
|
+
return;
|
943
|
+
|
944
|
+
this.renderer.setHighlightGutterLine(shouldHighlight);
|
945
|
+
this.$highlightGutterLine = shouldHighlight;
|
946
|
+
};
|
947
|
+
|
948
|
+
this.getHighlightGutterLine = function() {
|
949
|
+
return this.$highlightGutterLine;
|
950
|
+
};
|
951
|
+
|
952
|
+
this.$highlightSelectedWord = true;
|
953
|
+
/**
|
954
|
+
* Editor.setHighlightSelectedWord(shouldHighlight)
|
955
|
+
* - shouldHighlight (Boolean): Set to `true` to highlight the currently selected word
|
956
|
+
*
|
957
|
+
* Determines if the currently selected word should be highlighted.
|
958
|
+
**/
|
959
|
+
this.setHighlightSelectedWord = function(shouldHighlight) {
|
960
|
+
if (this.$highlightSelectedWord == shouldHighlight)
|
961
|
+
return;
|
962
|
+
|
963
|
+
this.$highlightSelectedWord = shouldHighlight;
|
964
|
+
this.$onSelectionChange();
|
965
|
+
};
|
966
|
+
|
967
|
+
/**
|
968
|
+
* Editor.getHighlightSelectedWord() -> Boolean
|
969
|
+
*
|
970
|
+
* Returns `true` if currently highlighted words are to be highlighted.
|
971
|
+
**/
|
972
|
+
this.getHighlightSelectedWord = function() {
|
973
|
+
return this.$highlightSelectedWord;
|
974
|
+
};
|
975
|
+
|
976
|
+
this.setAnimatedScroll = function(shouldAnimate){
|
977
|
+
this.renderer.setAnimatedScroll(shouldAnimate);
|
978
|
+
};
|
979
|
+
|
980
|
+
this.getAnimatedScroll = function(){
|
981
|
+
return this.renderer.getAnimatedScroll();
|
982
|
+
};
|
983
|
+
|
984
|
+
/**
|
985
|
+
* Editor.setShowInvisibles(showInvisibles)
|
986
|
+
* - showInvisibles (Boolean): Specifies whether or not to show invisible characters
|
987
|
+
*
|
988
|
+
* If `showInvisibiles` is set to `true`, invisible characters—like spaces or new lines—are show in the editor.
|
989
|
+
**/
|
990
|
+
this.setShowInvisibles = function(showInvisibles) {
|
991
|
+
if (this.getShowInvisibles() == showInvisibles)
|
992
|
+
return;
|
993
|
+
|
994
|
+
this.renderer.setShowInvisibles(showInvisibles);
|
995
|
+
};
|
996
|
+
|
997
|
+
/**
|
998
|
+
* Editor.getShowInvisibles() -> Boolean
|
999
|
+
*
|
1000
|
+
* Returns `true` if invisible characters are being shown.
|
1001
|
+
**/
|
1002
|
+
this.getShowInvisibles = function() {
|
1003
|
+
return this.renderer.getShowInvisibles();
|
1004
|
+
};
|
1005
|
+
|
1006
|
+
/**
|
1007
|
+
* Editor.setShowPrintMargin(showPrintMargin)
|
1008
|
+
* - showPrintMargin (Boolean): Specifies whether or not to show the print margin
|
1009
|
+
*
|
1010
|
+
* If `showPrintMargin` is set to `true`, the print margin is shown in the editor.
|
1011
|
+
**/
|
1012
|
+
this.setShowPrintMargin = function(showPrintMargin) {
|
1013
|
+
this.renderer.setShowPrintMargin(showPrintMargin);
|
1014
|
+
};
|
1015
|
+
|
1016
|
+
/**
|
1017
|
+
* Editor.getShowPrintMargin() -> Boolean
|
1018
|
+
*
|
1019
|
+
* Returns `true` if the print margin is being shown.
|
1020
|
+
**/
|
1021
|
+
this.getShowPrintMargin = function() {
|
1022
|
+
return this.renderer.getShowPrintMargin();
|
1023
|
+
};
|
1024
|
+
|
1025
|
+
/**
|
1026
|
+
* Editor.setPrintMarginColumn(showPrintMargin)
|
1027
|
+
* - showPrintMargin (Number): Specifies the new print margin
|
1028
|
+
*
|
1029
|
+
* Sets the column defining where the print margin should be.
|
1030
|
+
*
|
1031
|
+
**/
|
1032
|
+
this.setPrintMarginColumn = function(showPrintMargin) {
|
1033
|
+
this.renderer.setPrintMarginColumn(showPrintMargin);
|
1034
|
+
};
|
1035
|
+
|
1036
|
+
/**
|
1037
|
+
* Editor.getPrintMarginColumn() -> Number
|
1038
|
+
*
|
1039
|
+
* Returns the column number of where the print margin is.
|
1040
|
+
**/
|
1041
|
+
this.getPrintMarginColumn = function() {
|
1042
|
+
return this.renderer.getPrintMarginColumn();
|
1043
|
+
};
|
1044
|
+
|
1045
|
+
this.$readOnly = false;
|
1046
|
+
/**
|
1047
|
+
* Editor.setReadOnly(readOnly)
|
1048
|
+
* - readOnly (Boolean): Specifies whether the editor can be modified or not
|
1049
|
+
*
|
1050
|
+
* If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change.
|
1051
|
+
**/
|
1052
|
+
this.setReadOnly = function(readOnly) {
|
1053
|
+
this.$readOnly = readOnly;
|
1054
|
+
};
|
1055
|
+
|
1056
|
+
/**
|
1057
|
+
* Editor.getReadOnly() -> Boolean
|
1058
|
+
*
|
1059
|
+
* Returns `true` if the editor is set to read-only mode.
|
1060
|
+
**/
|
1061
|
+
this.getReadOnly = function() {
|
1062
|
+
return this.$readOnly;
|
1063
|
+
};
|
1064
|
+
|
1065
|
+
this.$modeBehaviours = true;
|
1066
|
+
|
1067
|
+
/**
|
1068
|
+
* Editor.setBehavioursEnabled()
|
1069
|
+
* - enabled (Boolean): Enables or disables behaviors
|
1070
|
+
*
|
1071
|
+
* Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef}
|
1072
|
+
**/
|
1073
|
+
this.setBehavioursEnabled = function (enabled) {
|
1074
|
+
this.$modeBehaviours = enabled;
|
1075
|
+
};
|
1076
|
+
|
1077
|
+
/**
|
1078
|
+
* Editor.getBehavioursEnabled() -> Boolean
|
1079
|
+
*
|
1080
|
+
* Returns `true` if the behaviors are currently enabled. {:BehaviorsDef}
|
1081
|
+
**/
|
1082
|
+
this.getBehavioursEnabled = function () {
|
1083
|
+
return this.$modeBehaviours;
|
1084
|
+
};
|
1085
|
+
|
1086
|
+
/**
|
1087
|
+
* Editor.setShowFoldWidgets(show)
|
1088
|
+
* - show (Boolean): Specifies whether the fold widgets are shown
|
1089
|
+
*
|
1090
|
+
* Indicates whether the fold widgets are shown or not.
|
1091
|
+
**/
|
1092
|
+
this.setShowFoldWidgets = function(show) {
|
1093
|
+
var gutter = this.renderer.$gutterLayer;
|
1094
|
+
if (gutter.getShowFoldWidgets() == show)
|
1095
|
+
return;
|
1096
|
+
|
1097
|
+
this.renderer.$gutterLayer.setShowFoldWidgets(show);
|
1098
|
+
this.$showFoldWidgets = show;
|
1099
|
+
this.renderer.updateFull();
|
1100
|
+
};
|
1101
|
+
|
1102
|
+
/**
|
1103
|
+
* Editor.getShowFoldWidgets() -> Boolean
|
1104
|
+
*
|
1105
|
+
* Returns `true` if the fold widgets are shown.
|
1106
|
+
**/
|
1107
|
+
this.getShowFoldWidgets = function() {
|
1108
|
+
return this.renderer.$gutterLayer.getShowFoldWidgets();
|
1109
|
+
};
|
1110
|
+
|
1111
|
+
this.setFadeFoldWidgets = function(show) {
|
1112
|
+
this.renderer.setFadeFoldWidgets(show);
|
1113
|
+
};
|
1114
|
+
|
1115
|
+
this.getFadeFoldWidgets = function() {
|
1116
|
+
return this.renderer.getFadeFoldWidgets();
|
1117
|
+
};
|
1118
|
+
|
1119
|
+
/**
|
1120
|
+
* Editor.remove(dir)
|
1121
|
+
* - dir (String): The direction of the deletion to occur, either "left" or "right"
|
1122
|
+
*
|
1123
|
+
* Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
|
1124
|
+
*
|
1125
|
+
**/
|
1126
|
+
this.remove = function(dir) {
|
1127
|
+
if (this.selection.isEmpty()){
|
1128
|
+
if (dir == "left")
|
1129
|
+
this.selection.selectLeft();
|
1130
|
+
else
|
1131
|
+
this.selection.selectRight();
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
var range = this.getSelectionRange();
|
1135
|
+
if (this.getBehavioursEnabled()) {
|
1136
|
+
var session = this.session;
|
1137
|
+
var state = session.getState(range.start.row);
|
1138
|
+
var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
|
1139
|
+
if (new_range)
|
1140
|
+
range = new_range;
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
this.session.remove(range);
|
1144
|
+
this.clearSelection();
|
1145
|
+
};
|
1146
|
+
|
1147
|
+
/**
|
1148
|
+
* Editor.removeWordRight()
|
1149
|
+
*
|
1150
|
+
* Removes the word directly to the right of the current selection.
|
1151
|
+
**/
|
1152
|
+
this.removeWordRight = function() {
|
1153
|
+
if (this.selection.isEmpty())
|
1154
|
+
this.selection.selectWordRight();
|
1155
|
+
|
1156
|
+
this.session.remove(this.getSelectionRange());
|
1157
|
+
this.clearSelection();
|
1158
|
+
};
|
1159
|
+
|
1160
|
+
/**
|
1161
|
+
* Editor.removeWordLeft()
|
1162
|
+
*
|
1163
|
+
* Removes the word directly to the left of the current selection.
|
1164
|
+
**/
|
1165
|
+
this.removeWordLeft = function() {
|
1166
|
+
if (this.selection.isEmpty())
|
1167
|
+
this.selection.selectWordLeft();
|
1168
|
+
|
1169
|
+
this.session.remove(this.getSelectionRange());
|
1170
|
+
this.clearSelection();
|
1171
|
+
};
|
1172
|
+
|
1173
|
+
/**
|
1174
|
+
* Editor.removeToLineStart()
|
1175
|
+
*
|
1176
|
+
* Removes all the words to the left of the current selection, until the start of the line.
|
1177
|
+
**/
|
1178
|
+
this.removeToLineStart = function() {
|
1179
|
+
if (this.selection.isEmpty())
|
1180
|
+
this.selection.selectLineStart();
|
1181
|
+
|
1182
|
+
this.session.remove(this.getSelectionRange());
|
1183
|
+
this.clearSelection();
|
1184
|
+
};
|
1185
|
+
|
1186
|
+
/**
|
1187
|
+
* Editor.removeToLineEnd()
|
1188
|
+
*
|
1189
|
+
* Removes all the words to the right of the current selection, until the end of the line.
|
1190
|
+
**/
|
1191
|
+
this.removeToLineEnd = function() {
|
1192
|
+
if (this.selection.isEmpty())
|
1193
|
+
this.selection.selectLineEnd();
|
1194
|
+
|
1195
|
+
var range = this.getSelectionRange();
|
1196
|
+
if (range.start.column == range.end.column && range.start.row == range.end.row) {
|
1197
|
+
range.end.column = 0;
|
1198
|
+
range.end.row++;
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
this.session.remove(range);
|
1202
|
+
this.clearSelection();
|
1203
|
+
};
|
1204
|
+
|
1205
|
+
/**
|
1206
|
+
* Editor.splitLine()
|
1207
|
+
*
|
1208
|
+
* Splits the line at the current selection (by inserting an `'\n'`).
|
1209
|
+
**/
|
1210
|
+
this.splitLine = function() {
|
1211
|
+
if (!this.selection.isEmpty()) {
|
1212
|
+
this.session.remove(this.getSelectionRange());
|
1213
|
+
this.clearSelection();
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
var cursor = this.getCursorPosition();
|
1217
|
+
this.insert("\n");
|
1218
|
+
this.moveCursorToPosition(cursor);
|
1219
|
+
};
|
1220
|
+
|
1221
|
+
/**
|
1222
|
+
* Editor.transposeLetters()
|
1223
|
+
*
|
1224
|
+
* Transposes current line.
|
1225
|
+
**/
|
1226
|
+
this.transposeLetters = function() {
|
1227
|
+
if (!this.selection.isEmpty()) {
|
1228
|
+
return;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
var cursor = this.getCursorPosition();
|
1232
|
+
var column = cursor.column;
|
1233
|
+
if (column === 0)
|
1234
|
+
return;
|
1235
|
+
|
1236
|
+
var line = this.session.getLine(cursor.row);
|
1237
|
+
var swap, range;
|
1238
|
+
if (column < line.length) {
|
1239
|
+
swap = line.charAt(column) + line.charAt(column-1);
|
1240
|
+
range = new Range(cursor.row, column-1, cursor.row, column+1);
|
1241
|
+
}
|
1242
|
+
else {
|
1243
|
+
swap = line.charAt(column-1) + line.charAt(column-2);
|
1244
|
+
range = new Range(cursor.row, column-2, cursor.row, column);
|
1245
|
+
}
|
1246
|
+
this.session.replace(range, swap);
|
1247
|
+
};
|
1248
|
+
|
1249
|
+
/**
|
1250
|
+
* Editor.toLowerCase()
|
1251
|
+
*
|
1252
|
+
* Converts the current selection entirely into lowercase.
|
1253
|
+
**/
|
1254
|
+
this.toLowerCase = function() {
|
1255
|
+
var originalRange = this.getSelectionRange();
|
1256
|
+
if (this.selection.isEmpty()) {
|
1257
|
+
this.selection.selectWord();
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
var range = this.getSelectionRange();
|
1261
|
+
var text = this.session.getTextRange(range);
|
1262
|
+
this.session.replace(range, text.toLowerCase());
|
1263
|
+
this.selection.setSelectionRange(originalRange);
|
1264
|
+
};
|
1265
|
+
|
1266
|
+
/**
|
1267
|
+
* Editor.toUpperCase()
|
1268
|
+
*
|
1269
|
+
* Converts the current selection entirely into uppercase.
|
1270
|
+
**/
|
1271
|
+
this.toUpperCase = function() {
|
1272
|
+
var originalRange = this.getSelectionRange();
|
1273
|
+
if (this.selection.isEmpty()) {
|
1274
|
+
this.selection.selectWord();
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
var range = this.getSelectionRange();
|
1278
|
+
var text = this.session.getTextRange(range);
|
1279
|
+
this.session.replace(range, text.toUpperCase());
|
1280
|
+
this.selection.setSelectionRange(originalRange);
|
1281
|
+
};
|
1282
|
+
|
1283
|
+
/** related to: EditSession.indentRows
|
1284
|
+
* Editor.indent()
|
1285
|
+
*
|
1286
|
+
* Indents the current line.
|
1287
|
+
**/
|
1288
|
+
this.indent = function() {
|
1289
|
+
var session = this.session;
|
1290
|
+
var range = this.getSelectionRange();
|
1291
|
+
|
1292
|
+
if (range.start.row < range.end.row || range.start.column < range.end.column) {
|
1293
|
+
var rows = this.$getSelectedRows();
|
1294
|
+
session.indentRows(rows.first, rows.last, "\t");
|
1295
|
+
} else {
|
1296
|
+
var indentString;
|
1297
|
+
|
1298
|
+
if (this.session.getUseSoftTabs()) {
|
1299
|
+
var size = session.getTabSize(),
|
1300
|
+
position = this.getCursorPosition(),
|
1301
|
+
column = session.documentToScreenColumn(position.row, position.column),
|
1302
|
+
count = (size - column % size);
|
1303
|
+
|
1304
|
+
indentString = lang.stringRepeat(" ", count);
|
1305
|
+
} else
|
1306
|
+
indentString = "\t";
|
1307
|
+
return this.insert(indentString);
|
1308
|
+
}
|
1309
|
+
};
|
1310
|
+
|
1311
|
+
/** related to: EditSession.outdentRows
|
1312
|
+
* Editor.blockOutdent()
|
1313
|
+
*
|
1314
|
+
* Outdents the current line.
|
1315
|
+
**/
|
1316
|
+
this.blockOutdent = function() {
|
1317
|
+
var selection = this.session.getSelection();
|
1318
|
+
this.session.outdentRows(selection.getRange());
|
1319
|
+
};
|
1320
|
+
|
1321
|
+
/**
|
1322
|
+
* Editor.toggleCommentLines()
|
1323
|
+
*
|
1324
|
+
* Given the currently selected range, this function either comments all lines or uncomments all lines (depending on whether it's commented or not).
|
1325
|
+
**/
|
1326
|
+
this.toggleCommentLines = function() {
|
1327
|
+
var state = this.session.getState(this.getCursorPosition().row);
|
1328
|
+
var rows = this.$getSelectedRows();
|
1329
|
+
this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
|
1330
|
+
};
|
1331
|
+
|
1332
|
+
/** related to: EditSession.remove
|
1333
|
+
* Editor.removeLines()
|
1334
|
+
*
|
1335
|
+
* Removes all the lines in the current selection
|
1336
|
+
**/
|
1337
|
+
this.removeLines = function() {
|
1338
|
+
var rows = this.$getSelectedRows();
|
1339
|
+
var range;
|
1340
|
+
if (rows.first === 0 || rows.last+1 < this.session.getLength())
|
1341
|
+
range = new Range(rows.first, 0, rows.last+1, 0);
|
1342
|
+
else
|
1343
|
+
range = new Range(
|
1344
|
+
rows.first-1, this.session.getLine(rows.first-1).length,
|
1345
|
+
rows.last, this.session.getLine(rows.last).length
|
1346
|
+
);
|
1347
|
+
this.session.remove(range);
|
1348
|
+
this.clearSelection();
|
1349
|
+
};
|
1350
|
+
|
1351
|
+
this.duplicateSelection = function() {
|
1352
|
+
var sel = this.selection;
|
1353
|
+
var doc = this.session;
|
1354
|
+
var range = sel.getRange();
|
1355
|
+
if (range.isEmpty()) {
|
1356
|
+
var row = range.start.row;
|
1357
|
+
doc.duplicateLines(row, row);
|
1358
|
+
} else {
|
1359
|
+
var reverse = sel.isBackwards()
|
1360
|
+
var point = sel.isBackwards() ? range.start : range.end;
|
1361
|
+
var endPoint = doc.insert(point, doc.getTextRange(range), false);
|
1362
|
+
range.start = point;
|
1363
|
+
range.end = endPoint;
|
1364
|
+
|
1365
|
+
sel.setSelectionRange(range, reverse)
|
1366
|
+
}
|
1367
|
+
};
|
1368
|
+
|
1369
|
+
/** related to: EditSession.moveLinesDown
|
1370
|
+
* Editor.moveLinesDown() -> Number
|
1371
|
+
* + (Number): On success, it returns -1.
|
1372
|
+
*
|
1373
|
+
* Shifts all the selected lines down one row.
|
1374
|
+
*
|
1375
|
+
*
|
1376
|
+
*
|
1377
|
+
**/
|
1378
|
+
this.moveLinesDown = function() {
|
1379
|
+
this.$moveLines(function(firstRow, lastRow) {
|
1380
|
+
return this.session.moveLinesDown(firstRow, lastRow);
|
1381
|
+
});
|
1382
|
+
};
|
1383
|
+
|
1384
|
+
/** related to: EditSession.moveLinesUp
|
1385
|
+
* Editor.moveLinesUp() -> Number
|
1386
|
+
* + (Number): On success, it returns -1.
|
1387
|
+
*
|
1388
|
+
* Shifts all the selected lines up one row.
|
1389
|
+
*
|
1390
|
+
*
|
1391
|
+
**/
|
1392
|
+
this.moveLinesUp = function() {
|
1393
|
+
this.$moveLines(function(firstRow, lastRow) {
|
1394
|
+
return this.session.moveLinesUp(firstRow, lastRow);
|
1395
|
+
});
|
1396
|
+
};
|
1397
|
+
|
1398
|
+
/** related to: EditSession.moveText
|
1399
|
+
* Editor.moveText(fromRange, toPosition) -> Range
|
1400
|
+
* - fromRange (Range): The range of text you want moved within the document
|
1401
|
+
* - toPosition (Object): The location (row and column) where you want to move the text to
|
1402
|
+
* + (Range): The new range where the text was moved to.
|
1403
|
+
*
|
1404
|
+
* Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
|
1405
|
+
*
|
1406
|
+
* { row: newRowLocation, column: newColumnLocation }
|
1407
|
+
*
|
1408
|
+
*
|
1409
|
+
**/
|
1410
|
+
this.moveText = function(range, toPosition) {
|
1411
|
+
if (this.$readOnly)
|
1412
|
+
return null;
|
1413
|
+
|
1414
|
+
return this.session.moveText(range, toPosition);
|
1415
|
+
};
|
1416
|
+
|
1417
|
+
/** related to: EditSession.duplicateLines
|
1418
|
+
* Editor.copyLinesUp() -> Number
|
1419
|
+
* + (Number): On success, returns 0.
|
1420
|
+
*
|
1421
|
+
* Copies all the selected lines up one row.
|
1422
|
+
*
|
1423
|
+
*
|
1424
|
+
**/
|
1425
|
+
this.copyLinesUp = function() {
|
1426
|
+
this.$moveLines(function(firstRow, lastRow) {
|
1427
|
+
this.session.duplicateLines(firstRow, lastRow);
|
1428
|
+
return 0;
|
1429
|
+
});
|
1430
|
+
};
|
1431
|
+
|
1432
|
+
/** related to: EditSession.duplicateLines
|
1433
|
+
* Editor.copyLinesDown() -> Number
|
1434
|
+
* + (Number): On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
|
1435
|
+
*
|
1436
|
+
* Copies all the selected lines down one row.
|
1437
|
+
*
|
1438
|
+
*
|
1439
|
+
*
|
1440
|
+
**/
|
1441
|
+
this.copyLinesDown = function() {
|
1442
|
+
this.$moveLines(function(firstRow, lastRow) {
|
1443
|
+
return this.session.duplicateLines(firstRow, lastRow);
|
1444
|
+
});
|
1445
|
+
};
|
1446
|
+
|
1447
|
+
|
1448
|
+
/**
|
1449
|
+
* Editor.$moveLines(mover)
|
1450
|
+
* - mover (Function): A method to call on each selected row
|
1451
|
+
*
|
1452
|
+
* Executes a specific function, which can be anything that manipulates selected lines, such as copying them, duplicating them, or shifting them.
|
1453
|
+
*
|
1454
|
+
**/
|
1455
|
+
this.$moveLines = function(mover) {
|
1456
|
+
var rows = this.$getSelectedRows();
|
1457
|
+
var selection = this.selection;
|
1458
|
+
if (!selection.isMultiLine()) {
|
1459
|
+
var range = selection.getRange();
|
1460
|
+
var reverse = selection.isBackwards();
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
var linesMoved = mover.call(this, rows.first, rows.last);
|
1464
|
+
|
1465
|
+
if (range) {
|
1466
|
+
range.start.row += linesMoved;
|
1467
|
+
range.end.row += linesMoved;
|
1468
|
+
selection.setSelectionRange(range, reverse);
|
1469
|
+
}
|
1470
|
+
else {
|
1471
|
+
selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
|
1472
|
+
selection.$moveSelection(function() {
|
1473
|
+
selection.moveCursorTo(rows.first+linesMoved, 0);
|
1474
|
+
});
|
1475
|
+
}
|
1476
|
+
};
|
1477
|
+
|
1478
|
+
/**
|
1479
|
+
* Editor.$getSelectedRows() -> Object
|
1480
|
+
*
|
1481
|
+
* Returns an object indicating the currently selected rows. The object looks like this:
|
1482
|
+
*
|
1483
|
+
* { first: range.start.row, last: range.end.row }
|
1484
|
+
*
|
1485
|
+
**/
|
1486
|
+
this.$getSelectedRows = function() {
|
1487
|
+
var range = this.getSelectionRange().collapseRows();
|
1488
|
+
|
1489
|
+
return {
|
1490
|
+
first: range.start.row,
|
1491
|
+
last: range.end.row
|
1492
|
+
};
|
1493
|
+
};
|
1494
|
+
|
1495
|
+
/** internal, hide
|
1496
|
+
* Editor@onCompositionStart(text)
|
1497
|
+
* - text (String): The text being written
|
1498
|
+
*
|
1499
|
+
*
|
1500
|
+
**/
|
1501
|
+
this.onCompositionStart = function(text) {
|
1502
|
+
this.renderer.showComposition(this.getCursorPosition());
|
1503
|
+
};
|
1504
|
+
|
1505
|
+
/** internal, hide
|
1506
|
+
* Editor@onCompositionUpdate(text)
|
1507
|
+
* - text (String): The text being written
|
1508
|
+
*
|
1509
|
+
*
|
1510
|
+
**/
|
1511
|
+
this.onCompositionUpdate = function(text) {
|
1512
|
+
this.renderer.setCompositionText(text);
|
1513
|
+
};
|
1514
|
+
|
1515
|
+
/** internal, hide
|
1516
|
+
* Editor@onCompositionEnd()
|
1517
|
+
*
|
1518
|
+
*
|
1519
|
+
**/
|
1520
|
+
this.onCompositionEnd = function() {
|
1521
|
+
this.renderer.hideComposition();
|
1522
|
+
};
|
1523
|
+
|
1524
|
+
/** related to: VirtualRenderer.getFirstVisibleRow
|
1525
|
+
* Editor.getFirstVisibleRow() -> Number
|
1526
|
+
*
|
1527
|
+
* {:VirtualRenderer.getFirstVisibleRow}
|
1528
|
+
**/
|
1529
|
+
this.getFirstVisibleRow = function() {
|
1530
|
+
return this.renderer.getFirstVisibleRow();
|
1531
|
+
};
|
1532
|
+
|
1533
|
+
/** related to: VirtualRenderer.getLastVisibleRow
|
1534
|
+
* Editor.getLastVisibleRow() -> Number
|
1535
|
+
*
|
1536
|
+
* {:VirtualRenderer.getLastVisibleRow}
|
1537
|
+
**/
|
1538
|
+
this.getLastVisibleRow = function() {
|
1539
|
+
return this.renderer.getLastVisibleRow();
|
1540
|
+
};
|
1541
|
+
|
1542
|
+
/**
|
1543
|
+
* Editor.isRowVisible(row) -> Boolean
|
1544
|
+
* - row (Number): The row to check
|
1545
|
+
*
|
1546
|
+
* Indicates if the row is currently visible on the screen.
|
1547
|
+
**/
|
1548
|
+
this.isRowVisible = function(row) {
|
1549
|
+
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
1550
|
+
};
|
1551
|
+
|
1552
|
+
/**
|
1553
|
+
* Editor.isRowFullyVisible(row) -> Boolean
|
1554
|
+
* - row (Number): The row to check
|
1555
|
+
*
|
1556
|
+
* Indicates if the entire row is currently visible on the screen.
|
1557
|
+
**/
|
1558
|
+
this.isRowFullyVisible = function(row) {
|
1559
|
+
return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
|
1560
|
+
};
|
1561
|
+
|
1562
|
+
/**
|
1563
|
+
* Editor.$getVisibleRowCount() -> Number
|
1564
|
+
*
|
1565
|
+
* Returns the number of currently visibile rows.
|
1566
|
+
**/
|
1567
|
+
this.$getVisibleRowCount = function() {
|
1568
|
+
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
|
1569
|
+
};
|
1570
|
+
|
1571
|
+
this.$moveByPage = function(dir, select) {
|
1572
|
+
var renderer = this.renderer;
|
1573
|
+
var config = this.renderer.layerConfig;
|
1574
|
+
var rows = dir * Math.floor(config.height / config.lineHeight);
|
1575
|
+
|
1576
|
+
this.$blockScrolling++;
|
1577
|
+
if (select == true) {
|
1578
|
+
this.selection.$moveSelection(function(){
|
1579
|
+
this.moveCursorBy(rows, 0);
|
1580
|
+
});
|
1581
|
+
} else if (select == false) {
|
1582
|
+
this.selection.moveCursorBy(rows, 0);
|
1583
|
+
this.selection.clearSelection();
|
1584
|
+
}
|
1585
|
+
this.$blockScrolling--;
|
1586
|
+
|
1587
|
+
var scrollTop = renderer.scrollTop;
|
1588
|
+
|
1589
|
+
renderer.scrollBy(0, rows * config.lineHeight);
|
1590
|
+
if (select != null)
|
1591
|
+
renderer.scrollCursorIntoView(null, 0.5);
|
1592
|
+
|
1593
|
+
renderer.animateScrolling(scrollTop);
|
1594
|
+
};
|
1595
|
+
|
1596
|
+
/**
|
1597
|
+
* Editor.selectPageDown()
|
1598
|
+
*
|
1599
|
+
* Selects the text from the current position of the document until where a "page down" finishes.
|
1600
|
+
**/
|
1601
|
+
this.selectPageDown = function() {
|
1602
|
+
this.$moveByPage(1, true);
|
1603
|
+
};
|
1604
|
+
|
1605
|
+
/**
|
1606
|
+
* Editor.selectPageUp()
|
1607
|
+
*
|
1608
|
+
* Selects the text from the current position of the document until where a "page up" finishes.
|
1609
|
+
**/
|
1610
|
+
this.selectPageUp = function() {
|
1611
|
+
this.$moveByPage(-1, true);
|
1612
|
+
};
|
1613
|
+
|
1614
|
+
/**
|
1615
|
+
* Editor.gotoPageDown()
|
1616
|
+
*
|
1617
|
+
* Shifts the document to wherever "page down" is, as well as moving the cursor position.
|
1618
|
+
**/
|
1619
|
+
this.gotoPageDown = function() {
|
1620
|
+
this.$moveByPage(1, false);
|
1621
|
+
};
|
1622
|
+
|
1623
|
+
/**
|
1624
|
+
* Editor.gotoPageUp()
|
1625
|
+
*
|
1626
|
+
* Shifts the document to wherever "page up" is, as well as moving the cursor position.
|
1627
|
+
**/
|
1628
|
+
this.gotoPageUp = function() {
|
1629
|
+
this.$moveByPage(-1, false);
|
1630
|
+
};
|
1631
|
+
|
1632
|
+
/**
|
1633
|
+
* Editor.scrollPageDown()
|
1634
|
+
*
|
1635
|
+
* Scrolls the document to wherever "page down" is, without changing the cursor position.
|
1636
|
+
**/
|
1637
|
+
this.scrollPageDown = function() {
|
1638
|
+
this.$moveByPage(1);
|
1639
|
+
};
|
1640
|
+
|
1641
|
+
/**
|
1642
|
+
* Editor.scrollPageUp()
|
1643
|
+
*
|
1644
|
+
* Scrolls the document to wherever "page up" is, without changing the cursor position.
|
1645
|
+
**/
|
1646
|
+
this.scrollPageUp = function() {
|
1647
|
+
this.$moveByPage(-1);
|
1648
|
+
};
|
1649
|
+
|
1650
|
+
/** related to: VirtualRenderer.scrollToRow
|
1651
|
+
* Editor.scrollToRow(row)
|
1652
|
+
* - row (Number): The row to move to
|
1653
|
+
*
|
1654
|
+
* Moves the editor to the specified row.
|
1655
|
+
*
|
1656
|
+
**/
|
1657
|
+
this.scrollToRow = function(row) {
|
1658
|
+
this.renderer.scrollToRow(row);
|
1659
|
+
};
|
1660
|
+
|
1661
|
+
/** related to: VirtualRenderer.scrollToLine
|
1662
|
+
* Editor.scrollToLine(line, center)
|
1663
|
+
* - line (Number): The line to scroll to
|
1664
|
+
* - center (Boolean): If `true`
|
1665
|
+
* - animate (Boolean): If `true` animates scrolling
|
1666
|
+
* - callback (Function): Function to be called when the animation has finished
|
1667
|
+
*
|
1668
|
+
* TODO scrolls a to line, if center == true, puts line in middle of screen or attempts to)
|
1669
|
+
**/
|
1670
|
+
this.scrollToLine = function(line, center, animate, callback) {
|
1671
|
+
this.renderer.scrollToLine(line, center, animate, callback);
|
1672
|
+
};
|
1673
|
+
|
1674
|
+
/**
|
1675
|
+
* Editor.centerSelection()
|
1676
|
+
*
|
1677
|
+
* Attempts to center the current selection on the screen.
|
1678
|
+
**/
|
1679
|
+
this.centerSelection = function() {
|
1680
|
+
var range = this.getSelectionRange();
|
1681
|
+
var pos = {
|
1682
|
+
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
|
1683
|
+
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
|
1684
|
+
}
|
1685
|
+
this.renderer.alignCursor(pos, 0.5);
|
1686
|
+
};
|
1687
|
+
|
1688
|
+
/** related to: Selection.getCursor
|
1689
|
+
* Editor.getCursorPosition() -> Object
|
1690
|
+
* + (Object): This returns an object that looks something like this:<br/>
|
1691
|
+
* ```{ row: currRow, column: currCol }```
|
1692
|
+
*
|
1693
|
+
* Gets the current position of the cursor.
|
1694
|
+
*
|
1695
|
+
*
|
1696
|
+
*
|
1697
|
+
**/
|
1698
|
+
this.getCursorPosition = function() {
|
1699
|
+
return this.selection.getCursor();
|
1700
|
+
};
|
1701
|
+
|
1702
|
+
/** related to: EditSession.documentToScreenPosition
|
1703
|
+
* Editor.getCursorPositionScreen() -> Number
|
1704
|
+
*
|
1705
|
+
* Returns the screen position of the cursor.
|
1706
|
+
**/
|
1707
|
+
this.getCursorPositionScreen = function() {
|
1708
|
+
return this.session.documentToScreenPosition(this.getCursorPosition());
|
1709
|
+
};
|
1710
|
+
|
1711
|
+
/** related to: Selection.getRange
|
1712
|
+
* Editor.getSelectionRange() -> Range
|
1713
|
+
*
|
1714
|
+
* {:Selection.getRange}
|
1715
|
+
**/
|
1716
|
+
this.getSelectionRange = function() {
|
1717
|
+
return this.selection.getRange();
|
1718
|
+
};
|
1719
|
+
|
1720
|
+
|
1721
|
+
/** related to: Selection.selectAll
|
1722
|
+
* Editor.selectAll()
|
1723
|
+
*
|
1724
|
+
* Selects all the text in editor.
|
1725
|
+
**/
|
1726
|
+
this.selectAll = function() {
|
1727
|
+
this.$blockScrolling += 1;
|
1728
|
+
this.selection.selectAll();
|
1729
|
+
this.$blockScrolling -= 1;
|
1730
|
+
};
|
1731
|
+
|
1732
|
+
/** related to: Selection.clearSelection
|
1733
|
+
* Editor.clearSelection()
|
1734
|
+
*
|
1735
|
+
* {:Selection.clearSelection}
|
1736
|
+
**/
|
1737
|
+
this.clearSelection = function() {
|
1738
|
+
this.selection.clearSelection();
|
1739
|
+
};
|
1740
|
+
|
1741
|
+
/** related to: Selection.moveCursorTo
|
1742
|
+
* Editor.moveCursorTo(row, column)
|
1743
|
+
* - row (Number): The new row number
|
1744
|
+
* - column (Number): The new column number
|
1745
|
+
*
|
1746
|
+
* Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
|
1747
|
+
*
|
1748
|
+
**/
|
1749
|
+
this.moveCursorTo = function(row, column) {
|
1750
|
+
this.selection.moveCursorTo(row, column);
|
1751
|
+
};
|
1752
|
+
|
1753
|
+
/** related to: Selection.moveCursorToPosition
|
1754
|
+
* Editor.moveCursorToPosition(pos)
|
1755
|
+
* - pos (Object): An object with two properties, row and column
|
1756
|
+
*
|
1757
|
+
* Moves the cursor to the position indicated by `pos.row` and `pos.column`.
|
1758
|
+
*
|
1759
|
+
**/
|
1760
|
+
this.moveCursorToPosition = function(pos) {
|
1761
|
+
this.selection.moveCursorToPosition(pos);
|
1762
|
+
};
|
1763
|
+
|
1764
|
+
/**
|
1765
|
+
* Editor.jumpToMatching()
|
1766
|
+
*
|
1767
|
+
* Moves the cursor's row and column to the next matching bracket.
|
1768
|
+
*
|
1769
|
+
**/
|
1770
|
+
this.jumpToMatching = function(select) {
|
1771
|
+
var cursor = this.getCursorPosition();
|
1772
|
+
|
1773
|
+
var range = this.session.getBracketRange(cursor);
|
1774
|
+
if (!range) {
|
1775
|
+
range = this.find({
|
1776
|
+
needle: /[{}()\[\]]/g,
|
1777
|
+
preventScroll:true,
|
1778
|
+
start: {row: cursor.row, column: cursor.column - 1}
|
1779
|
+
});
|
1780
|
+
if (!range)
|
1781
|
+
return;
|
1782
|
+
var pos = range.start;
|
1783
|
+
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
|
1784
|
+
range = this.session.getBracketRange(pos);
|
1785
|
+
}
|
1786
|
+
|
1787
|
+
pos = range && range.cursor || pos;
|
1788
|
+
if (pos) {
|
1789
|
+
if (select) {
|
1790
|
+
if (range && range.isEqual(this.getSelectionRange()))
|
1791
|
+
this.clearSelection();
|
1792
|
+
else
|
1793
|
+
this.selection.selectTo(pos.row, pos.column);
|
1794
|
+
} else {
|
1795
|
+
this.clearSelection();
|
1796
|
+
this.moveCursorTo(pos.row, pos.column);
|
1797
|
+
}
|
1798
|
+
}
|
1799
|
+
};
|
1800
|
+
|
1801
|
+
/**
|
1802
|
+
* Editor.gotoLine(lineNumber, column)
|
1803
|
+
* - lineNumber (Number): The line number to go to
|
1804
|
+
* - column (Number): A column number to go to
|
1805
|
+
* - animate (Boolean): If `true` animates scolling
|
1806
|
+
*
|
1807
|
+
* Moves the cursor to the specified line number, and also into the indiciated column.
|
1808
|
+
*
|
1809
|
+
**/
|
1810
|
+
this.gotoLine = function(lineNumber, column, animate) {
|
1811
|
+
this.selection.clearSelection();
|
1812
|
+
this.session.unfold({row: lineNumber - 1, column: column || 0});
|
1813
|
+
|
1814
|
+
this.$blockScrolling += 1;
|
1815
|
+
this.moveCursorTo(lineNumber - 1, column || 0);
|
1816
|
+
this.$blockScrolling -= 1;
|
1817
|
+
|
1818
|
+
if (!this.isRowFullyVisible(lineNumber - 1))
|
1819
|
+
this.scrollToLine(lineNumber - 1, true, animate);
|
1820
|
+
};
|
1821
|
+
|
1822
|
+
/** related to: Editor.moveCursorTo
|
1823
|
+
* Editor.navigateTo(row, column)
|
1824
|
+
* - row (Number): The new row number
|
1825
|
+
* - column (Number): The new column number
|
1826
|
+
*
|
1827
|
+
* Moves the cursor to the specified row and column. Note that this does de-select the current selection.
|
1828
|
+
*
|
1829
|
+
**/
|
1830
|
+
this.navigateTo = function(row, column) {
|
1831
|
+
this.clearSelection();
|
1832
|
+
this.moveCursorTo(row, column);
|
1833
|
+
};
|
1834
|
+
|
1835
|
+
/**
|
1836
|
+
* Editor.navigateUp(times)
|
1837
|
+
* - times (Number): The number of times to change navigation
|
1838
|
+
*
|
1839
|
+
* Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
|
1840
|
+
**/
|
1841
|
+
this.navigateUp = function(times) {
|
1842
|
+
this.selection.clearSelection();
|
1843
|
+
times = times || 1;
|
1844
|
+
this.selection.moveCursorBy(-times, 0);
|
1845
|
+
};
|
1846
|
+
|
1847
|
+
/**
|
1848
|
+
* Editor.navigateDown(times)
|
1849
|
+
* - times (Number): The number of times to change navigation
|
1850
|
+
*
|
1851
|
+
* Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
|
1852
|
+
**/
|
1853
|
+
this.navigateDown = function(times) {
|
1854
|
+
this.selection.clearSelection();
|
1855
|
+
times = times || 1;
|
1856
|
+
this.selection.moveCursorBy(times, 0);
|
1857
|
+
};
|
1858
|
+
|
1859
|
+
/**
|
1860
|
+
* Editor.navigateLeft(times)
|
1861
|
+
* - times (Number): The number of times to change navigation
|
1862
|
+
*
|
1863
|
+
* Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
|
1864
|
+
**/
|
1865
|
+
this.navigateLeft = function(times) {
|
1866
|
+
if (!this.selection.isEmpty()) {
|
1867
|
+
var selectionStart = this.getSelectionRange().start;
|
1868
|
+
this.moveCursorToPosition(selectionStart);
|
1869
|
+
}
|
1870
|
+
else {
|
1871
|
+
times = times || 1;
|
1872
|
+
while (times--) {
|
1873
|
+
this.selection.moveCursorLeft();
|
1874
|
+
}
|
1875
|
+
}
|
1876
|
+
this.clearSelection();
|
1877
|
+
};
|
1878
|
+
|
1879
|
+
/**
|
1880
|
+
* Editor.navigateRight(times)
|
1881
|
+
* - times (Number): The number of times to change navigation
|
1882
|
+
*
|
1883
|
+
* Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
|
1884
|
+
**/
|
1885
|
+
this.navigateRight = function(times) {
|
1886
|
+
if (!this.selection.isEmpty()) {
|
1887
|
+
var selectionEnd = this.getSelectionRange().end;
|
1888
|
+
this.moveCursorToPosition(selectionEnd);
|
1889
|
+
}
|
1890
|
+
else {
|
1891
|
+
times = times || 1;
|
1892
|
+
while (times--) {
|
1893
|
+
this.selection.moveCursorRight();
|
1894
|
+
}
|
1895
|
+
}
|
1896
|
+
this.clearSelection();
|
1897
|
+
};
|
1898
|
+
|
1899
|
+
/**
|
1900
|
+
* Editor.navigateLineStart()
|
1901
|
+
*
|
1902
|
+
* Moves the cursor to the start of the current line. Note that this does de-select the current selection.
|
1903
|
+
**/
|
1904
|
+
this.navigateLineStart = function() {
|
1905
|
+
this.selection.moveCursorLineStart();
|
1906
|
+
this.clearSelection();
|
1907
|
+
};
|
1908
|
+
|
1909
|
+
/**
|
1910
|
+
* Editor.navigateLineEnd()
|
1911
|
+
*
|
1912
|
+
* Moves the cursor to the end of the current line. Note that this does de-select the current selection.
|
1913
|
+
**/
|
1914
|
+
this.navigateLineEnd = function() {
|
1915
|
+
this.selection.moveCursorLineEnd();
|
1916
|
+
this.clearSelection();
|
1917
|
+
};
|
1918
|
+
|
1919
|
+
/**
|
1920
|
+
* Editor.navigateFileEnd()
|
1921
|
+
*
|
1922
|
+
* Moves the cursor to the end of the current file. Note that this does de-select the current selection.
|
1923
|
+
**/
|
1924
|
+
this.navigateFileEnd = function() {
|
1925
|
+
var scrollTop = this.renderer.scrollTop;
|
1926
|
+
this.selection.moveCursorFileEnd();
|
1927
|
+
this.clearSelection();
|
1928
|
+
this.renderer.animateScrolling(scrollTop);
|
1929
|
+
};
|
1930
|
+
|
1931
|
+
/**
|
1932
|
+
* Editor.navigateFileStart()
|
1933
|
+
*
|
1934
|
+
* Moves the cursor to the start of the current file. Note that this does de-select the current selection.
|
1935
|
+
**/
|
1936
|
+
this.navigateFileStart = function() {
|
1937
|
+
var scrollTop = this.renderer.scrollTop;
|
1938
|
+
this.selection.moveCursorFileStart();
|
1939
|
+
this.clearSelection();
|
1940
|
+
this.renderer.animateScrolling(scrollTop);
|
1941
|
+
};
|
1942
|
+
|
1943
|
+
/**
|
1944
|
+
* Editor.navigateWordRight()
|
1945
|
+
*
|
1946
|
+
* Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.
|
1947
|
+
**/
|
1948
|
+
this.navigateWordRight = function() {
|
1949
|
+
this.selection.moveCursorWordRight();
|
1950
|
+
this.clearSelection();
|
1951
|
+
};
|
1952
|
+
|
1953
|
+
/**
|
1954
|
+
* Editor.navigateWordLeft()
|
1955
|
+
*
|
1956
|
+
* Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.
|
1957
|
+
**/
|
1958
|
+
this.navigateWordLeft = function() {
|
1959
|
+
this.selection.moveCursorWordLeft();
|
1960
|
+
this.clearSelection();
|
1961
|
+
};
|
1962
|
+
|
1963
|
+
/**
|
1964
|
+
* Editor.replace(replacement, options)
|
1965
|
+
* - replacement (String): The text to replace with
|
1966
|
+
* - options (Object): The [[Search `Search`]] options to use
|
1967
|
+
*
|
1968
|
+
* Replaces the first occurance of `options.needle` with the value in `replacement`.
|
1969
|
+
**/
|
1970
|
+
this.replace = function(replacement, options) {
|
1971
|
+
if (options)
|
1972
|
+
this.$search.set(options);
|
1973
|
+
|
1974
|
+
var range = this.$search.find(this.session);
|
1975
|
+
var replaced = 0;
|
1976
|
+
if (!range)
|
1977
|
+
return replaced;
|
1978
|
+
|
1979
|
+
if (this.$tryReplace(range, replacement)) {
|
1980
|
+
replaced = 1;
|
1981
|
+
}
|
1982
|
+
if (range !== null) {
|
1983
|
+
this.selection.setSelectionRange(range);
|
1984
|
+
this.renderer.scrollSelectionIntoView(range.start, range.end);
|
1985
|
+
}
|
1986
|
+
|
1987
|
+
return replaced;
|
1988
|
+
};
|
1989
|
+
|
1990
|
+
/**
|
1991
|
+
* Editor.replaceAll(replacement, options)
|
1992
|
+
* - replacement (String): The text to replace with
|
1993
|
+
* - options (Object): The [[Search `Search`]] options to use
|
1994
|
+
*
|
1995
|
+
* Replaces all occurances of `options.needle` with the value in `replacement`.
|
1996
|
+
**/
|
1997
|
+
this.replaceAll = function(replacement, options) {
|
1998
|
+
if (options) {
|
1999
|
+
this.$search.set(options);
|
2000
|
+
}
|
2001
|
+
|
2002
|
+
var ranges = this.$search.findAll(this.session);
|
2003
|
+
var replaced = 0;
|
2004
|
+
if (!ranges.length)
|
2005
|
+
return replaced;
|
2006
|
+
|
2007
|
+
this.$blockScrolling += 1;
|
2008
|
+
|
2009
|
+
var selection = this.getSelectionRange();
|
2010
|
+
this.clearSelection();
|
2011
|
+
this.selection.moveCursorTo(0, 0);
|
2012
|
+
|
2013
|
+
for (var i = ranges.length - 1; i >= 0; --i) {
|
2014
|
+
if(this.$tryReplace(ranges[i], replacement)) {
|
2015
|
+
replaced++;
|
2016
|
+
}
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
this.selection.setSelectionRange(selection);
|
2020
|
+
this.$blockScrolling -= 1;
|
2021
|
+
|
2022
|
+
return replaced;
|
2023
|
+
};
|
2024
|
+
|
2025
|
+
this.$tryReplace = function(range, replacement) {
|
2026
|
+
var input = this.session.getTextRange(range);
|
2027
|
+
replacement = this.$search.replace(input, replacement);
|
2028
|
+
if (replacement !== null) {
|
2029
|
+
range.end = this.session.replace(range, replacement);
|
2030
|
+
return range;
|
2031
|
+
} else {
|
2032
|
+
return null;
|
2033
|
+
}
|
2034
|
+
};
|
2035
|
+
|
2036
|
+
/** related to: Search.getOptions
|
2037
|
+
* Editor.getLastSearchOptions() -> Object
|
2038
|
+
*
|
2039
|
+
* {:Search.getOptions} For more information on `options`, see [[Search `Search`]].
|
2040
|
+
**/
|
2041
|
+
this.getLastSearchOptions = function() {
|
2042
|
+
return this.$search.getOptions();
|
2043
|
+
};
|
2044
|
+
|
2045
|
+
/** related to: Search.find
|
2046
|
+
* Editor.find(needle, options)
|
2047
|
+
* - needle (String): The text to search for (optional)
|
2048
|
+
* - options (Object): An object defining various search properties
|
2049
|
+
* - animate (Boolean): If `true` animate scrolling
|
2050
|
+
*
|
2051
|
+
* Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
|
2052
|
+
**/
|
2053
|
+
this.find = function(needle, options, animate) {
|
2054
|
+
if (!options)
|
2055
|
+
options = {};
|
2056
|
+
|
2057
|
+
if (typeof needle == "string" || needle instanceof RegExp)
|
2058
|
+
options.needle = needle;
|
2059
|
+
else if (typeof needle == "object")
|
2060
|
+
oop.mixin(options, needle);
|
2061
|
+
|
2062
|
+
var range = this.selection.getRange();
|
2063
|
+
if (options.needle == null) {
|
2064
|
+
needle = this.session.getTextRange(range)
|
2065
|
+
|| this.$search.$options.needle;
|
2066
|
+
if (!needle) {
|
2067
|
+
range = this.session.getWordRange(range.start.row, range.start.column);
|
2068
|
+
needle = this.session.getTextRange(range);
|
2069
|
+
}
|
2070
|
+
this.$search.set({needle: needle});
|
2071
|
+
}
|
2072
|
+
|
2073
|
+
this.$search.set(options);
|
2074
|
+
if (!options.start)
|
2075
|
+
this.$search.set({start: range});
|
2076
|
+
|
2077
|
+
var newRange = this.$search.find(this.session);
|
2078
|
+
if (options.preventScroll)
|
2079
|
+
return newRange;
|
2080
|
+
if (newRange) {
|
2081
|
+
this.revealRange(newRange, animate);
|
2082
|
+
return newRange;
|
2083
|
+
}
|
2084
|
+
// clear selection if nothing is found
|
2085
|
+
if (options.backwards)
|
2086
|
+
range.start = range.end;
|
2087
|
+
else
|
2088
|
+
range.end = range.start;
|
2089
|
+
this.selection.setRange(range);
|
2090
|
+
};
|
2091
|
+
|
2092
|
+
/** related to: Editor.find
|
2093
|
+
* Editor.findNext(options)
|
2094
|
+
* - options (Object): search options
|
2095
|
+
* - animate (Boolean): If `true` animate scrolling
|
2096
|
+
*
|
2097
|
+
* Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]].
|
2098
|
+
**/
|
2099
|
+
this.findNext = function(options, animate) {
|
2100
|
+
this.find({skipCurrent: true, backwards: false}, options, animate);
|
2101
|
+
};
|
2102
|
+
|
2103
|
+
/** related to: Editor.find
|
2104
|
+
* Editor.findPrevious(options)
|
2105
|
+
* - options (Object): search options
|
2106
|
+
* - animate (Boolean): If `true` animate scrolling
|
2107
|
+
*
|
2108
|
+
* Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]].
|
2109
|
+
**/
|
2110
|
+
this.findPrevious = function(options, animate) {
|
2111
|
+
this.find(options, {skipCurrent: true, backwards: true}, animate);
|
2112
|
+
};
|
2113
|
+
|
2114
|
+
this.revealRange = function(range, animate) {
|
2115
|
+
this.$blockScrolling += 1;
|
2116
|
+
this.session.unfold(range);
|
2117
|
+
this.selection.setSelectionRange(range);
|
2118
|
+
this.$blockScrolling -= 1;
|
2119
|
+
|
2120
|
+
var scrollTop = this.renderer.scrollTop;
|
2121
|
+
this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
|
2122
|
+
if (animate != false)
|
2123
|
+
this.renderer.animateScrolling(scrollTop);
|
2124
|
+
};
|
2125
|
+
|
2126
|
+
/** related to: UndoManager.undo
|
2127
|
+
* Editor.undo()
|
2128
|
+
*
|
2129
|
+
* {:UndoManager.undo}
|
2130
|
+
**/
|
2131
|
+
this.undo = function() {
|
2132
|
+
this.$blockScrolling++;
|
2133
|
+
this.session.getUndoManager().undo();
|
2134
|
+
this.$blockScrolling--;
|
2135
|
+
this.renderer.scrollCursorIntoView(null, 0.5);
|
2136
|
+
};
|
2137
|
+
|
2138
|
+
/** related to: UndoManager.redo
|
2139
|
+
* Editor.redo()
|
2140
|
+
*
|
2141
|
+
* {:UndoManager.redo}
|
2142
|
+
**/
|
2143
|
+
this.redo = function() {
|
2144
|
+
this.$blockScrolling++;
|
2145
|
+
this.session.getUndoManager().redo();
|
2146
|
+
this.$blockScrolling--;
|
2147
|
+
this.renderer.scrollCursorIntoView(null, 0.5);
|
2148
|
+
};
|
2149
|
+
|
2150
|
+
/**
|
2151
|
+
* Editor.destroy()
|
2152
|
+
*
|
2153
|
+
* Cleans up the entire editor.
|
2154
|
+
**/
|
2155
|
+
this.destroy = function() {
|
2156
|
+
this.renderer.destroy();
|
2157
|
+
};
|
2158
|
+
|
2159
|
+
}).call(Editor.prototype);
|
2160
|
+
|
2161
|
+
|
2162
|
+
exports.Editor = Editor;
|
2163
|
+
});
|