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,981 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Ajax.org Code Editor (ACE).
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Ajax.org B.V.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2010
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Fabian Jakobs <fabian AT ajax DOT org>
|
23
|
+
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
24
|
+
*
|
25
|
+
* Alternatively, the contents of this file may be used under the terms of
|
26
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
27
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
28
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
29
|
+
* of those above. If you wish to allow use of your version of this file only
|
30
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
31
|
+
* use your version of this file under the terms of the MPL, indicate your
|
32
|
+
* decision by deleting the provisions above and replace them with the notice
|
33
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
34
|
+
* the provisions above, a recipient may use your version of this file under
|
35
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
36
|
+
*
|
37
|
+
* ***** END LICENSE BLOCK ***** */
|
38
|
+
|
39
|
+
if (typeof process !== "undefined") {
|
40
|
+
require("amd-loader");
|
41
|
+
require("./test/mockdom");
|
42
|
+
}
|
43
|
+
|
44
|
+
define(function(require, exports, module) {
|
45
|
+
"use strict";
|
46
|
+
|
47
|
+
var lang = require("./lib/lang");
|
48
|
+
var EditSession = require("./edit_session").EditSession;
|
49
|
+
var Editor = require("./editor").Editor;
|
50
|
+
var UndoManager = require("./undomanager").UndoManager;
|
51
|
+
var MockRenderer = require("./test/mockrenderer").MockRenderer;
|
52
|
+
var Range = require("./range").Range;
|
53
|
+
var assert = require("./test/assertions");
|
54
|
+
var JavaScriptMode = require("./mode/javascript").Mode;
|
55
|
+
|
56
|
+
function createFoldTestSession() {
|
57
|
+
var lines = [
|
58
|
+
"function foo(items) {",
|
59
|
+
" for (var i=0; i<items.length; i++) {",
|
60
|
+
" alert(items[i] + \"juhu\");",
|
61
|
+
" } // Real Tab.",
|
62
|
+
"}"
|
63
|
+
];
|
64
|
+
var session = new EditSession(lines.join("\n"));
|
65
|
+
session.setUndoManager(new UndoManager());
|
66
|
+
session.addFold("args...", new Range(0, 13, 0, 18));
|
67
|
+
session.addFold("foo...", new Range(1, 10, 2, 10));
|
68
|
+
session.addFold("bar...", new Range(2, 20, 2, 25));
|
69
|
+
return session;
|
70
|
+
}
|
71
|
+
|
72
|
+
module.exports = {
|
73
|
+
|
74
|
+
"test: find matching opening bracket in Text mode" : function() {
|
75
|
+
var session = new EditSession(["(()(", "())))"]);
|
76
|
+
|
77
|
+
assert.position(session.findMatchingBracket({row: 0, column: 3}), 0, 1);
|
78
|
+
assert.position(session.findMatchingBracket({row: 1, column: 2}), 1, 0);
|
79
|
+
assert.position(session.findMatchingBracket({row: 1, column: 3}), 0, 3);
|
80
|
+
assert.position(session.findMatchingBracket({row: 1, column: 4}), 0, 0);
|
81
|
+
assert.equal(session.findMatchingBracket({row: 1, column: 5}), null);
|
82
|
+
},
|
83
|
+
|
84
|
+
"test: find matching closing bracket in Text mode" : function() {
|
85
|
+
var session = new EditSession(["(()(", "())))"]);
|
86
|
+
|
87
|
+
assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
|
88
|
+
assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
|
89
|
+
assert.position(session.findMatchingBracket({row: 0, column: 4}), 1, 2);
|
90
|
+
assert.position(session.findMatchingBracket({row: 0, column: 2}), 0, 2);
|
91
|
+
assert.position(session.findMatchingBracket({row: 0, column: 1}), 1, 3);
|
92
|
+
assert.equal(session.findMatchingBracket({row: 0, column: 0}), null);
|
93
|
+
},
|
94
|
+
|
95
|
+
"test: find matching opening bracket in JavaScript mode" : function() {
|
96
|
+
var lines = [
|
97
|
+
"function foo() {",
|
98
|
+
" var str = \"{ foo()\";",
|
99
|
+
" if (debug) {",
|
100
|
+
" // write str (a string) to the console",
|
101
|
+
" console.log(str);",
|
102
|
+
" }",
|
103
|
+
" str += \" bar() }\";",
|
104
|
+
"}"
|
105
|
+
];
|
106
|
+
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
|
107
|
+
|
108
|
+
assert.position(session.findMatchingBracket({row: 0, column: 14}), 0, 12);
|
109
|
+
assert.position(session.findMatchingBracket({row: 7, column: 1}), 0, 15);
|
110
|
+
assert.position(session.findMatchingBracket({row: 6, column: 20}), 1, 15);
|
111
|
+
assert.position(session.findMatchingBracket({row: 1, column: 22}), 1, 20);
|
112
|
+
assert.position(session.findMatchingBracket({row: 3, column: 31}), 3, 21);
|
113
|
+
assert.position(session.findMatchingBracket({row: 4, column: 24}), 4, 19);
|
114
|
+
assert.equal(session.findMatchingBracket({row: 0, column: 1}), null);
|
115
|
+
},
|
116
|
+
|
117
|
+
"test: find matching closing bracket in JavaScript mode" : function() {
|
118
|
+
var lines = [
|
119
|
+
"function foo() {",
|
120
|
+
" var str = \"{ foo()\";",
|
121
|
+
" if (debug) {",
|
122
|
+
" // write str (a string) to the console",
|
123
|
+
" console.log(str);",
|
124
|
+
" }",
|
125
|
+
" str += \" bar() }\";",
|
126
|
+
"}"
|
127
|
+
];
|
128
|
+
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
|
129
|
+
|
130
|
+
assert.position(session.findMatchingBracket({row: 0, column: 13}), 0, 13);
|
131
|
+
assert.position(session.findMatchingBracket({row: 0, column: 16}), 7, 0);
|
132
|
+
assert.position(session.findMatchingBracket({row: 1, column: 16}), 6, 19);
|
133
|
+
assert.position(session.findMatchingBracket({row: 1, column: 21}), 1, 21);
|
134
|
+
assert.position(session.findMatchingBracket({row: 3, column: 22}), 3, 30);
|
135
|
+
assert.position(session.findMatchingBracket({row: 4, column: 20}), 4, 23);
|
136
|
+
},
|
137
|
+
|
138
|
+
"test: handle unbalanced brackets in JavaScript mode" : function() {
|
139
|
+
var lines = [
|
140
|
+
"function foo() {",
|
141
|
+
" var str = \"{ foo()\";",
|
142
|
+
" if (debug) {",
|
143
|
+
" // write str a string) to the console",
|
144
|
+
" console.log(str);",
|
145
|
+
" ",
|
146
|
+
" str += \" bar() \";",
|
147
|
+
"}"
|
148
|
+
];
|
149
|
+
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
|
150
|
+
|
151
|
+
assert.equal(session.findMatchingBracket({row: 0, column: 16}), null);
|
152
|
+
assert.equal(session.findMatchingBracket({row: 3, column: 30}), null);
|
153
|
+
assert.equal(session.findMatchingBracket({row: 1, column: 16}), null);
|
154
|
+
},
|
155
|
+
|
156
|
+
"test: match different bracket types" : function() {
|
157
|
+
var session = new EditSession(["({[", ")]}"]);
|
158
|
+
|
159
|
+
assert.position(session.findMatchingBracket({row: 0, column: 1}), 1, 0);
|
160
|
+
assert.position(session.findMatchingBracket({row: 0, column: 2}), 1, 2);
|
161
|
+
assert.position(session.findMatchingBracket({row: 0, column: 3}), 1, 1);
|
162
|
+
|
163
|
+
assert.position(session.findMatchingBracket({row: 1, column: 1}), 0, 0);
|
164
|
+
assert.position(session.findMatchingBracket({row: 1, column: 2}), 0, 2);
|
165
|
+
assert.position(session.findMatchingBracket({row: 1, column: 3}), 0, 1);
|
166
|
+
},
|
167
|
+
|
168
|
+
"test: move lines down" : function() {
|
169
|
+
var session = new EditSession(["a1", "a2", "a3", "a4"]);
|
170
|
+
|
171
|
+
session.moveLinesDown(0, 1);
|
172
|
+
assert.equal(session.getValue(), ["a3", "a1", "a2", "a4"].join("\n"));
|
173
|
+
|
174
|
+
session.moveLinesDown(1, 2);
|
175
|
+
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
|
176
|
+
|
177
|
+
session.moveLinesDown(2, 3);
|
178
|
+
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
|
179
|
+
|
180
|
+
session.moveLinesDown(2, 2);
|
181
|
+
assert.equal(session.getValue(), ["a3", "a4", "a2", "a1"].join("\n"));
|
182
|
+
},
|
183
|
+
|
184
|
+
"test: move lines up" : function() {
|
185
|
+
var session = new EditSession(["a1", "a2", "a3", "a4"]);
|
186
|
+
|
187
|
+
session.moveLinesUp(2, 3);
|
188
|
+
assert.equal(session.getValue(), ["a1", "a3", "a4", "a2"].join("\n"));
|
189
|
+
|
190
|
+
session.moveLinesUp(1, 2);
|
191
|
+
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
|
192
|
+
|
193
|
+
session.moveLinesUp(0, 1);
|
194
|
+
assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
|
195
|
+
|
196
|
+
session.moveLinesUp(2, 2);
|
197
|
+
assert.equal(session.getValue(), ["a3", "a1", "a4", "a2"].join("\n"));
|
198
|
+
},
|
199
|
+
|
200
|
+
"test: duplicate lines" : function() {
|
201
|
+
var session = new EditSession(["1", "2", "3", "4"]);
|
202
|
+
|
203
|
+
session.duplicateLines(1, 2);
|
204
|
+
assert.equal(session.getValue(), ["1", "2", "3", "2", "3", "4"].join("\n"));
|
205
|
+
},
|
206
|
+
|
207
|
+
"test: duplicate last line" : function() {
|
208
|
+
var session = new EditSession(["1", "2", "3"]);
|
209
|
+
|
210
|
+
session.duplicateLines(2, 2);
|
211
|
+
assert.equal(session.getValue(), ["1", "2", "3", "3"].join("\n"));
|
212
|
+
},
|
213
|
+
|
214
|
+
"test: duplicate first line" : function() {
|
215
|
+
var session = new EditSession(["1", "2", "3"]);
|
216
|
+
|
217
|
+
session.duplicateLines(0, 0);
|
218
|
+
assert.equal(session.getValue(), ["1", "1", "2", "3"].join("\n"));
|
219
|
+
},
|
220
|
+
|
221
|
+
"test: getScreenLastRowColumn": function() {
|
222
|
+
var session = new EditSession([
|
223
|
+
"juhu",
|
224
|
+
"12\t\t34",
|
225
|
+
"ぁぁa"
|
226
|
+
]);
|
227
|
+
|
228
|
+
assert.equal(session.getScreenLastRowColumn(0), 4);
|
229
|
+
assert.equal(session.getScreenLastRowColumn(1), 10);
|
230
|
+
assert.equal(session.getScreenLastRowColumn(2), 5);
|
231
|
+
},
|
232
|
+
|
233
|
+
"test: convert document to screen coordinates" : function() {
|
234
|
+
var session = new EditSession("01234\t567890\t1234");
|
235
|
+
session.setTabSize(4);
|
236
|
+
|
237
|
+
assert.equal(session.documentToScreenColumn(0, 0), 0);
|
238
|
+
assert.equal(session.documentToScreenColumn(0, 4), 4);
|
239
|
+
assert.equal(session.documentToScreenColumn(0, 5), 5);
|
240
|
+
assert.equal(session.documentToScreenColumn(0, 6), 8);
|
241
|
+
assert.equal(session.documentToScreenColumn(0, 12), 14);
|
242
|
+
assert.equal(session.documentToScreenColumn(0, 13), 16);
|
243
|
+
|
244
|
+
session.setTabSize(2);
|
245
|
+
|
246
|
+
assert.equal(session.documentToScreenColumn(0, 0), 0);
|
247
|
+
assert.equal(session.documentToScreenColumn(0, 4), 4);
|
248
|
+
assert.equal(session.documentToScreenColumn(0, 5), 5);
|
249
|
+
assert.equal(session.documentToScreenColumn(0, 6), 6);
|
250
|
+
assert.equal(session.documentToScreenColumn(0, 7), 7);
|
251
|
+
assert.equal(session.documentToScreenColumn(0, 12), 12);
|
252
|
+
assert.equal(session.documentToScreenColumn(0, 13), 14);
|
253
|
+
},
|
254
|
+
|
255
|
+
"test: convert document to screen coordinates with leading tabs": function() {
|
256
|
+
var session = new EditSession("\t\t123");
|
257
|
+
session.setTabSize(4);
|
258
|
+
|
259
|
+
assert.equal(session.documentToScreenColumn(0, 0), 0);
|
260
|
+
assert.equal(session.documentToScreenColumn(0, 1), 4);
|
261
|
+
assert.equal(session.documentToScreenColumn(0, 2), 8);
|
262
|
+
assert.equal(session.documentToScreenColumn(0, 3), 9);
|
263
|
+
},
|
264
|
+
|
265
|
+
"test: documentToScreen without soft wrap": function() {
|
266
|
+
var session = new EditSession([
|
267
|
+
"juhu",
|
268
|
+
"12\t\t34",
|
269
|
+
"ぁぁa"
|
270
|
+
]);
|
271
|
+
|
272
|
+
assert.position(session.documentToScreenPosition(0, 3), 0, 3);
|
273
|
+
assert.position(session.documentToScreenPosition(1, 3), 1, 4);
|
274
|
+
assert.position(session.documentToScreenPosition(1, 4), 1, 8);
|
275
|
+
assert.position(session.documentToScreenPosition(2, 2), 2, 4);
|
276
|
+
},
|
277
|
+
|
278
|
+
"test: documentToScreen with soft wrap": function() {
|
279
|
+
var session = new EditSession(["foo bar foo bar"]);
|
280
|
+
session.setUseWrapMode(true);
|
281
|
+
session.setWrapLimitRange(12, 12);
|
282
|
+
session.adjustWrapLimit(80);
|
283
|
+
|
284
|
+
assert.position(session.documentToScreenPosition(0, 11), 0, 11);
|
285
|
+
assert.position(session.documentToScreenPosition(0, 12), 1, 0);
|
286
|
+
},
|
287
|
+
|
288
|
+
"test: documentToScreen with soft wrap and multibyte characters": function() {
|
289
|
+
var session = new EditSession(["ぁぁa"]);
|
290
|
+
session.setUseWrapMode(true);
|
291
|
+
session.setWrapLimitRange(2, 2);
|
292
|
+
session.adjustWrapLimit(80);
|
293
|
+
|
294
|
+
assert.position(session.documentToScreenPosition(0, 1), 1, 0);
|
295
|
+
assert.position(session.documentToScreenPosition(0, 2), 2, 0);
|
296
|
+
assert.position(session.documentToScreenPosition(0, 4), 2, 1);
|
297
|
+
},
|
298
|
+
|
299
|
+
"test: documentToScreen should clip position to the document boundaries": function() {
|
300
|
+
var session = new EditSession("foo bar\njuhu kinners");
|
301
|
+
|
302
|
+
assert.position(session.documentToScreenPosition(-1, 4), 0, 0);
|
303
|
+
assert.position(session.documentToScreenPosition(3, 0), 1, 12);
|
304
|
+
},
|
305
|
+
|
306
|
+
"test: convert screen to document coordinates" : function() {
|
307
|
+
var session = new EditSession("01234\t567890\t1234");
|
308
|
+
session.setTabSize(4);
|
309
|
+
|
310
|
+
assert.equal(session.screenToDocumentColumn(0, 0), 0);
|
311
|
+
assert.equal(session.screenToDocumentColumn(0, 4), 4);
|
312
|
+
assert.equal(session.screenToDocumentColumn(0, 5), 5);
|
313
|
+
assert.equal(session.screenToDocumentColumn(0, 6), 5);
|
314
|
+
assert.equal(session.screenToDocumentColumn(0, 7), 5);
|
315
|
+
assert.equal(session.screenToDocumentColumn(0, 8), 6);
|
316
|
+
assert.equal(session.screenToDocumentColumn(0, 9), 7);
|
317
|
+
assert.equal(session.screenToDocumentColumn(0, 15), 12);
|
318
|
+
assert.equal(session.screenToDocumentColumn(0, 19), 16);
|
319
|
+
|
320
|
+
session.setTabSize(2);
|
321
|
+
|
322
|
+
assert.equal(session.screenToDocumentColumn(0, 0), 0);
|
323
|
+
assert.equal(session.screenToDocumentColumn(0, 4), 4);
|
324
|
+
assert.equal(session.screenToDocumentColumn(0, 5), 5);
|
325
|
+
assert.equal(session.screenToDocumentColumn(0, 6), 6);
|
326
|
+
assert.equal(session.screenToDocumentColumn(0, 12), 12);
|
327
|
+
assert.equal(session.screenToDocumentColumn(0, 13), 12);
|
328
|
+
assert.equal(session.screenToDocumentColumn(0, 14), 13);
|
329
|
+
},
|
330
|
+
|
331
|
+
"test: screenToDocument with soft wrap": function() {
|
332
|
+
var session = new EditSession(["foo bar foo bar"]);
|
333
|
+
session.setUseWrapMode(true);
|
334
|
+
session.setWrapLimitRange(12, 12);
|
335
|
+
session.adjustWrapLimit(80);
|
336
|
+
|
337
|
+
assert.position(session.screenToDocumentPosition(1, 0), 0, 12);
|
338
|
+
assert.position(session.screenToDocumentPosition(0, 11), 0, 11);
|
339
|
+
// Check if the position is clamped the right way.
|
340
|
+
assert.position(session.screenToDocumentPosition(0, 12), 0, 11);
|
341
|
+
assert.position(session.screenToDocumentPosition(0, 20), 0, 11);
|
342
|
+
},
|
343
|
+
|
344
|
+
"test: screenToDocument with soft wrap and multi byte characters": function() {
|
345
|
+
var session = new EditSession(["ぁ a"]);
|
346
|
+
session.setUseWrapMode(true);
|
347
|
+
session.adjustWrapLimit(80);
|
348
|
+
|
349
|
+
assert.position(session.screenToDocumentPosition(0, 1), 0, 0);
|
350
|
+
assert.position(session.screenToDocumentPosition(0, 2), 0, 1);
|
351
|
+
assert.position(session.screenToDocumentPosition(0, 3), 0, 2);
|
352
|
+
assert.position(session.screenToDocumentPosition(0, 4), 0, 3);
|
353
|
+
assert.position(session.screenToDocumentPosition(0, 5), 0, 3);
|
354
|
+
},
|
355
|
+
|
356
|
+
"test: screenToDocument should clip position to the document boundaries": function() {
|
357
|
+
var session = new EditSession("foo bar\njuhu kinners");
|
358
|
+
|
359
|
+
assert.position(session.screenToDocumentPosition(-1, 4), 0, 0);
|
360
|
+
assert.position(session.screenToDocumentPosition(0, -1), 0, 0);
|
361
|
+
assert.position(session.screenToDocumentPosition(0, 30), 0, 7);
|
362
|
+
assert.position(session.screenToDocumentPosition(2, 4), 1, 12);
|
363
|
+
assert.position(session.screenToDocumentPosition(1, 30), 1, 12);
|
364
|
+
assert.position(session.screenToDocumentPosition(20, 50), 1, 12);
|
365
|
+
assert.position(session.screenToDocumentPosition(20, 5), 1, 12);
|
366
|
+
|
367
|
+
// and the same for folded rows
|
368
|
+
session.addFold("...", new Range(0,1,1,3));
|
369
|
+
assert.position(session.screenToDocumentPosition(1, 2), 1, 12);
|
370
|
+
// for wrapped rows
|
371
|
+
session.setUseWrapMode(true);
|
372
|
+
session.setWrapLimitRange(5,5);
|
373
|
+
assert.position(session.screenToDocumentPosition(4, 1), 1, 12);
|
374
|
+
},
|
375
|
+
|
376
|
+
"test: wrapLine split function" : function() {
|
377
|
+
function computeAndAssert(line, assertEqual, wrapLimit, tabSize) {
|
378
|
+
wrapLimit = wrapLimit || 12;
|
379
|
+
tabSize = tabSize || 4;
|
380
|
+
line = lang.stringTrimRight(line);
|
381
|
+
var tokens = EditSession.prototype.$getDisplayTokens(line);
|
382
|
+
var splits = EditSession.prototype.$computeWrapSplits(tokens, wrapLimit, tabSize);
|
383
|
+
// console.log("String:", line, "Result:", splits, "Expected:", assertEqual);
|
384
|
+
assert.ok(splits.length == assertEqual.length);
|
385
|
+
for (var i = 0; i < splits.length; i++) {
|
386
|
+
assert.ok(splits[i] == assertEqual[i]);
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
390
|
+
// Basic splitting.
|
391
|
+
computeAndAssert("foo bar foo bar", [ 12 ]);
|
392
|
+
computeAndAssert("foo bar f bar", [ 12 ]);
|
393
|
+
computeAndAssert("foo bar f r", [ 14 ]);
|
394
|
+
computeAndAssert("foo bar foo bar foo bara foo", [12, 25]);
|
395
|
+
|
396
|
+
// Don't split if there is only whitespaces/tabs at the end of the line.
|
397
|
+
computeAndAssert("foo foo foo \t \t", [ ]);
|
398
|
+
|
399
|
+
// If there is no space to split, force split.
|
400
|
+
computeAndAssert("foooooooooooooo", [ 12 ]);
|
401
|
+
computeAndAssert("fooooooooooooooooooooooooooo", [12, 24]);
|
402
|
+
computeAndAssert("foo bar fooooooooooobooooooo", [8, 20]);
|
403
|
+
|
404
|
+
// Basic splitting + tabs.
|
405
|
+
computeAndAssert("foo \t\tbar", [ 6 ]);
|
406
|
+
computeAndAssert("foo \t \tbar", [ 7 ]);
|
407
|
+
|
408
|
+
// Ignore spaces/tabs at beginning of split.
|
409
|
+
computeAndAssert("foo \t \t \t \t bar", [ 14 ]);
|
410
|
+
|
411
|
+
// Test wrapping for asian characters.
|
412
|
+
computeAndAssert("ぁぁ", [1], 2);
|
413
|
+
computeAndAssert(" ぁぁ", [1, 2], 2);
|
414
|
+
computeAndAssert(" ぁ\tぁ", [1, 3], 2);
|
415
|
+
computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
|
416
|
+
|
417
|
+
// Test wrapping for punctuation.
|
418
|
+
computeAndAssert(" ab.c;ef++", [1, 3, 5, 7, 8], 2);
|
419
|
+
computeAndAssert(" a.b", [1, 2, 3], 1);
|
420
|
+
computeAndAssert("#>>", [1, 2], 1);
|
421
|
+
},
|
422
|
+
|
423
|
+
"test get longest line" : function() {
|
424
|
+
var session = new EditSession(["12"]);
|
425
|
+
session.setTabSize(4);
|
426
|
+
assert.equal(session.getScreenWidth(), 2);
|
427
|
+
|
428
|
+
session.doc.insertNewLine({row: 0, column: Infinity});
|
429
|
+
session.doc.insertLines(1, ["123"]);
|
430
|
+
assert.equal(session.getScreenWidth(), 3);
|
431
|
+
|
432
|
+
session.doc.insertNewLine({row: 0, column: Infinity});
|
433
|
+
session.doc.insertLines(1, ["\t\t"]);
|
434
|
+
|
435
|
+
assert.equal(session.getScreenWidth(), 8);
|
436
|
+
|
437
|
+
session.setTabSize(2);
|
438
|
+
assert.equal(session.getScreenWidth(), 4);
|
439
|
+
},
|
440
|
+
|
441
|
+
"test getDisplayString": function() {
|
442
|
+
var session = new EditSession(["12"]);
|
443
|
+
session.setTabSize(4);
|
444
|
+
|
445
|
+
assert.equal(session.$getDisplayTokens("\t").length, 4);
|
446
|
+
assert.equal(session.$getDisplayTokens("abc").length, 3);
|
447
|
+
assert.equal(session.$getDisplayTokens("abc\t").length, 4);
|
448
|
+
},
|
449
|
+
|
450
|
+
"test issue 83": function() {
|
451
|
+
var session = new EditSession("");
|
452
|
+
var editor = new Editor(new MockRenderer(), session);
|
453
|
+
var document = session.getDocument();
|
454
|
+
|
455
|
+
session.setUseWrapMode(true);
|
456
|
+
|
457
|
+
document.insertLines(0, ["a", "b"]);
|
458
|
+
document.insertLines(2, ["c", "d"]);
|
459
|
+
document.removeLines(1, 2);
|
460
|
+
},
|
461
|
+
|
462
|
+
"test wrapMode init has to create wrapData array": function() {
|
463
|
+
var session = new EditSession("foo bar\nfoo bar");
|
464
|
+
var editor = new Editor(new MockRenderer(), session);
|
465
|
+
var document = session.getDocument();
|
466
|
+
|
467
|
+
session.setUseWrapMode(true);
|
468
|
+
session.setWrapLimitRange(3, 3);
|
469
|
+
session.adjustWrapLimit(80);
|
470
|
+
|
471
|
+
// Test if wrapData is there and was computed.
|
472
|
+
assert.equal(session.$wrapData.length, 2);
|
473
|
+
assert.equal(session.$wrapData[0].length, 1);
|
474
|
+
assert.equal(session.$wrapData[1].length, 1);
|
475
|
+
},
|
476
|
+
|
477
|
+
"test first line blank with wrap": function() {
|
478
|
+
var session = new EditSession("\nfoo");
|
479
|
+
session.setUseWrapMode(true);
|
480
|
+
assert.equal(session.doc.getValue(), ["", "foo"].join("\n"));
|
481
|
+
},
|
482
|
+
|
483
|
+
"test first line blank with wrap 2" : function() {
|
484
|
+
var session = new EditSession("");
|
485
|
+
session.setUseWrapMode(true);
|
486
|
+
session.setValue("\nfoo");
|
487
|
+
|
488
|
+
assert.equal(session.doc.getValue(), ["", "foo"].join("\n"));
|
489
|
+
},
|
490
|
+
|
491
|
+
"test fold getFoldDisplayLine": function() {
|
492
|
+
var session = createFoldTestSession();
|
493
|
+
function assertDisplayLine(foldLine, str) {
|
494
|
+
var line = session.getLine(foldLine.end.row);
|
495
|
+
var displayLine =
|
496
|
+
session.getFoldDisplayLine(foldLine, foldLine.end.row, line.length);
|
497
|
+
assert.equal(displayLine, str);
|
498
|
+
}
|
499
|
+
|
500
|
+
assertDisplayLine(session.$foldData[0], "function foo(args...) {")
|
501
|
+
assertDisplayLine(session.$foldData[1], " for (vfoo...ert(items[bar...\"juhu\");");
|
502
|
+
},
|
503
|
+
|
504
|
+
"test foldLine idxToPosition": function() {
|
505
|
+
var session = createFoldTestSession();
|
506
|
+
|
507
|
+
function assertIdx2Pos(foldLineIdx, idx, row, column) {
|
508
|
+
var foldLine = session.$foldData[foldLineIdx];
|
509
|
+
assert.position(foldLine.idxToPosition(idx), row, column);
|
510
|
+
}
|
511
|
+
|
512
|
+
// "function foo(items) {",
|
513
|
+
// " for (var i=0; i<items.length; i++) {",
|
514
|
+
// " alert(items[i] + \"juhu\");",
|
515
|
+
// " } // Real Tab.",
|
516
|
+
// "}"
|
517
|
+
|
518
|
+
assertIdx2Pos(0, 12, 0, 12);
|
519
|
+
assertIdx2Pos(0, 13, 0, 13);
|
520
|
+
assertIdx2Pos(0, 14, 0, 13);
|
521
|
+
assertIdx2Pos(0, 19, 0, 13);
|
522
|
+
assertIdx2Pos(0, 20, 0, 18);
|
523
|
+
|
524
|
+
assertIdx2Pos(1, 10, 1, 10);
|
525
|
+
assertIdx2Pos(1, 11, 1, 10);
|
526
|
+
assertIdx2Pos(1, 15, 1, 10);
|
527
|
+
assertIdx2Pos(1, 16, 2, 10);
|
528
|
+
assertIdx2Pos(1, 26, 2, 20);
|
529
|
+
assertIdx2Pos(1, 27, 2, 20);
|
530
|
+
assertIdx2Pos(1, 32, 2, 25);
|
531
|
+
},
|
532
|
+
|
533
|
+
"test fold documentToScreen": function() {
|
534
|
+
var session = createFoldTestSession();
|
535
|
+
function assertDoc2Screen(docRow, docCol, screenRow, screenCol) {
|
536
|
+
assert.position(
|
537
|
+
session.documentToScreenPosition(docRow, docCol),
|
538
|
+
screenRow, screenCol
|
539
|
+
);
|
540
|
+
}
|
541
|
+
|
542
|
+
// One fold ending in the same row.
|
543
|
+
assertDoc2Screen(0, 0, 0, 0);
|
544
|
+
assertDoc2Screen(0, 13, 0, 13);
|
545
|
+
assertDoc2Screen(0, 14, 0, 13);
|
546
|
+
assertDoc2Screen(0, 17, 0, 13);
|
547
|
+
assertDoc2Screen(0, 18, 0, 20);
|
548
|
+
|
549
|
+
// Fold ending on some other row.
|
550
|
+
assertDoc2Screen(1, 0, 1, 0);
|
551
|
+
assertDoc2Screen(1, 10, 1, 10);
|
552
|
+
assertDoc2Screen(1, 11, 1, 10);
|
553
|
+
assertDoc2Screen(1, 99, 1, 10);
|
554
|
+
|
555
|
+
assertDoc2Screen(2, 0, 1, 10);
|
556
|
+
assertDoc2Screen(2, 9, 1, 10);
|
557
|
+
assertDoc2Screen(2, 10, 1, 16);
|
558
|
+
assertDoc2Screen(2, 11, 1, 17);
|
559
|
+
|
560
|
+
// Fold in the same row with fold over more then one row in the same row.
|
561
|
+
assertDoc2Screen(2, 19, 1, 25);
|
562
|
+
assertDoc2Screen(2, 20, 1, 26);
|
563
|
+
assertDoc2Screen(2, 21, 1, 26);
|
564
|
+
|
565
|
+
assertDoc2Screen(2, 24, 1, 26);
|
566
|
+
assertDoc2Screen(2, 25, 1, 32);
|
567
|
+
assertDoc2Screen(2, 26, 1, 33);
|
568
|
+
assertDoc2Screen(2, 99, 1, 40);
|
569
|
+
|
570
|
+
// Test one position after the folds. Should be all like normal.
|
571
|
+
assertDoc2Screen(3, 0, 2, 0);
|
572
|
+
},
|
573
|
+
|
574
|
+
"test fold screenToDocument": function() {
|
575
|
+
var session = createFoldTestSession();
|
576
|
+
function assertScreen2Doc(docRow, docCol, screenRow, screenCol) {
|
577
|
+
assert.position(
|
578
|
+
session.screenToDocumentPosition(screenRow, screenCol),
|
579
|
+
docRow, docCol
|
580
|
+
);
|
581
|
+
}
|
582
|
+
|
583
|
+
// One fold ending in the same row.
|
584
|
+
assertScreen2Doc(0, 0, 0, 0);
|
585
|
+
assertScreen2Doc(0, 13, 0, 13);
|
586
|
+
assertScreen2Doc(0, 13, 0, 14);
|
587
|
+
assertScreen2Doc(0, 18, 0, 20);
|
588
|
+
assertScreen2Doc(0, 19, 0, 21);
|
589
|
+
|
590
|
+
// Fold ending on some other row.
|
591
|
+
assertScreen2Doc(1, 0, 1, 0);
|
592
|
+
assertScreen2Doc(1, 10, 1, 10);
|
593
|
+
assertScreen2Doc(1, 10, 1, 11);
|
594
|
+
|
595
|
+
assertScreen2Doc(1, 10, 1, 15);
|
596
|
+
assertScreen2Doc(2, 10, 1, 16);
|
597
|
+
assertScreen2Doc(2, 11, 1, 17);
|
598
|
+
|
599
|
+
// Fold in the same row with fold over more then one row in the same row.
|
600
|
+
assertScreen2Doc(2, 19, 1, 25);
|
601
|
+
assertScreen2Doc(2, 20, 1, 26);
|
602
|
+
assertScreen2Doc(2, 20, 1, 27);
|
603
|
+
|
604
|
+
assertScreen2Doc(2, 20, 1, 31);
|
605
|
+
assertScreen2Doc(2, 25, 1, 32);
|
606
|
+
assertScreen2Doc(2, 26, 1, 33);
|
607
|
+
assertScreen2Doc(2, 33, 1, 99);
|
608
|
+
|
609
|
+
// Test one position after the folds. Should be all like normal.
|
610
|
+
assertScreen2Doc(3, 0, 2, 0);
|
611
|
+
},
|
612
|
+
|
613
|
+
"test getFoldsInRange()": function() {
|
614
|
+
var session = createFoldTestSession();
|
615
|
+
var foldLines = session.$foldData;
|
616
|
+
var folds = foldLines[0].folds.concat(foldLines[1].folds);
|
617
|
+
|
618
|
+
function test(startRow, startColumn, endColumn, endRow, folds) {
|
619
|
+
var r = new Range(startRow, startColumn, endColumn, endRow);
|
620
|
+
var retFolds = session.getFoldsInRange(r);
|
621
|
+
|
622
|
+
assert.ok(retFolds.length == folds.length);
|
623
|
+
for (var i = 0; i < retFolds.length; i++) {
|
624
|
+
assert.equal(retFolds[i].range + "", folds[i].range + "");
|
625
|
+
}
|
626
|
+
}
|
627
|
+
|
628
|
+
test(0, 0, 0, 13, [ ]);
|
629
|
+
test(0, 0, 0, 14, [ folds[0] ]);
|
630
|
+
test(0, 0, 0, 18, [ folds[0] ]);
|
631
|
+
test(0, 0, 1, 10, [ folds[0] ]);
|
632
|
+
test(0, 0, 1, 11, [ folds[0], folds[1] ]);
|
633
|
+
test(0, 18, 1, 11, [ folds[1] ]);
|
634
|
+
test(2, 0, 2, 13, [ folds[1] ]);
|
635
|
+
test(2, 10, 2, 20, [ ]);
|
636
|
+
test(2, 10, 2, 11, [ ]);
|
637
|
+
test(2, 19, 2, 20, [ ]);
|
638
|
+
},
|
639
|
+
|
640
|
+
"test fold one-line text insert": function() {
|
641
|
+
// These are mostly test for the FoldLine.addRemoveChars function.
|
642
|
+
var session = createFoldTestSession();
|
643
|
+
var undoManager = session.getUndoManager();
|
644
|
+
var foldLines = session.$foldData;
|
645
|
+
|
646
|
+
function insert(row, column, text) {
|
647
|
+
session.insert({row: row, column: column}, text);
|
648
|
+
|
649
|
+
// Force the session to store all changes made to the document NOW
|
650
|
+
// on the undoManager's queue. Otherwise we can't undo in separate
|
651
|
+
// steps later.
|
652
|
+
session.$syncInformUndoManager();
|
653
|
+
}
|
654
|
+
|
655
|
+
var foldLine, fold, folds;
|
656
|
+
// First line.
|
657
|
+
foldLine = session.$foldData[0];
|
658
|
+
fold = foldLine.folds[0];
|
659
|
+
|
660
|
+
insert(0, 0, "0");
|
661
|
+
assert.range(foldLine.range, 0, 14, 0, 19);
|
662
|
+
assert.range(fold.range, 0, 14, 0, 19);
|
663
|
+
insert(0, 14, "1");
|
664
|
+
assert.range(foldLine.range, 0, 15, 0, 20);
|
665
|
+
assert.range(fold.range, 0, 15, 0, 20);
|
666
|
+
insert(0, 20, "2");
|
667
|
+
assert.range(foldLine.range, 0, 15, 0, 20);
|
668
|
+
assert.range(fold.range, 0, 15, 0, 20);
|
669
|
+
|
670
|
+
// Second line.
|
671
|
+
foldLine = session.$foldData[1];
|
672
|
+
folds = foldLine.folds;
|
673
|
+
|
674
|
+
insert(1, 0, "3");
|
675
|
+
assert.range(foldLine.range, 1, 11, 2, 25);
|
676
|
+
assert.range(folds[0].range, 1, 11, 2, 10);
|
677
|
+
assert.range(folds[1].range, 2, 20, 2, 25);
|
678
|
+
|
679
|
+
insert(1, 11, "4");
|
680
|
+
assert.range(foldLine.range, 1, 12, 2, 25);
|
681
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
682
|
+
assert.range(folds[1].range, 2, 20, 2, 25);
|
683
|
+
|
684
|
+
insert(2, 10, "5");
|
685
|
+
assert.range(foldLine.range, 1, 12, 2, 26);
|
686
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
687
|
+
assert.range(folds[1].range, 2, 21, 2, 26);
|
688
|
+
|
689
|
+
insert(2, 21, "6");
|
690
|
+
assert.range(foldLine.range, 1, 12, 2, 27);
|
691
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
692
|
+
assert.range(folds[1].range, 2, 22, 2, 27);
|
693
|
+
|
694
|
+
insert(2, 27, "7");
|
695
|
+
assert.range(foldLine.range, 1, 12, 2, 27);
|
696
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
697
|
+
assert.range(folds[1].range, 2, 22, 2, 27);
|
698
|
+
|
699
|
+
// UNDO = REMOVE
|
700
|
+
undoManager.undo(); // 6
|
701
|
+
assert.range(foldLine.range, 1, 12, 2, 27);
|
702
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
703
|
+
assert.range(folds[1].range, 2, 22, 2, 27);
|
704
|
+
|
705
|
+
undoManager.undo(); // 5
|
706
|
+
assert.range(foldLine.range, 1, 12, 2, 26);
|
707
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
708
|
+
assert.range(folds[1].range, 2, 21, 2, 26);
|
709
|
+
|
710
|
+
undoManager.undo(); // 4
|
711
|
+
assert.range(foldLine.range, 1, 12, 2, 25);
|
712
|
+
assert.range(folds[0].range, 1, 12, 2, 10);
|
713
|
+
assert.range(folds[1].range, 2, 20, 2, 25);
|
714
|
+
|
715
|
+
undoManager.undo(); // 3
|
716
|
+
assert.range(foldLine.range, 1, 11, 2, 25);
|
717
|
+
assert.range(folds[0].range, 1, 11, 2, 10);
|
718
|
+
assert.range(folds[1].range, 2, 20, 2, 25);
|
719
|
+
|
720
|
+
undoManager.undo(); // Beginning first line.
|
721
|
+
assert.equal(foldLines.length, 2);
|
722
|
+
assert.range(foldLines[0].range, 0, 15, 0, 20);
|
723
|
+
assert.range(foldLines[1].range, 1, 10, 2, 25);
|
724
|
+
|
725
|
+
foldLine = session.$foldData[0];
|
726
|
+
fold = foldLine.folds[0];
|
727
|
+
|
728
|
+
undoManager.undo(); // 2
|
729
|
+
assert.range(foldLine.range, 0, 15, 0, 20);
|
730
|
+
assert.range(fold.range, 0, 15, 0, 20);
|
731
|
+
|
732
|
+
undoManager.undo(); // 1
|
733
|
+
assert.range(foldLine.range, 0, 14, 0, 19);
|
734
|
+
assert.range(fold.range, 0, 14, 0, 19);
|
735
|
+
|
736
|
+
undoManager.undo(); // 0
|
737
|
+
assert.range(foldLine.range, 0, 13, 0, 18);
|
738
|
+
assert.range(fold.range, 0, 13, 0, 18);
|
739
|
+
},
|
740
|
+
|
741
|
+
"test fold multi-line insert/remove": function() {
|
742
|
+
var session = createFoldTestSession(),
|
743
|
+
undoManager = session.getUndoManager(),
|
744
|
+
foldLines = session.$foldData;
|
745
|
+
function insert(row, column, text) {
|
746
|
+
session.insert({row: row, column: column}, text);
|
747
|
+
// Force the session to store all changes made to the document NOW
|
748
|
+
// on the undoManager's queue. Otherwise we can't undo in separate
|
749
|
+
// steps later.
|
750
|
+
session.$syncInformUndoManager();
|
751
|
+
}
|
752
|
+
|
753
|
+
var foldLines = session.$foldData, foldLine, fold, folds;
|
754
|
+
|
755
|
+
insert(0, 0, "\nfo0");
|
756
|
+
assert.equal(foldLines.length, 2);
|
757
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
758
|
+
assert.range(foldLines[1].range, 2, 10, 3, 25);
|
759
|
+
|
760
|
+
insert(2, 0, "\nba1");
|
761
|
+
assert.equal(foldLines.length, 2);
|
762
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
763
|
+
assert.range(foldLines[1].range, 3, 13, 4, 25);
|
764
|
+
|
765
|
+
insert(3, 10, "\nfo2");
|
766
|
+
assert.equal(foldLines.length, 2);
|
767
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
768
|
+
assert.range(foldLines[1].range, 4, 6, 5, 25);
|
769
|
+
|
770
|
+
insert(5, 10, "\nba3");
|
771
|
+
assert.equal(foldLines.length, 3);
|
772
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
773
|
+
assert.range(foldLines[1].range, 4, 6, 5, 10);
|
774
|
+
assert.range(foldLines[2].range, 6, 13, 6, 18);
|
775
|
+
|
776
|
+
insert(6, 18, "\nfo4");
|
777
|
+
assert.equal(foldLines.length, 3);
|
778
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
779
|
+
assert.range(foldLines[1].range, 4, 6, 5, 10);
|
780
|
+
assert.range(foldLines[2].range, 6, 13, 6, 18);
|
781
|
+
|
782
|
+
undoManager.undo(); // 3
|
783
|
+
assert.equal(foldLines.length, 3);
|
784
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
785
|
+
assert.range(foldLines[1].range, 4, 6, 5, 10);
|
786
|
+
assert.range(foldLines[2].range, 6, 13, 6, 18);
|
787
|
+
|
788
|
+
undoManager.undo(); // 2
|
789
|
+
assert.equal(foldLines.length, 2);
|
790
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
791
|
+
assert.range(foldLines[1].range, 4, 6, 5, 25);
|
792
|
+
|
793
|
+
undoManager.undo(); // 1
|
794
|
+
assert.equal(foldLines.length, 2);
|
795
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
796
|
+
assert.range(foldLines[1].range, 3, 13, 4, 25);
|
797
|
+
|
798
|
+
undoManager.undo(); // 0
|
799
|
+
assert.equal(foldLines.length, 2);
|
800
|
+
assert.range(foldLines[0].range, 1, 16, 1, 21);
|
801
|
+
assert.range(foldLines[1].range, 2, 10, 3, 25);
|
802
|
+
|
803
|
+
undoManager.undo(); // Beginning
|
804
|
+
assert.equal(foldLines.length, 2);
|
805
|
+
assert.range(foldLines[0].range, 0, 13, 0, 18);
|
806
|
+
assert.range(foldLines[1].range, 1, 10, 2, 25);
|
807
|
+
// TODO: Add test for inseration inside of folds.
|
808
|
+
},
|
809
|
+
|
810
|
+
"test fold wrap data compution": function() {
|
811
|
+
function assertArray(a, b) {
|
812
|
+
assert.ok(a.length == b.length);
|
813
|
+
for (var i = 0; i < a.length; i++) {
|
814
|
+
assert.equal(a[i], b[i]);
|
815
|
+
}
|
816
|
+
}
|
817
|
+
|
818
|
+
function assertWrap(line0, line1, line2) {
|
819
|
+
line0 && assertArray(wrapData[0], line0);
|
820
|
+
line1 && assertArray(wrapData[1], line1);
|
821
|
+
line2 && assertArray(wrapData[2], line2);
|
822
|
+
}
|
823
|
+
|
824
|
+
function removeFoldAssertWrap(docRow, docColumn, line0, line1, line2) {
|
825
|
+
session.removeFold(session.getFoldAt(docRow, docColumn));
|
826
|
+
assertWrap(line0, line1, line2);
|
827
|
+
}
|
828
|
+
|
829
|
+
var lines = [
|
830
|
+
"foo bar foo bar",
|
831
|
+
"foo bar foo bar",
|
832
|
+
"foo bar foo bar"
|
833
|
+
];
|
834
|
+
|
835
|
+
var session = new EditSession(lines.join("\n"));
|
836
|
+
session.setUseWrapMode(true);
|
837
|
+
session.$wrapLimit = 7;
|
838
|
+
session.$updateWrapData(0, 2);
|
839
|
+
var wrapData = session.$wrapData;
|
840
|
+
|
841
|
+
// Do a simple assertion without folds to check basic functionallity.
|
842
|
+
assertWrap([8], [8], [8]);
|
843
|
+
|
844
|
+
// --- Do in line folding ---
|
845
|
+
|
846
|
+
// Adding a fold. The split position is inside of the fold. As placeholder
|
847
|
+
// are not splitable, the split should be before the split.
|
848
|
+
session.addFold("woot", new Range(0, 4, 0, 15));
|
849
|
+
assertWrap([4], [8], [8]);
|
850
|
+
|
851
|
+
// Remove the fold again which should reset the wrapData.
|
852
|
+
removeFoldAssertWrap(0, 4, [8], [8], [8]);
|
853
|
+
|
854
|
+
session.addFold("woot", new Range(0, 6, 0, 9));
|
855
|
+
assertWrap([6, 13], [8], [8]);
|
856
|
+
removeFoldAssertWrap(0, 6, [8], [8], [8]);
|
857
|
+
|
858
|
+
// The fold fits into the wrap limit - no split expected.
|
859
|
+
session.addFold("woot", new Range(0, 3, 0, 15));
|
860
|
+
assertWrap([], [8], [8]);
|
861
|
+
removeFoldAssertWrap(0, 4, [8], [8], [8]);
|
862
|
+
|
863
|
+
// Fold after split position should be all fine.
|
864
|
+
session.addFold("woot", new Range(0, 8, 0, 15));
|
865
|
+
assertWrap([8], [8], [8]);
|
866
|
+
removeFoldAssertWrap(0, 8, [8], [8], [8]);
|
867
|
+
|
868
|
+
// Fold's placeholder is far too long for wrapSplit.
|
869
|
+
session.addFold("woot0123456789", new Range(0, 8, 0, 15));
|
870
|
+
assertWrap([8], [8], [8]);
|
871
|
+
removeFoldAssertWrap(0, 8, [8], [8], [8]);
|
872
|
+
|
873
|
+
// Fold's placeholder is far too long for wrapSplit
|
874
|
+
// + content at the end of the line
|
875
|
+
session.addFold("woot0123456789", new Range(0, 6, 0, 8));
|
876
|
+
assertWrap([6, 20], [8], [8]);
|
877
|
+
removeFoldAssertWrap(0, 8, [8], [8], [8]);
|
878
|
+
|
879
|
+
session.addFold("woot0123456789", new Range(0, 6, 0, 8));
|
880
|
+
session.addFold("woot0123456789", new Range(0, 8, 0, 10));
|
881
|
+
assertWrap([6, 20, 34], [8], [8]);
|
882
|
+
session.removeFold(session.getFoldAt(0, 7));
|
883
|
+
removeFoldAssertWrap(0, 8, [8], [8], [8]);
|
884
|
+
|
885
|
+
session.addFold("woot0123456789", new Range(0, 7, 0, 9));
|
886
|
+
session.addFold("woot0123456789", new Range(0, 13, 0, 15));
|
887
|
+
assertWrap([7, 21, 25], [8], [8]);
|
888
|
+
session.removeFold(session.getFoldAt(0, 7));
|
889
|
+
removeFoldAssertWrap(0, 14, [8], [8], [8]);
|
890
|
+
|
891
|
+
// --- Do some multiline folding ---
|
892
|
+
|
893
|
+
// Add a fold over two lines. Note, that the wrapData[1] stays the
|
894
|
+
// same. This is an implementation detail and expected behavior.
|
895
|
+
session.addFold("woot", new Range(0, 8, 1, 15));
|
896
|
+
assertWrap([8], [8 /* See comments */], [8]);
|
897
|
+
removeFoldAssertWrap(0, 8, [8], [8], [8]);
|
898
|
+
|
899
|
+
session.addFold("woot", new Range(0, 9, 1, 11));
|
900
|
+
assertWrap([8, 14], [8 /* See comments */], [8]);
|
901
|
+
removeFoldAssertWrap(0, 9, [8], [8], [8]);
|
902
|
+
|
903
|
+
session.addFold("woot", new Range(0, 9, 1, 15));
|
904
|
+
assertWrap([8], [8 /* See comments */], [8]);
|
905
|
+
removeFoldAssertWrap(0, 9, [8], [8], [8]);
|
906
|
+
|
907
|
+
return session;
|
908
|
+
},
|
909
|
+
|
910
|
+
"test add fold": function() {
|
911
|
+
var session = createFoldTestSession();
|
912
|
+
var fold;
|
913
|
+
|
914
|
+
function tryAddFold(placeholder, range, shouldFail) {
|
915
|
+
var fail = false;
|
916
|
+
try {
|
917
|
+
fold = session.addFold(placeholder, range);
|
918
|
+
} catch (e) {
|
919
|
+
fail = true;
|
920
|
+
}
|
921
|
+
if (fail != shouldFail) {
|
922
|
+
throw "Expected to get an exception";
|
923
|
+
}
|
924
|
+
}
|
925
|
+
|
926
|
+
tryAddFold("foo", new Range(0, 13, 0, 17), false);
|
927
|
+
tryAddFold("foo", new Range(0, 14, 0, 18), true);
|
928
|
+
tryAddFold("foo", new Range(0, 13, 0, 18), false);
|
929
|
+
assert.equal(session.$foldData[0].folds.length, 1);
|
930
|
+
|
931
|
+
tryAddFold("f", new Range(0, 13, 0, 18), true);
|
932
|
+
tryAddFold("foo", new Range(0, 18, 0, 21), false);
|
933
|
+
assert.equal(session.$foldData[0].folds.length, 2);
|
934
|
+
session.removeFold(fold);
|
935
|
+
|
936
|
+
tryAddFold("foo", new Range(0, 18, 0, 22), false);
|
937
|
+
tryAddFold("foo", new Range(0, 18, 0, 19), true);
|
938
|
+
tryAddFold("foo", new Range(0, 22, 1, 10), false);
|
939
|
+
},
|
940
|
+
|
941
|
+
"test add subfolds": function() {
|
942
|
+
var session = createFoldTestSession();
|
943
|
+
var fold, oldFold;
|
944
|
+
var foldData = session.$foldData;
|
945
|
+
|
946
|
+
oldFold = foldData[0].folds[0];
|
947
|
+
|
948
|
+
fold = session.addFold("fold0", new Range(0, 10, 0, 21));
|
949
|
+
assert.equal(foldData[0].folds.length, 1);
|
950
|
+
assert.equal(fold.subFolds.length, 1);
|
951
|
+
assert.equal(fold.subFolds[0], oldFold);
|
952
|
+
|
953
|
+
session.expandFold(fold);
|
954
|
+
assert.equal(foldData[0].folds.length, 1);
|
955
|
+
assert.equal(foldData[0].folds[0], oldFold);
|
956
|
+
assert.equal(fold.subFolds.length, 0);
|
957
|
+
|
958
|
+
fold = session.addFold("fold0", new Range(0, 13, 2, 10));
|
959
|
+
assert.equal(foldData.length, 1);
|
960
|
+
assert.equal(fold.subFolds.length, 2);
|
961
|
+
assert.equal(fold.subFolds[0], oldFold);
|
962
|
+
|
963
|
+
session.expandFold(fold);
|
964
|
+
assert.equal(foldData.length, 2);
|
965
|
+
assert.equal(foldData[0].folds.length, 1);
|
966
|
+
assert.equal(foldData[0].folds[0], oldFold);
|
967
|
+
assert.equal(fold.subFolds.length, 0);
|
968
|
+
|
969
|
+
session.unfold(null, true);
|
970
|
+
fold = session.addFold("fold0", new Range(0, 0, 0, 21));
|
971
|
+
session.addFold("fold0", new Range(0, 1, 0, 5));
|
972
|
+
session.addFold("fold0", new Range(0, 6, 0, 8));
|
973
|
+
assert.equal(fold.subFolds.length, 2);
|
974
|
+
}
|
975
|
+
};
|
976
|
+
|
977
|
+
});
|
978
|
+
|
979
|
+
if (typeof module !== "undefined" && module === require.main) {
|
980
|
+
require("asyncjs").test.testcase(module.exports).exec()
|
981
|
+
}
|