mdbe 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/app.rb +182 -0
- data/bin/mdbe +5 -0
- data/config.ru +2 -0
- data/environment.rb +8 -0
- data/lib/mdbe.rb +39 -0
- data/lib/mdbe/action_controller_debug_patch.rb +12 -0
- data/lib/mdbe/code_evaluation.rb +46 -0
- data/lib/mdbe/database_views.rb +24 -0
- data/lib/mdbe/database_views/abstract_dictionary.rb +69 -0
- data/lib/mdbe/database_views/abstract_exception.rb +25 -0
- data/lib/mdbe/database_views/array.rb +28 -0
- data/lib/mdbe/database_views/boolean.rb +12 -0
- data/lib/mdbe/database_views/class.rb +46 -0
- data/lib/mdbe/database_views/exception.rb +3 -0
- data/lib/mdbe/database_views/execblock.rb +5 -0
- data/lib/mdbe/database_views/fixnum.rb +5 -0
- data/lib/mdbe/database_views/float.rb +5 -0
- data/lib/mdbe/database_views/globals.rb +2 -0
- data/lib/mdbe/database_views/gsnmethod.rb +29 -0
- data/lib/mdbe/database_views/hash.rb +5 -0
- data/lib/mdbe/database_views/maglev_record.rb +42 -0
- data/lib/mdbe/database_views/module.rb +103 -0
- data/lib/mdbe/database_views/nilclass.rb +5 -0
- data/lib/mdbe/database_views/object.rb +80 -0
- data/lib/mdbe/database_views/proc.rb +3 -0
- data/lib/mdbe/database_views/repository.rb +3 -0
- data/lib/mdbe/database_views/ruby_workspace.rb +5 -0
- data/lib/mdbe/database_views/smalltalk_classes.rb +34 -0
- data/lib/mdbe/database_views/smalltalk_classes.st +60 -0
- data/lib/mdbe/database_views/string.rb +31 -0
- data/lib/mdbe/database_views/symbol.rb +32 -0
- data/lib/mdbe/database_views/system.rb +61 -0
- data/lib/mdbe/database_views/thread.rb +101 -0
- data/lib/mdbe/debug_server.rb +22 -0
- data/lib/mdbe/halt.rb +42 -0
- data/lib/mdbe/ruby_workspace.rb +29 -0
- data/lib/mdbe/version.rb +3 -0
- data/lib/tasks/maglev-database-explorer_tasks.rake +4 -0
- data/public/LICENSE +35 -0
- data/public/amber/CHANGELOG +65 -0
- data/public/amber/LICENSE +22 -0
- data/public/amber/Makefile +53 -0
- data/public/amber/README.md +30 -0
- data/public/amber/bin/amber +3 -0
- data/public/amber/bin/amberc +352 -0
- data/public/amber/bin/nodecompile.js +33 -0
- data/public/amber/bin/server +3 -0
- data/public/amber/bin/server.bat +3 -0
- data/public/amber/css/amber-normalize.css +468 -0
- data/public/amber/css/amber-normalize.less +501 -0
- data/public/amber/css/amber.css +539 -0
- data/public/amber/css/documentation.css +84 -0
- data/public/amber/css/profstef.css +75 -0
- data/public/amber/css/style.css +313 -0
- data/public/amber/documentation.html +37 -0
- data/public/amber/examples/Makefile +23 -0
- data/public/amber/examples/README +4 -0
- data/public/amber/examples/android/helloamber/AndroidManifest.xml +19 -0
- data/public/amber/examples/android/helloamber/HelloAmber.st +13 -0
- data/public/amber/examples/android/helloamber/Makefile +56 -0
- data/public/amber/examples/android/helloamber/README.md +80 -0
- data/public/amber/examples/android/helloamber/ant.properties +17 -0
- data/public/amber/examples/android/helloamber/assets/index.html +15 -0
- data/public/amber/examples/android/helloamber/assets/jquery-1.7.2.min.js +4 -0
- data/public/amber/examples/android/helloamber/build.xml +83 -0
- data/public/amber/examples/android/helloamber/local.properties +10 -0
- data/public/amber/examples/android/helloamber/proguard-project.txt +20 -0
- data/public/amber/examples/android/helloamber/project.properties +14 -0
- data/public/amber/examples/android/helloamber/res/layout/main.xml +6 -0
- data/public/amber/examples/android/helloamber/res/values/strings.xml +4 -0
- data/public/amber/examples/android/helloamber/src/org/amberlang/android/helloamber/HelloAmber.java +59 -0
- data/public/amber/examples/myproject/index.html +16 -0
- data/public/amber/examples/nodejs/README +9 -0
- data/public/amber/examples/nodejs/benchfib/Benchfib.st +124 -0
- data/public/amber/examples/nodejs/benchfib/Makefile +8 -0
- data/public/amber/examples/nodejs/benchfib/benchfib +1 -0
- data/public/amber/examples/nodejs/hello/Hello.st +9 -0
- data/public/amber/examples/nodejs/hello/Makefile +8 -0
- data/public/amber/examples/nodejs/hello/README +13 -0
- data/public/amber/examples/nodejs/hello/hello +1 -0
- data/public/amber/examples/nodejs/meta/Makefile +8 -0
- data/public/amber/examples/nodejs/meta/MyScript.st +27 -0
- data/public/amber/examples/nodejs/meta/meta +1 -0
- data/public/amber/examples/nodejs/pystone/Makefile +8 -0
- data/public/amber/examples/nodejs/pystone/Pystone.st +306 -0
- data/public/amber/examples/nodejs/pystone/pystone +1 -0
- data/public/amber/examples/nodejs/trivialserver/Makefile +8 -0
- data/public/amber/examples/nodejs/trivialserver/TrivialServer.st +51 -0
- data/public/amber/examples/nodejs/trivialserver/trivial +1 -0
- data/public/amber/examples/presentation/esug2011/images/asterix.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_box.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/devices.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/enyo.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/ide_star_wars.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/terminal.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/webos.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/amber.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/ambrhino.jpg +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/pharo.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/php.gif +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/rails.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-next.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-prev.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/closedhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/openhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-back.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-forward.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.css +100 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.js +1232 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.min.js +13 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.easing.1.3.js +38 -0
- data/public/amber/examples/presentation/index.html +17 -0
- data/public/amber/examples/presentation/js/Presentation.deploy.js +1922 -0
- data/public/amber/examples/presentation/js/Presentation.js +2712 -0
- data/public/amber/examples/presentation/st/Presentation.st +1996 -0
- data/public/amber/examples/trysmalltalk/index.html +18 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.deploy.js +837 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.js +1206 -0
- data/public/amber/examples/trysmalltalk/st/TrySmalltalk.st +964 -0
- data/public/amber/examples/twitterwall/css/twitterwall.css +19 -0
- data/public/amber/examples/twitterwall/index.html +35 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.deploy.js +116 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.js +146 -0
- data/public/amber/examples/twitterwall/st/TwitterWall.st +91 -0
- data/public/amber/examples/webos/README +11 -0
- data/public/amber/examples/webos/eris/DuckQwaq.wav +0 -0
- data/public/amber/examples/webos/eris/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/eris/Eris.css +0 -0
- data/public/amber/examples/webos/eris/Eris.st +86 -0
- data/public/amber/examples/webos/eris/Makefile +37 -0
- data/public/amber/examples/webos/eris/README +3 -0
- data/public/amber/examples/webos/eris/appinfo.json +10 -0
- data/public/amber/examples/webos/eris/index.html +12 -0
- data/public/amber/examples/webos/helloamber/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/helloamber/HelloAmber.st +86 -0
- data/public/amber/examples/webos/helloamber/Makefile +38 -0
- data/public/amber/examples/webos/helloamber/README +5 -0
- data/public/amber/examples/webos/helloamber/appinfo.json +10 -0
- data/public/amber/examples/webos/helloamber/index.html +12 -0
- data/public/amber/favicon.ico +0 -0
- data/public/amber/images/amber.png +0 -0
- data/public/amber/images/amber.svg +706 -0
- data/public/amber/images/amber_small.png +0 -0
- data/public/amber/images/off.amber.png +0 -0
- data/public/amber/images/off.png +0 -0
- data/public/amber/images/offHover.amber.png +0 -0
- data/public/amber/images/offHover.png +0 -0
- data/public/amber/images/presentation.png +0 -0
- data/public/amber/images/profstef.png +0 -0
- data/public/amber/images/sprite.amber.png +0 -0
- data/public/amber/images/sprite.png +0 -0
- data/public/amber/images/tinylogo.amber.png +0 -0
- data/public/amber/images/tinylogo.png +0 -0
- data/public/amber/images/twitterwall.png +0 -0
- data/public/amber/index.html +55 -0
- data/public/amber/js/Additional-Examples.deploy.js +15 -0
- data/public/amber/js/Additional-Examples.js +21 -0
- data/public/amber/js/Benchfib.deploy.js +132 -0
- data/public/amber/js/Benchfib.js +167 -0
- data/public/amber/js/Canvas.deploy.js +2446 -0
- data/public/amber/js/Canvas.js +3547 -0
- data/public/amber/js/Compiler-Tests.deploy.js +97 -0
- data/public/amber/js/Compiler-Tests.js +137 -0
- data/public/amber/js/Compiler.deploy.js +1877 -0
- data/public/amber/js/Compiler.js +2622 -0
- data/public/amber/js/Documentation.deploy.js +961 -0
- data/public/amber/js/Documentation.js +1376 -0
- data/public/amber/js/Examples.deploy.js +53 -0
- data/public/amber/js/Examples.js +73 -0
- data/public/amber/js/IDE.deploy.js +3557 -0
- data/public/amber/js/IDE.js +5002 -0
- data/public/amber/js/Kernel-Announcements.deploy.js +107 -0
- data/public/amber/js/Kernel-Announcements.js +152 -0
- data/public/amber/js/Kernel-Classes.deploy.js +774 -0
- data/public/amber/js/Kernel-Classes.js +1095 -0
- data/public/amber/js/Kernel-Collections.deploy.js +3121 -0
- data/public/amber/js/Kernel-Collections.js +4427 -0
- data/public/amber/js/Kernel-Exceptions.deploy.js +244 -0
- data/public/amber/js/Kernel-Exceptions.js +349 -0
- data/public/amber/js/Kernel-Methods.deploy.js +573 -0
- data/public/amber/js/Kernel-Methods.js +807 -0
- data/public/amber/js/Kernel-Objects.deploy.js +2877 -0
- data/public/amber/js/Kernel-Objects.js +4107 -0
- data/public/amber/js/Kernel-Tests.deploy.js +1513 -0
- data/public/amber/js/Kernel-Tests.js +2053 -0
- data/public/amber/js/Kernel-Transcript.deploy.js +142 -0
- data/public/amber/js/Kernel-Transcript.js +202 -0
- data/public/amber/js/Maglev-Core.deploy.js +2996 -0
- data/public/amber/js/Maglev-Core.js +4246 -0
- data/public/amber/js/Maglev-Database-Explorer.deploy.js +4476 -0
- data/public/amber/js/Maglev-Database-Explorer.js +6232 -0
- data/public/amber/js/Maglev-Vendor.deploy.js +350 -0
- data/public/amber/js/Maglev-Vendor.js +465 -0
- data/public/amber/js/README.md +5 -0
- data/public/amber/js/SUnit.deploy.js +351 -0
- data/public/amber/js/SUnit.js +501 -0
- data/public/amber/js/amber.js +273 -0
- data/public/amber/js/boot.js +602 -0
- data/public/amber/js/compat.js +22 -0
- data/public/amber/js/init.js +9 -0
- data/public/amber/js/lib/CodeMirror/LICENSE +19 -0
- data/public/amber/js/lib/CodeMirror/active-line.js +39 -0
- data/public/amber/js/lib/CodeMirror/amber.css +21 -0
- data/public/amber/js/lib/CodeMirror/codemirror.css +67 -0
- data/public/amber/js/lib/CodeMirror/codemirror.js +2144 -0
- data/public/amber/js/lib/CodeMirror/smalltalk.js +134 -0
- data/public/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
- data/public/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
- data/public/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
- data/public/amber/js/lib/jQuery/jquery.textarea.js +267 -0
- data/public/amber/js/lib/peg-0.6.2.min.js +2 -0
- data/public/amber/js/lib/showdown.js +419 -0
- data/public/amber/js/parser.js +4222 -0
- data/public/amber/js/parser.pegjs +223 -0
- data/public/amber/learn.html +40 -0
- data/public/amber/repl/Makefile +8 -0
- data/public/amber/repl/REPL.js +124 -0
- data/public/amber/repl/REPL.st +56 -0
- data/public/amber/repl/amber.js +18085 -0
- data/public/amber/server/FileServer.st +576 -0
- data/public/amber/server/Makefile +8 -0
- data/public/amber/server/server.js +13049 -0
- data/public/amber/st/Benchfib.js +297 -0
- data/public/amber/st/Benchfib.st +124 -0
- data/public/amber/st/Canvas.st +968 -0
- data/public/amber/st/Compiler-Tests.st +471 -0
- data/public/amber/st/Compiler.st +1445 -0
- data/public/amber/st/Documentation.st +758 -0
- data/public/amber/st/Examples.js +100 -0
- data/public/amber/st/Examples.st +38 -0
- data/public/amber/st/IDE.st +2404 -0
- data/public/amber/st/Kernel-Announcements.st +61 -0
- data/public/amber/st/Kernel-Classes.st +462 -0
- data/public/amber/st/Kernel-Collections.st +1611 -0
- data/public/amber/st/Kernel-Exceptions.st +124 -0
- data/public/amber/st/Kernel-Methods.st +291 -0
- data/public/amber/st/Kernel-Objects.st +1587 -0
- data/public/amber/st/Kernel-Tests.st +953 -0
- data/public/amber/st/Kernel-Transcript.st +70 -0
- data/public/amber/st/Maglev-Core.st +1694 -0
- data/public/amber/st/Maglev-Database-Explorer.st +3148 -0
- data/public/amber/st/Maglev-Vendor.st +151 -0
- data/public/amber/st/Makefile +104 -0
- data/public/amber/st/README.md +4 -0
- data/public/amber/st/SUnit.st +172 -0
- data/public/css/bootstrap-combined.no-icons.min.css +731 -0
- data/public/css/bootstrap.css +6811 -0
- data/public/css/images/animated-overlay.gif +0 -0
- data/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/public/css/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/css/jquery-ui.min.css +5 -0
- data/public/css/smalltalk_code.css +42 -0
- data/public/css/style.css +210 -0
- data/public/images/bg_tile.png +0 -0
- data/public/images/maglev-logo.gif +0 -0
- data/public/images/mchammer.gif +0 -0
- data/public/images/rails_tiny.png +0 -0
- data/public/images/ruby.png +0 -0
- data/public/images/ruby_smalltalk_bridge.png +0 -0
- data/public/images/smalltalk.png +0 -0
- data/public/img/glyphicons-halflings.png +0 -0
- data/public/index.html +118 -0
- data/public/libs/bootstrap.min.js +7 -0
- data/public/libs/codemirror/CONTRIBUTING.md +72 -0
- data/public/libs/codemirror/LICENSE +23 -0
- data/public/libs/codemirror/README.md +11 -0
- data/public/libs/codemirror/addon/dialog/dialog.css +32 -0
- data/public/libs/codemirror/addon/dialog/dialog.js +80 -0
- data/public/libs/codemirror/addon/display/placeholder.js +54 -0
- data/public/libs/codemirror/addon/edit/closebrackets.js +54 -0
- data/public/libs/codemirror/addon/edit/closetag.js +86 -0
- data/public/libs/codemirror/addon/edit/continuecomment.js +44 -0
- data/public/libs/codemirror/addon/edit/continuelist.js +25 -0
- data/public/libs/codemirror/addon/edit/matchbrackets.js +82 -0
- data/public/libs/codemirror/addon/fold/brace-fold.js +31 -0
- data/public/libs/codemirror/addon/fold/foldcode.js +32 -0
- data/public/libs/codemirror/addon/fold/indent-fold.js +11 -0
- data/public/libs/codemirror/addon/fold/xml-fold.js +64 -0
- data/public/libs/codemirror/addon/hint/html-hint.js +582 -0
- data/public/libs/codemirror/addon/hint/javascript-hint.js +142 -0
- data/public/libs/codemirror/addon/hint/pig-hint.js +117 -0
- data/public/libs/codemirror/addon/hint/python-hint.js +93 -0
- data/public/libs/codemirror/addon/hint/show-hint.css +38 -0
- data/public/libs/codemirror/addon/hint/show-hint.js +180 -0
- data/public/libs/codemirror/addon/hint/xml-hint.js +118 -0
- data/public/libs/codemirror/addon/lint/javascript-lint.js +127 -0
- data/public/libs/codemirror/addon/lint/json-lint.js +14 -0
- data/public/libs/codemirror/addon/lint/lint.css +96 -0
- data/public/libs/codemirror/addon/lint/lint.js +197 -0
- data/public/libs/codemirror/addon/mode/loadmode.js +51 -0
- data/public/libs/codemirror/addon/mode/multiplex.js +95 -0
- data/public/libs/codemirror/addon/mode/overlay.js +59 -0
- data/public/libs/codemirror/addon/runmode/colorize.js +29 -0
- data/public/libs/codemirror/addon/runmode/runmode-standalone.js +130 -0
- data/public/libs/codemirror/addon/runmode/runmode.js +52 -0
- data/public/libs/codemirror/addon/runmode/runmode.node.js +89 -0
- data/public/libs/codemirror/addon/search/match-highlighter.js +60 -0
- data/public/libs/codemirror/addon/search/search.js +131 -0
- data/public/libs/codemirror/addon/search/searchcursor.js +133 -0
- data/public/libs/codemirror/addon/selection/active-line.js +39 -0
- data/public/libs/codemirror/addon/selection/mark-selection.js +34 -0
- data/public/libs/codemirror/bin/compress +91 -0
- data/public/libs/codemirror/bin/lint +11 -0
- data/public/libs/codemirror/demo/activeline.html +70 -0
- data/public/libs/codemirror/demo/bidi.html +61 -0
- data/public/libs/codemirror/demo/btree.html +87 -0
- data/public/libs/codemirror/demo/buffers.html +98 -0
- data/public/libs/codemirror/demo/changemode.html +50 -0
- data/public/libs/codemirror/demo/closebrackets.html +63 -0
- data/public/libs/codemirror/demo/closetag.html +37 -0
- data/public/libs/codemirror/demo/complete.html +70 -0
- data/public/libs/codemirror/demo/emacs.html +60 -0
- data/public/libs/codemirror/demo/folding.html +69 -0
- data/public/libs/codemirror/demo/fullscreen.html +147 -0
- data/public/libs/codemirror/demo/html5complete.html +92 -0
- data/public/libs/codemirror/demo/indentwrap.html +49 -0
- data/public/libs/codemirror/demo/lint.html +90 -0
- data/public/libs/codemirror/demo/loadmode.html +40 -0
- data/public/libs/codemirror/demo/marker.html +59 -0
- data/public/libs/codemirror/demo/markselection.html +36 -0
- data/public/libs/codemirror/demo/matchhighlighter.html +38 -0
- data/public/libs/codemirror/demo/multiplex.html +60 -0
- data/public/libs/codemirror/demo/mustache.html +59 -0
- data/public/libs/codemirror/demo/placeholder.html +36 -0
- data/public/libs/codemirror/demo/preview.html +76 -0
- data/public/libs/codemirror/demo/resize.html +49 -0
- data/public/libs/codemirror/demo/runmode.html +50 -0
- data/public/libs/codemirror/demo/search.html +85 -0
- data/public/libs/codemirror/demo/spanaffectswrapping_shim.html +73 -0
- data/public/libs/codemirror/demo/theme.html +89 -0
- data/public/libs/codemirror/demo/variableheight.html +52 -0
- data/public/libs/codemirror/demo/vim.html +65 -0
- data/public/libs/codemirror/demo/visibletabs.html +53 -0
- data/public/libs/codemirror/demo/widget.html +74 -0
- data/public/libs/codemirror/demo/xmlcomplete.html +81 -0
- data/public/libs/codemirror/index.html +487 -0
- data/public/libs/codemirror/keymap/emacs.js +30 -0
- data/public/libs/codemirror/keymap/vim.js +3044 -0
- data/public/libs/codemirror/lib/codemirror.css +253 -0
- data/public/libs/codemirror/lib/codemirror.js +5585 -0
- data/public/libs/codemirror/mode/apl/apl.js +160 -0
- data/public/libs/codemirror/mode/apl/index.html +61 -0
- data/public/libs/codemirror/mode/asterisk/asterisk.js +183 -0
- data/public/libs/codemirror/mode/asterisk/index.html +142 -0
- data/public/libs/codemirror/mode/clike/clike.js +302 -0
- data/public/libs/codemirror/mode/clike/index.html +103 -0
- data/public/libs/codemirror/mode/clike/scala.html +767 -0
- data/public/libs/codemirror/mode/clojure/clojure.js +222 -0
- data/public/libs/codemirror/mode/clojure/index.html +76 -0
- data/public/libs/codemirror/mode/coffeescript/LICENSE +22 -0
- data/public/libs/codemirror/mode/coffeescript/coffeescript.js +346 -0
- data/public/libs/codemirror/mode/coffeescript/index.html +728 -0
- data/public/libs/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/public/libs/codemirror/mode/commonlisp/index.html +165 -0
- data/public/libs/codemirror/mode/css/css.js +567 -0
- data/public/libs/codemirror/mode/css/index.html +58 -0
- data/public/libs/codemirror/mode/css/scss.html +145 -0
- data/public/libs/codemirror/mode/css/scss_test.js +80 -0
- data/public/libs/codemirror/mode/css/test.js +113 -0
- data/public/libs/codemirror/mode/d/d.js +205 -0
- data/public/libs/codemirror/mode/d/index.html +262 -0
- data/public/libs/codemirror/mode/diff/diff.js +32 -0
- data/public/libs/codemirror/mode/diff/index.html +105 -0
- data/public/libs/codemirror/mode/ecl/ecl.js +192 -0
- data/public/libs/codemirror/mode/ecl/index.html +39 -0
- data/public/libs/codemirror/mode/erlang/erlang.js +463 -0
- data/public/libs/codemirror/mode/erlang/index.html +64 -0
- data/public/libs/codemirror/mode/gas/gas.js +326 -0
- data/public/libs/codemirror/mode/gas/index.html +57 -0
- data/public/libs/codemirror/mode/gfm/gfm.js +96 -0
- data/public/libs/codemirror/mode/gfm/index.html +74 -0
- data/public/libs/codemirror/mode/gfm/test.js +112 -0
- data/public/libs/codemirror/mode/go/go.js +165 -0
- data/public/libs/codemirror/mode/go/index.html +74 -0
- data/public/libs/codemirror/mode/groovy/groovy.js +210 -0
- data/public/libs/codemirror/mode/groovy/index.html +73 -0
- data/public/libs/codemirror/mode/haskell/haskell.js +242 -0
- data/public/libs/codemirror/mode/haskell/index.html +62 -0
- data/public/libs/codemirror/mode/haxe/haxe.js +429 -0
- data/public/libs/codemirror/mode/haxe/index.html +90 -0
- data/public/libs/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/public/libs/codemirror/mode/htmlembedded/index.html +49 -0
- data/public/libs/codemirror/mode/htmlmixed/htmlmixed.js +104 -0
- data/public/libs/codemirror/mode/htmlmixed/index.html +73 -0
- data/public/libs/codemirror/mode/http/http.js +98 -0
- data/public/libs/codemirror/mode/http/index.html +32 -0
- data/public/libs/codemirror/mode/javascript/index.html +92 -0
- data/public/libs/codemirror/mode/javascript/javascript.js +467 -0
- data/public/libs/codemirror/mode/javascript/typescript.html +48 -0
- data/public/libs/codemirror/mode/jinja2/index.html +38 -0
- data/public/libs/codemirror/mode/jinja2/jinja2.js +42 -0
- data/public/libs/codemirror/mode/less/index.html +741 -0
- data/public/libs/codemirror/mode/less/less.js +266 -0
- data/public/libs/codemirror/mode/livescript/LICENSE +23 -0
- data/public/libs/codemirror/mode/livescript/index.html +446 -0
- data/public/libs/codemirror/mode/livescript/livescript.js +267 -0
- data/public/libs/codemirror/mode/livescript/livescript.ls +266 -0
- data/public/libs/codemirror/mode/lua/index.html +74 -0
- data/public/libs/codemirror/mode/lua/lua.js +140 -0
- data/public/libs/codemirror/mode/markdown/index.html +344 -0
- data/public/libs/codemirror/mode/markdown/markdown.js +526 -0
- data/public/libs/codemirror/mode/markdown/test.js +636 -0
- data/public/libs/codemirror/mode/meta.js +75 -0
- data/public/libs/codemirror/mode/mirc/index.html +149 -0
- data/public/libs/codemirror/mode/mirc/mirc.js +177 -0
- data/public/libs/codemirror/mode/ntriples/index.html +33 -0
- data/public/libs/codemirror/mode/ntriples/ntriples.js +170 -0
- data/public/libs/codemirror/mode/ocaml/index.html +131 -0
- data/public/libs/codemirror/mode/ocaml/ocaml.js +113 -0
- data/public/libs/codemirror/mode/pascal/LICENSE +7 -0
- data/public/libs/codemirror/mode/pascal/index.html +48 -0
- data/public/libs/codemirror/mode/pascal/pascal.js +94 -0
- data/public/libs/codemirror/mode/perl/LICENSE +19 -0
- data/public/libs/codemirror/mode/perl/index.html +62 -0
- data/public/libs/codemirror/mode/perl/perl.js +816 -0
- data/public/libs/codemirror/mode/php/index.html +51 -0
- data/public/libs/codemirror/mode/php/php.js +129 -0
- data/public/libs/codemirror/mode/pig/index.html +42 -0
- data/public/libs/codemirror/mode/pig/pig.js +171 -0
- data/public/libs/codemirror/mode/properties/index.html +41 -0
- data/public/libs/codemirror/mode/properties/properties.js +63 -0
- data/public/libs/codemirror/mode/python/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/python/index.html +135 -0
- data/public/libs/codemirror/mode/python/python.js +340 -0
- data/public/libs/codemirror/mode/q/index.html +131 -0
- data/public/libs/codemirror/mode/q/q.js +124 -0
- data/public/libs/codemirror/mode/r/LICENSE +24 -0
- data/public/libs/codemirror/mode/r/index.html +74 -0
- data/public/libs/codemirror/mode/r/r.js +141 -0
- data/public/libs/codemirror/mode/rpm/changes/changes.js +19 -0
- data/public/libs/codemirror/mode/rpm/changes/index.html +53 -0
- data/public/libs/codemirror/mode/rpm/spec/index.html +99 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.css +5 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.js +66 -0
- data/public/libs/codemirror/mode/rst/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/rst/index.html +524 -0
- data/public/libs/codemirror/mode/rst/rst.js +550 -0
- data/public/libs/codemirror/mode/ruby/LICENSE +24 -0
- data/public/libs/codemirror/mode/ruby/index.html +173 -0
- data/public/libs/codemirror/mode/ruby/ruby.js +197 -0
- data/public/libs/codemirror/mode/rust/index.html +48 -0
- data/public/libs/codemirror/mode/rust/rust.js +432 -0
- data/public/libs/codemirror/mode/sass/index.html +54 -0
- data/public/libs/codemirror/mode/sass/sass.js +349 -0
- data/public/libs/codemirror/mode/scheme/index.html +65 -0
- data/public/libs/codemirror/mode/scheme/scheme.js +230 -0
- data/public/libs/codemirror/mode/shell/index.html +51 -0
- data/public/libs/codemirror/mode/shell/shell.js +118 -0
- data/public/libs/codemirror/mode/sieve/LICENSE +19 -0
- data/public/libs/codemirror/mode/sieve/index.html +81 -0
- data/public/libs/codemirror/mode/sieve/sieve.js +183 -0
- data/public/libs/codemirror/mode/smalltalk/index.html +57 -0
- data/public/libs/codemirror/mode/smalltalk/smalltalk.js +141 -0
- data/public/libs/codemirror/mode/smarty/index.html +83 -0
- data/public/libs/codemirror/mode/smarty/smarty.js +148 -0
- data/public/libs/codemirror/mode/sparql/index.html +42 -0
- data/public/libs/codemirror/mode/sparql/sparql.js +143 -0
- data/public/libs/codemirror/mode/sql/index.html +68 -0
- data/public/libs/codemirror/mode/sql/sql.js +268 -0
- data/public/libs/codemirror/mode/stex/index.html +98 -0
- data/public/libs/codemirror/mode/stex/stex.js +246 -0
- data/public/libs/codemirror/mode/stex/test.js +117 -0
- data/public/libs/codemirror/mode/tcl/index.html +129 -0
- data/public/libs/codemirror/mode/tcl/tcl.js +131 -0
- data/public/libs/codemirror/mode/tiddlywiki/index.html +142 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/public/libs/codemirror/mode/tiki/index.html +81 -0
- data/public/libs/codemirror/mode/tiki/tiki.css +26 -0
- data/public/libs/codemirror/mode/tiki/tiki.js +308 -0
- data/public/libs/codemirror/mode/turtle/index.html +39 -0
- data/public/libs/codemirror/mode/turtle/turtle.js +145 -0
- data/public/libs/codemirror/mode/vb/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/vb/index.html +88 -0
- data/public/libs/codemirror/mode/vb/vb.js +259 -0
- data/public/libs/codemirror/mode/vbscript/index.html +42 -0
- data/public/libs/codemirror/mode/vbscript/vbscript.js +26 -0
- data/public/libs/codemirror/mode/velocity/index.html +103 -0
- data/public/libs/codemirror/mode/velocity/velocity.js +144 -0
- data/public/libs/codemirror/mode/verilog/index.html +121 -0
- data/public/libs/codemirror/mode/verilog/verilog.js +182 -0
- data/public/libs/codemirror/mode/xml/index.html +45 -0
- data/public/libs/codemirror/mode/xml/xml.js +328 -0
- data/public/libs/codemirror/mode/xquery/LICENSE +20 -0
- data/public/libs/codemirror/mode/xquery/index.html +221 -0
- data/public/libs/codemirror/mode/xquery/test.js +64 -0
- data/public/libs/codemirror/mode/xquery/xquery.js +450 -0
- data/public/libs/codemirror/mode/yaml/index.html +68 -0
- data/public/libs/codemirror/mode/yaml/yaml.js +95 -0
- data/public/libs/codemirror/mode/z80/index.html +39 -0
- data/public/libs/codemirror/mode/z80/z80.js +85 -0
- data/public/libs/codemirror/package.json +21 -0
- data/public/libs/codemirror/test/doc_test.js +329 -0
- data/public/libs/codemirror/test/driver.js +138 -0
- data/public/libs/codemirror/test/index.html +182 -0
- data/public/libs/codemirror/test/lint/acorn.js +1593 -0
- data/public/libs/codemirror/test/lint/lint.js +112 -0
- data/public/libs/codemirror/test/lint/parse-js.js +1372 -0
- data/public/libs/codemirror/test/lint/walk.js +216 -0
- data/public/libs/codemirror/test/mode_test.css +10 -0
- data/public/libs/codemirror/test/mode_test.js +192 -0
- data/public/libs/codemirror/test/phantom_driver.js +31 -0
- data/public/libs/codemirror/test/run.js +33 -0
- data/public/libs/codemirror/test/test.js +1400 -0
- data/public/libs/codemirror/test/vim_test.js +1688 -0
- data/public/libs/codemirror/theme/ambiance-mobile.css +5 -0
- data/public/libs/codemirror/theme/ambiance.css +75 -0
- data/public/libs/codemirror/theme/blackboard.css +25 -0
- data/public/libs/codemirror/theme/cobalt.css +18 -0
- data/public/libs/codemirror/theme/eclipse.css +25 -0
- data/public/libs/codemirror/theme/elegant.css +10 -0
- data/public/libs/codemirror/theme/erlang-dark.css +21 -0
- data/public/libs/codemirror/theme/lesser-dark.css +44 -0
- data/public/libs/codemirror/theme/midnight.css +52 -0
- data/public/libs/codemirror/theme/monokai.css +28 -0
- data/public/libs/codemirror/theme/neat.css +9 -0
- data/public/libs/codemirror/theme/night.css +21 -0
- data/public/libs/codemirror/theme/rubyblue.css +21 -0
- data/public/libs/codemirror/theme/solarized.css +207 -0
- data/public/libs/codemirror/theme/twilight.css +26 -0
- data/public/libs/codemirror/theme/vibrant-ink.css +27 -0
- data/public/libs/codemirror/theme/xq-dark.css +46 -0
- data/public/libs/codemirror/theme/xq-light.css +43 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.css +983 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.min.css +24 -0
- data/public/libs/font-awesome/css/font-awesome.css +1268 -0
- data/public/libs/font-awesome/css/font-awesome.min.css +24 -0
- data/public/libs/font-awesome/font/FontAwesome.otf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.eot +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.svg +339 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.ttf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.woff +0 -0
- data/public/libs/font-awesome/less/bootstrap.less +78 -0
- data/public/libs/font-awesome/less/core.less +132 -0
- data/public/libs/font-awesome/less/extras.less +79 -0
- data/public/libs/font-awesome/less/font-awesome-ie7.less +413 -0
- data/public/libs/font-awesome/less/font-awesome.less +32 -0
- data/public/libs/font-awesome/less/icons.less +330 -0
- data/public/libs/font-awesome/less/mixins.less +34 -0
- data/public/libs/font-awesome/less/path.less +15 -0
- data/public/libs/font-awesome/less/variables.less +9 -0
- data/public/libs/jquery-1.10.0.min.js +6 -0
- data/public/libs/jquery-ui.min.js +12 -0
- data/public/libs/jquery.jsPlumb-1.4.0-all.js +9571 -0
- data/public/libs/jquery.livequery.js +226 -0
- data/public/libs/jsPlumbInitializer.js +72 -0
- data/public/libs/jstree/README.txt +10 -0
- data/public/libs/jstree/_demo/_dump.sql +20 -0
- data/public/libs/jstree/_demo/_inc/__mysql_errors.log +0 -0
- data/public/libs/jstree/_demo/_inc/class._database.php +146 -0
- data/public/libs/jstree/_demo/_inc/class._database_i.php +152 -0
- data/public/libs/jstree/_demo/_inc/class.tree.php +602 -0
- data/public/libs/jstree/_demo/_install.txt +6 -0
- data/public/libs/jstree/_demo/config.php +14 -0
- data/public/libs/jstree/_demo/file.png +0 -0
- data/public/libs/jstree/_demo/folder.png +0 -0
- data/public/libs/jstree/_demo/index.html +461 -0
- data/public/libs/jstree/_demo/root.png +0 -0
- data/public/libs/jstree/_demo/server.php +69 -0
- data/public/libs/jstree/_docs/!style.css +48 -0
- data/public/libs/jstree/_docs/_drive.png +0 -0
- data/public/libs/jstree/_docs/_html_data.html +2 -0
- data/public/libs/jstree/_docs/_json_data.json +4 -0
- data/public/libs/jstree/_docs/_search_data.json +6 -0
- data/public/libs/jstree/_docs/_search_result.json +1 -0
- data/public/libs/jstree/_docs/_xml_flat.xml +12 -0
- data/public/libs/jstree/_docs/_xml_nest.xml +18 -0
- data/public/libs/jstree/_docs/checkbox.html +171 -0
- data/public/libs/jstree/_docs/contextmenu.html +121 -0
- data/public/libs/jstree/_docs/cookies.html +97 -0
- data/public/libs/jstree/_docs/core.html +689 -0
- data/public/libs/jstree/_docs/crrm.html +316 -0
- data/public/libs/jstree/_docs/dnd.html +199 -0
- data/public/libs/jstree/_docs/hotkeys.html +82 -0
- data/public/libs/jstree/_docs/html_data.html +175 -0
- data/public/libs/jstree/_docs/index.html +86 -0
- data/public/libs/jstree/_docs/json_data.html +249 -0
- data/public/libs/jstree/_docs/languages.html +152 -0
- data/public/libs/jstree/_docs/logo.png +0 -0
- data/public/libs/jstree/_docs/search.html +153 -0
- data/public/libs/jstree/_docs/sort.html +85 -0
- data/public/libs/jstree/_docs/syntax/!script.js +2232 -0
- data/public/libs/jstree/_docs/syntax/!style.css +511 -0
- data/public/libs/jstree/_docs/syntax/clipboard.swf +0 -0
- data/public/libs/jstree/_docs/syntax/help.png +0 -0
- data/public/libs/jstree/_docs/syntax/magnifier.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_code.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_copy.png +0 -0
- data/public/libs/jstree/_docs/syntax/printer.png +0 -0
- data/public/libs/jstree/_docs/syntax/wrapping.png +0 -0
- data/public/libs/jstree/_docs/themeroller.html +107 -0
- data/public/libs/jstree/_docs/themes.html +127 -0
- data/public/libs/jstree/_docs/types.html +178 -0
- data/public/libs/jstree/_docs/ui.html +197 -0
- data/public/libs/jstree/_docs/unique.html +85 -0
- data/public/libs/jstree/_docs/xml_data.html +218 -0
- data/public/libs/jstree/_lib/jquery.cookie.js +96 -0
- data/public/libs/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/libs/jstree/_lib/jquery.js +5 -0
- data/public/libs/jstree/jquery.jstree.js +4564 -0
- data/public/libs/jstree/themes/apple/bg.jpg +0 -0
- data/public/libs/jstree/themes/apple/d.png +0 -0
- data/public/libs/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/apple/style.css +61 -0
- data/public/libs/jstree/themes/apple/throbber.gif +0 -0
- data/public/libs/jstree/themes/classic/d.gif +0 -0
- data/public/libs/jstree/themes/classic/d.png +0 -0
- data/public/libs/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/classic/style.css +77 -0
- data/public/libs/jstree/themes/classic/throbber.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.png +0 -0
- data/public/libs/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/style.css +84 -0
- data/public/libs/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/libs/jstree/themes/default/d.gif +0 -0
- data/public/libs/jstree/themes/default/d.png +0 -0
- data/public/libs/jstree/themes/default/style.css +74 -0
- data/public/libs/jstree/themes/default/throbber.gif +0 -0
- data/public/themes/geo-bootstrap/README.md +25 -0
- data/public/themes/geo-bootstrap/img/flames.gif +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings.png +0 -0
- data/public/themes/geo-bootstrap/img/microfab.gif +0 -0
- data/public/themes/geo-bootstrap/img/progress.gif +0 -0
- data/public/themes/geo-bootstrap/img/rainbow.gif +0 -0
- data/public/themes/geo-bootstrap/img/stars.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/7upspot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/americanflag.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/community.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer-01.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/construction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider1.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider3.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider4.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/drudgesiren.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/emailme.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/funky.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/geocities.jpg +0 -0
- data/public/themes/geo-bootstrap/img/test/hacker.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/heart.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/hot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ie_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mailkitten.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mchammer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/noframes.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/notepad.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ns_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/sign-in.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/spinningearth.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/underconstruction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/wabwalk.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/webtrips.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/yahooweek.gif +0 -0
- data/public/themes/geo-bootstrap/package.json +21 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.css +1109 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.min.css +9 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.css +6462 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.min.css +9 -0
- metadata +791 -0
@@ -0,0 +1,1688 @@
|
|
1
|
+
var code = '' +
|
2
|
+
' wOrd1 (#%\n' +
|
3
|
+
' word3] \n' +
|
4
|
+
'aopop pop 0 1 2 3 4\n' +
|
5
|
+
' (a) [b] {c} \n' +
|
6
|
+
'int getchar(void) {\n' +
|
7
|
+
' static char buf[BUFSIZ];\n' +
|
8
|
+
' static char *bufp = buf;\n' +
|
9
|
+
' if (n == 0) { /* buffer is empty */\n' +
|
10
|
+
' n = read(0, buf, sizeof buf);\n' +
|
11
|
+
' bufp = buf;\n' +
|
12
|
+
' }\n' +
|
13
|
+
' return (--n >= 0) ? (unsigned char) *bufp++ : EOF;\n' +
|
14
|
+
'}\n';
|
15
|
+
|
16
|
+
var lines = (function() {
|
17
|
+
lineText = code.split('\n');
|
18
|
+
var ret = [];
|
19
|
+
for (var i = 0; i < lineText.length; i++) {
|
20
|
+
ret[i] = {
|
21
|
+
line: i,
|
22
|
+
length: lineText[i].length,
|
23
|
+
lineText: lineText[i],
|
24
|
+
textStart: /^\s*/.exec(lineText[i])[0].length
|
25
|
+
};
|
26
|
+
}
|
27
|
+
return ret;
|
28
|
+
})();
|
29
|
+
var endOfDocument = makeCursor(lines.length - 1,
|
30
|
+
lines[lines.length - 1].length);
|
31
|
+
var wordLine = lines[0];
|
32
|
+
var bigWordLine = lines[1];
|
33
|
+
var charLine = lines[2];
|
34
|
+
var bracesLine = lines[3];
|
35
|
+
|
36
|
+
var word1 = {
|
37
|
+
start: { line: wordLine.line, ch: 1 },
|
38
|
+
end: { line: wordLine.line, ch: 5 }
|
39
|
+
};
|
40
|
+
var word2 = {
|
41
|
+
start: { line: wordLine.line, ch: word1.end.ch + 2 },
|
42
|
+
end: { line: wordLine.line, ch: word1.end.ch + 4 }
|
43
|
+
};
|
44
|
+
var word3 = {
|
45
|
+
start: { line: bigWordLine.line, ch: 1 },
|
46
|
+
end: { line: bigWordLine.line, ch: 5 }
|
47
|
+
};
|
48
|
+
var bigWord1 = word1;
|
49
|
+
var bigWord2 = word2;
|
50
|
+
var bigWord3 = {
|
51
|
+
start: { line: bigWordLine.line, ch: 1 },
|
52
|
+
end: { line: bigWordLine.line, ch: 7 }
|
53
|
+
};
|
54
|
+
var bigWord4 = {
|
55
|
+
start: { line: bigWordLine.line, ch: bigWord1.end.ch + 3 },
|
56
|
+
end: { line: bigWordLine.line, ch: bigWord1.end.ch + 7 }
|
57
|
+
};
|
58
|
+
|
59
|
+
var oChars = [ { line: charLine.line, ch: 1 },
|
60
|
+
{ line: charLine.line, ch: 3 },
|
61
|
+
{ line: charLine.line, ch: 7 } ];
|
62
|
+
var pChars = [ { line: charLine.line, ch: 2 },
|
63
|
+
{ line: charLine.line, ch: 4 },
|
64
|
+
{ line: charLine.line, ch: 6 },
|
65
|
+
{ line: charLine.line, ch: 8 } ];
|
66
|
+
var numChars = [ { line: charLine.line, ch: 10 },
|
67
|
+
{ line: charLine.line, ch: 12 },
|
68
|
+
{ line: charLine.line, ch: 14 },
|
69
|
+
{ line: charLine.line, ch: 16 },
|
70
|
+
{ line: charLine.line, ch: 18 }];
|
71
|
+
var parens1 = {
|
72
|
+
start: { line: bracesLine.line, ch: 1 },
|
73
|
+
end: { line: bracesLine.line, ch: 3 }
|
74
|
+
};
|
75
|
+
var squares1 = {
|
76
|
+
start: { line: bracesLine.line, ch: 5 },
|
77
|
+
end: { line: bracesLine.line, ch: 7 }
|
78
|
+
};
|
79
|
+
var curlys1 = {
|
80
|
+
start: { line: bracesLine.line, ch: 9 },
|
81
|
+
end: { line: bracesLine.line, ch: 11 }
|
82
|
+
};
|
83
|
+
|
84
|
+
function copyCursor(cur) {
|
85
|
+
return { ch: cur.ch, line: cur.line };
|
86
|
+
}
|
87
|
+
|
88
|
+
function testVim(name, run, opts, expectedFail) {
|
89
|
+
var vimOpts = {
|
90
|
+
lineNumbers: true,
|
91
|
+
keyMap: 'vim',
|
92
|
+
showCursorWhenSelecting: true,
|
93
|
+
value: code
|
94
|
+
};
|
95
|
+
for (var prop in opts) {
|
96
|
+
if (opts.hasOwnProperty(prop)) {
|
97
|
+
vimOpts[prop] = opts[prop];
|
98
|
+
}
|
99
|
+
}
|
100
|
+
return test('vim_' + name, function() {
|
101
|
+
var place = document.getElementById("testground");
|
102
|
+
var cm = CodeMirror(place, vimOpts);
|
103
|
+
CodeMirror.Vim.maybeInitState(cm);
|
104
|
+
var vim = cm.vimState;
|
105
|
+
|
106
|
+
function doKeysFn(cm) {
|
107
|
+
return function(args) {
|
108
|
+
if (args instanceof Array) {
|
109
|
+
arguments = args;
|
110
|
+
}
|
111
|
+
for (var i = 0; i < arguments.length; i++) {
|
112
|
+
CodeMirror.Vim.handleKey(cm, arguments[i]);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
function doExFn(cm) {
|
117
|
+
return function(command) {
|
118
|
+
cm.openDialog = helpers.fakeOpenDialog(command);
|
119
|
+
helpers.doKeys(':');
|
120
|
+
}
|
121
|
+
}
|
122
|
+
function assertCursorAtFn(cm) {
|
123
|
+
return function(line, ch) {
|
124
|
+
var pos;
|
125
|
+
if (ch == null && typeof line.line == 'number') {
|
126
|
+
pos = line;
|
127
|
+
} else {
|
128
|
+
pos = makeCursor(line, ch);
|
129
|
+
}
|
130
|
+
eqPos(pos, cm.getCursor());
|
131
|
+
}
|
132
|
+
}
|
133
|
+
function fakeOpenDialog(result) {
|
134
|
+
return function(text, callback) {
|
135
|
+
return callback(result);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
var helpers = {
|
139
|
+
doKeys: doKeysFn(cm),
|
140
|
+
doEx: doExFn(cm),
|
141
|
+
assertCursorAt: assertCursorAtFn(cm),
|
142
|
+
fakeOpenDialog: fakeOpenDialog,
|
143
|
+
getRegisterController: function() {
|
144
|
+
return CodeMirror.Vim.getRegisterController();
|
145
|
+
}
|
146
|
+
}
|
147
|
+
CodeMirror.Vim.clearVimGlobalState_();
|
148
|
+
var successful = false;
|
149
|
+
try {
|
150
|
+
run(cm, vim, helpers);
|
151
|
+
successful = true;
|
152
|
+
} finally {
|
153
|
+
if ((debug && !successful) || verbose) {
|
154
|
+
place.style.visibility = "visible";
|
155
|
+
} else {
|
156
|
+
place.removeChild(cm.getWrapperElement());
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}, expectedFail);
|
160
|
+
};
|
161
|
+
|
162
|
+
/**
|
163
|
+
* @param name Name of the test
|
164
|
+
* @param keys An array of keys or a string with a single key to simulate.
|
165
|
+
* @param endPos The expected end position of the cursor.
|
166
|
+
* @param startPos The position the cursor should start at, defaults to 0, 0.
|
167
|
+
*/
|
168
|
+
function testMotion(name, keys, endPos, startPos) {
|
169
|
+
testVim(name, function(cm, vim, helpers) {
|
170
|
+
if (!startPos) {
|
171
|
+
startPos = { line: 0, ch: 0 };
|
172
|
+
}
|
173
|
+
cm.setCursor(startPos);
|
174
|
+
helpers.doKeys(keys);
|
175
|
+
helpers.assertCursorAt(endPos);
|
176
|
+
});
|
177
|
+
};
|
178
|
+
|
179
|
+
function makeCursor(line, ch) {
|
180
|
+
return { line: line, ch: ch };
|
181
|
+
};
|
182
|
+
|
183
|
+
function offsetCursor(cur, offsetLine, offsetCh) {
|
184
|
+
return { line: cur.line + offsetLine, ch: cur.ch + offsetCh };
|
185
|
+
};
|
186
|
+
|
187
|
+
// Motion tests
|
188
|
+
testMotion('|', '|', makeCursor(0, 0), makeCursor(0,4));
|
189
|
+
testMotion('|_repeat', ['3', '|'], makeCursor(0, 2), makeCursor(0,4));
|
190
|
+
testMotion('h', 'h', makeCursor(0, 0), word1.start);
|
191
|
+
testMotion('h_repeat', ['3', 'h'], offsetCursor(word1.end, 0, -3), word1.end);
|
192
|
+
testMotion('l', 'l', makeCursor(0, 1));
|
193
|
+
testMotion('l_repeat', ['2', 'l'], makeCursor(0, 2));
|
194
|
+
testMotion('j', 'j', offsetCursor(word1.end, 1, 0), word1.end);
|
195
|
+
testMotion('j_repeat', ['2', 'j'], offsetCursor(word1.end, 2, 0), word1.end);
|
196
|
+
testMotion('k', 'k', offsetCursor(word3.end, -1, 0), word3.end);
|
197
|
+
testMotion('k_repeat', ['2', 'k'], makeCursor(0, 4), makeCursor(2, 4));
|
198
|
+
testMotion('w', 'w', word1.start);
|
199
|
+
testMotion('w_repeat', ['2', 'w'], word2.start);
|
200
|
+
testMotion('w_wrap', ['w'], word3.start, word2.start);
|
201
|
+
testMotion('w_endOfDocument', 'w', endOfDocument, endOfDocument);
|
202
|
+
testMotion('W', 'W', bigWord1.start);
|
203
|
+
testMotion('W_repeat', ['2', 'W'], bigWord3.start, bigWord1.start);
|
204
|
+
testMotion('e', 'e', word1.end);
|
205
|
+
testMotion('e_repeat', ['2', 'e'], word2.end);
|
206
|
+
testMotion('e_wrap', 'e', word3.end, word2.end);
|
207
|
+
testMotion('e_endOfDocument', 'e', endOfDocument, endOfDocument);
|
208
|
+
testMotion('b', 'b', word3.start, word3.end);
|
209
|
+
testMotion('b_repeat', ['2', 'b'], word2.start, word3.end);
|
210
|
+
testMotion('b_wrap', 'b', word2.start, word3.start);
|
211
|
+
testMotion('b_startOfDocument', 'b', makeCursor(0, 0), makeCursor(0, 0));
|
212
|
+
testMotion('ge', ['g', 'e'], word2.end, word3.end);
|
213
|
+
testMotion('ge_repeat', ['2', 'g', 'e'], word1.end, word3.start);
|
214
|
+
testMotion('ge_wrap', ['g', 'e'], word2.end, word3.start);
|
215
|
+
testMotion('ge_startOfDocument', ['g', 'e'], makeCursor(0, 0),
|
216
|
+
makeCursor(0, 0));
|
217
|
+
testMotion('gg', ['g', 'g'], makeCursor(lines[0].line, lines[0].textStart),
|
218
|
+
makeCursor(3, 1));
|
219
|
+
testMotion('gg_repeat', ['3', 'g', 'g'],
|
220
|
+
makeCursor(lines[2].line, lines[2].textStart));
|
221
|
+
testMotion('G', 'G',
|
222
|
+
makeCursor(lines[lines.length - 1].line, lines[lines.length - 1].textStart),
|
223
|
+
makeCursor(3, 1));
|
224
|
+
testMotion('G_repeat', ['3', 'G'], makeCursor(lines[2].line,
|
225
|
+
lines[2].textStart));
|
226
|
+
// TODO: Make the test code long enough to test Ctrl-F and Ctrl-B.
|
227
|
+
testMotion('0', '0', makeCursor(0, 0), makeCursor(0, 8));
|
228
|
+
testMotion('^', '^', makeCursor(0, lines[0].textStart), makeCursor(0, 8));
|
229
|
+
testMotion('+', '+', makeCursor(1, lines[1].textStart), makeCursor(0, 8));
|
230
|
+
testMotion('-', '-', makeCursor(0, lines[0].textStart), makeCursor(1, 4));
|
231
|
+
testMotion('_', ['6','_'], makeCursor(5, lines[5].textStart), makeCursor(0, 8));
|
232
|
+
testMotion('$', '$', makeCursor(0, lines[0].length - 1), makeCursor(0, 1));
|
233
|
+
testMotion('$_repeat', ['2', '$'], makeCursor(1, lines[1].length - 1),
|
234
|
+
makeCursor(0, 3));
|
235
|
+
testMotion('f', ['f', 'p'], pChars[0], makeCursor(charLine.line, 0));
|
236
|
+
testMotion('f_repeat', ['2', 'f', 'p'], pChars[2], pChars[0]);
|
237
|
+
testMotion('f_num', ['f', '2'], numChars[2], makeCursor(charLine.line, 0));
|
238
|
+
testMotion('t', ['t','p'], offsetCursor(pChars[0], 0, -1),
|
239
|
+
makeCursor(charLine.line, 0));
|
240
|
+
testMotion('t_repeat', ['2', 't', 'p'], offsetCursor(pChars[2], 0, -1),
|
241
|
+
pChars[0]);
|
242
|
+
testMotion('F', ['F', 'p'], pChars[0], pChars[1]);
|
243
|
+
testMotion('F_repeat', ['2', 'F', 'p'], pChars[0], pChars[2]);
|
244
|
+
testMotion('T', ['T', 'p'], offsetCursor(pChars[0], 0, 1), pChars[1]);
|
245
|
+
testMotion('T_repeat', ['2', 'T', 'p'], offsetCursor(pChars[0], 0, 1), pChars[2]);
|
246
|
+
testMotion('%_parens', ['%'], parens1.end, parens1.start);
|
247
|
+
testMotion('%_squares', ['%'], squares1.end, squares1.start);
|
248
|
+
testMotion('%_braces', ['%'], curlys1.end, curlys1.start);
|
249
|
+
// Make sure that moving down after going to the end of a line always leaves you
|
250
|
+
// at the end of a line, but preserves the offset in other cases
|
251
|
+
testVim('Changing lines after Eol operation', function(cm, vim, helpers) {
|
252
|
+
var startPos = { line: 0, ch: 0 };
|
253
|
+
cm.setCursor(startPos);
|
254
|
+
helpers.doKeys(['$']);
|
255
|
+
helpers.doKeys(['j']);
|
256
|
+
// After moving to Eol and then down, we should be at Eol of line 2
|
257
|
+
helpers.assertCursorAt({ line: 1, ch: lines[1].length - 1 });
|
258
|
+
helpers.doKeys(['j']);
|
259
|
+
// After moving down, we should be at Eol of line 3
|
260
|
+
helpers.assertCursorAt({ line: 2, ch: lines[2].length - 1 });
|
261
|
+
helpers.doKeys(['h']);
|
262
|
+
helpers.doKeys(['j']);
|
263
|
+
// After moving back one space and then down, since line 4 is shorter than line 2, we should
|
264
|
+
// be at Eol of line 2 - 1
|
265
|
+
helpers.assertCursorAt({ line: 3, ch: lines[3].length - 1 });
|
266
|
+
helpers.doKeys(['j']);
|
267
|
+
helpers.doKeys(['j']);
|
268
|
+
// After moving down again, since line 3 has enough characters, we should be back to the
|
269
|
+
// same place we were at on line 1
|
270
|
+
helpers.assertCursorAt({ line: 5, ch: lines[2].length - 2 });
|
271
|
+
});
|
272
|
+
//making sure gj and gk recover from clipping
|
273
|
+
testVim('gj_gk_clipping', function(cm,vim,helpers){
|
274
|
+
cm.setCursor(0, 1);
|
275
|
+
helpers.doKeys('g','j','g','j');
|
276
|
+
helpers.assertCursorAt(2, 1);
|
277
|
+
helpers.doKeys('g','k','g','k');
|
278
|
+
helpers.assertCursorAt(0, 1);
|
279
|
+
},{value: 'line 1\n\nline 2'});
|
280
|
+
//testing a mix of j/k and gj/gk
|
281
|
+
testVim('j_k_and_gj_gk', function(cm,vim,helpers){
|
282
|
+
cm.setSize(120);
|
283
|
+
cm.setCursor(0, 0);
|
284
|
+
//go to the last character on the first line
|
285
|
+
helpers.doKeys('$');
|
286
|
+
//move up/down on the column within the wrapped line
|
287
|
+
//side-effect: cursor is not locked to eol anymore
|
288
|
+
helpers.doKeys('g','k');
|
289
|
+
var cur=cm.getCursor();
|
290
|
+
eq(cur.line,0);
|
291
|
+
is((cur.ch<176),'gk didn\'t move cursor back (1)');
|
292
|
+
helpers.doKeys('g','j');
|
293
|
+
helpers.assertCursorAt(0, 176);
|
294
|
+
//should move to character 177 on line 2 (j/k preserve character index within line)
|
295
|
+
helpers.doKeys('j');
|
296
|
+
//due to different line wrapping, the cursor can be on a different screen-x now
|
297
|
+
//gj and gk preserve screen-x on movement, much like moveV
|
298
|
+
helpers.doKeys('3','g','k');
|
299
|
+
cur=cm.getCursor();
|
300
|
+
eq(cur.line,1);
|
301
|
+
is((cur.ch<176),'gk didn\'t move cursor back (2)');
|
302
|
+
helpers.doKeys('g','j','2','g','j');
|
303
|
+
//should return to the same character-index
|
304
|
+
helpers.doKeys('k');
|
305
|
+
helpers.assertCursorAt(0, 176);
|
306
|
+
},{ lineWrapping:true, value: 'This line is intentially long to test movement of gj and gk over wrapped lines. I will start on the end of this line, then make a step up and back to set the origin for j and k.\nThis line is supposed to be even longer than the previous. I will jump here and make another wiggle with gj and gk, before I jump back to the line above. Both wiggles should not change my cursor\'s target character but both j/k and gj/gk change each other\'s reference position.'});
|
307
|
+
testVim('gj_gk', function(cm, vim, helpers) {
|
308
|
+
if (phantom) return;
|
309
|
+
cm.setSize(120);
|
310
|
+
// Test top of document edge case.
|
311
|
+
cm.setCursor(0, 4);
|
312
|
+
helpers.doKeys('g', 'j');
|
313
|
+
helpers.doKeys('10', 'g', 'k');
|
314
|
+
helpers.assertCursorAt(0, 4);
|
315
|
+
|
316
|
+
// Test moving down preserves column position.
|
317
|
+
helpers.doKeys('g', 'j');
|
318
|
+
var pos1 = cm.getCursor();
|
319
|
+
var expectedPos2 = { line: 0, ch: (pos1.ch - 4) * 2 + 4};
|
320
|
+
helpers.doKeys('g', 'j');
|
321
|
+
helpers.assertCursorAt(expectedPos2);
|
322
|
+
|
323
|
+
// Move to the last character
|
324
|
+
cm.setCursor(0, 0);
|
325
|
+
// Move left to reset HSPos
|
326
|
+
helpers.doKeys('h');
|
327
|
+
// Test bottom of document edge case.
|
328
|
+
helpers.doKeys('100', 'g', 'j');
|
329
|
+
var endingPos = cm.getCursor();
|
330
|
+
is(endingPos != 0, 'gj should not be on wrapped line 0');
|
331
|
+
var topLeftCharCoords = cm.charCoords(makeCursor(0, 0));
|
332
|
+
var endingCharCoords = cm.charCoords(endingPos);
|
333
|
+
is(topLeftCharCoords.left == endingCharCoords.left, 'gj should end up on column 0');
|
334
|
+
},{ lineNumbers: false, lineWrapping:true, value: 'Thislineisintentiallylongtotestmovementofgjandgkoverwrappedlines.' });
|
335
|
+
testVim('}', function(cm, vim, helpers) {
|
336
|
+
cm.setCursor(0, 0);
|
337
|
+
helpers.doKeys('}');
|
338
|
+
helpers.assertCursorAt(1, 0);
|
339
|
+
cm.setCursor(0, 0);
|
340
|
+
helpers.doKeys('2', '}');
|
341
|
+
helpers.assertCursorAt(4, 0);
|
342
|
+
cm.setCursor(0, 0);
|
343
|
+
helpers.doKeys('6', '}');
|
344
|
+
helpers.assertCursorAt(5, 0);
|
345
|
+
}, { value: 'a\n\nb\nc\n\nd' });
|
346
|
+
testVim('{', function(cm, vim, helpers) {
|
347
|
+
cm.setCursor(5, 0);
|
348
|
+
helpers.doKeys('{');
|
349
|
+
helpers.assertCursorAt(4, 0);
|
350
|
+
cm.setCursor(5, 0);
|
351
|
+
helpers.doKeys('2', '{');
|
352
|
+
helpers.assertCursorAt(1, 0);
|
353
|
+
cm.setCursor(5, 0);
|
354
|
+
helpers.doKeys('6', '{');
|
355
|
+
helpers.assertCursorAt(0, 0);
|
356
|
+
}, { value: 'a\n\nb\nc\n\nd' });
|
357
|
+
|
358
|
+
// Operator tests
|
359
|
+
testVim('dl', function(cm, vim, helpers) {
|
360
|
+
var curStart = makeCursor(0, 0);
|
361
|
+
cm.setCursor(curStart);
|
362
|
+
helpers.doKeys('d', 'l');
|
363
|
+
eq('word1 ', cm.getValue());
|
364
|
+
var register = helpers.getRegisterController().getRegister();
|
365
|
+
eq(' ', register.text);
|
366
|
+
is(!register.linewise);
|
367
|
+
eqPos(curStart, cm.getCursor());
|
368
|
+
}, { value: ' word1 ' });
|
369
|
+
testVim('dl_eol', function(cm, vim, helpers) {
|
370
|
+
var curStart = makeCursor(0, 6);
|
371
|
+
cm.setCursor(curStart);
|
372
|
+
helpers.doKeys('d', 'l');
|
373
|
+
eq(' word1', cm.getValue());
|
374
|
+
var register = helpers.getRegisterController().getRegister();
|
375
|
+
eq(' ', register.text);
|
376
|
+
is(!register.linewise);
|
377
|
+
helpers.assertCursorAt(0, 6);
|
378
|
+
}, { value: ' word1 ' });
|
379
|
+
testVim('dl_repeat', function(cm, vim, helpers) {
|
380
|
+
var curStart = makeCursor(0, 0);
|
381
|
+
cm.setCursor(curStart);
|
382
|
+
helpers.doKeys('2', 'd', 'l');
|
383
|
+
eq('ord1 ', cm.getValue());
|
384
|
+
var register = helpers.getRegisterController().getRegister();
|
385
|
+
eq(' w', register.text);
|
386
|
+
is(!register.linewise);
|
387
|
+
eqPos(curStart, cm.getCursor());
|
388
|
+
}, { value: ' word1 ' });
|
389
|
+
testVim('dh', function(cm, vim, helpers) {
|
390
|
+
var curStart = makeCursor(0, 3);
|
391
|
+
cm.setCursor(curStart);
|
392
|
+
helpers.doKeys('d', 'h');
|
393
|
+
eq(' wrd1 ', cm.getValue());
|
394
|
+
var register = helpers.getRegisterController().getRegister();
|
395
|
+
eq('o', register.text);
|
396
|
+
is(!register.linewise);
|
397
|
+
eqPos(offsetCursor(curStart, 0 , -1), cm.getCursor());
|
398
|
+
}, { value: ' word1 ' });
|
399
|
+
testVim('dj', function(cm, vim, helpers) {
|
400
|
+
var curStart = makeCursor(0, 3);
|
401
|
+
cm.setCursor(curStart);
|
402
|
+
helpers.doKeys('d', 'j');
|
403
|
+
eq(' word3', cm.getValue());
|
404
|
+
var register = helpers.getRegisterController().getRegister();
|
405
|
+
eq(' word1\nword2\n', register.text);
|
406
|
+
is(register.linewise);
|
407
|
+
helpers.assertCursorAt(0, 1);
|
408
|
+
}, { value: ' word1\nword2\n word3' });
|
409
|
+
testVim('dj_end_of_document', function(cm, vim, helpers) {
|
410
|
+
var curStart = makeCursor(0, 3);
|
411
|
+
cm.setCursor(curStart);
|
412
|
+
helpers.doKeys('d', 'j');
|
413
|
+
eq(' word1 ', cm.getValue());
|
414
|
+
var register = helpers.getRegisterController().getRegister();
|
415
|
+
eq('', register.text);
|
416
|
+
is(!register.linewise);
|
417
|
+
helpers.assertCursorAt(0, 3);
|
418
|
+
}, { value: ' word1 ' });
|
419
|
+
testVim('dk', function(cm, vim, helpers) {
|
420
|
+
var curStart = makeCursor(1, 3);
|
421
|
+
cm.setCursor(curStart);
|
422
|
+
helpers.doKeys('d', 'k');
|
423
|
+
eq(' word3', cm.getValue());
|
424
|
+
var register = helpers.getRegisterController().getRegister();
|
425
|
+
eq(' word1\nword2\n', register.text);
|
426
|
+
is(register.linewise);
|
427
|
+
helpers.assertCursorAt(0, 1);
|
428
|
+
}, { value: ' word1\nword2\n word3' });
|
429
|
+
testVim('dk_start_of_document', function(cm, vim, helpers) {
|
430
|
+
var curStart = makeCursor(0, 3);
|
431
|
+
cm.setCursor(curStart);
|
432
|
+
helpers.doKeys('d', 'k');
|
433
|
+
eq(' word1 ', cm.getValue());
|
434
|
+
var register = helpers.getRegisterController().getRegister();
|
435
|
+
eq('', register.text);
|
436
|
+
is(!register.linewise);
|
437
|
+
helpers.assertCursorAt(0, 3);
|
438
|
+
}, { value: ' word1 ' });
|
439
|
+
testVim('dw_space', function(cm, vim, helpers) {
|
440
|
+
var curStart = makeCursor(0, 0);
|
441
|
+
cm.setCursor(curStart);
|
442
|
+
helpers.doKeys('d', 'w');
|
443
|
+
eq('word1 ', cm.getValue());
|
444
|
+
var register = helpers.getRegisterController().getRegister();
|
445
|
+
eq(' ', register.text);
|
446
|
+
is(!register.linewise);
|
447
|
+
eqPos(curStart, cm.getCursor());
|
448
|
+
}, { value: ' word1 ' });
|
449
|
+
testVim('dw_word', function(cm, vim, helpers) {
|
450
|
+
var curStart = makeCursor(0, 1);
|
451
|
+
cm.setCursor(curStart);
|
452
|
+
helpers.doKeys('d', 'w');
|
453
|
+
eq(' word2', cm.getValue());
|
454
|
+
var register = helpers.getRegisterController().getRegister();
|
455
|
+
eq('word1 ', register.text);
|
456
|
+
is(!register.linewise);
|
457
|
+
eqPos(curStart, cm.getCursor());
|
458
|
+
}, { value: ' word1 word2' });
|
459
|
+
testVim('dw_only_word', function(cm, vim, helpers) {
|
460
|
+
// Test that if there is only 1 word left, dw deletes till the end of the
|
461
|
+
// line.
|
462
|
+
var curStart = makeCursor(0, 1);
|
463
|
+
cm.setCursor(curStart);
|
464
|
+
helpers.doKeys('d', 'w');
|
465
|
+
eq(' ', cm.getValue());
|
466
|
+
var register = helpers.getRegisterController().getRegister();
|
467
|
+
eq('word1 ', register.text);
|
468
|
+
is(!register.linewise);
|
469
|
+
eqPos(curStart, cm.getCursor());
|
470
|
+
}, { value: ' word1 ' });
|
471
|
+
testVim('dw_eol', function(cm, vim, helpers) {
|
472
|
+
// Assert that dw does not delete the newline if last word to delete is at end
|
473
|
+
// of line.
|
474
|
+
var curStart = makeCursor(0, 1);
|
475
|
+
cm.setCursor(curStart);
|
476
|
+
helpers.doKeys('d', 'w');
|
477
|
+
eq(' \nword2', cm.getValue());
|
478
|
+
var register = helpers.getRegisterController().getRegister();
|
479
|
+
eq('word1', register.text);
|
480
|
+
is(!register.linewise);
|
481
|
+
eqPos(curStart, cm.getCursor());
|
482
|
+
}, { value: ' word1\nword2' });
|
483
|
+
testVim('dw_repeat', function(cm, vim, helpers) {
|
484
|
+
// Assert that dw does delete newline if it should go to the next line, and
|
485
|
+
// that repeat works properly.
|
486
|
+
var curStart = makeCursor(0, 1);
|
487
|
+
cm.setCursor(curStart);
|
488
|
+
helpers.doKeys('d', '2', 'w');
|
489
|
+
eq(' ', cm.getValue());
|
490
|
+
var register = helpers.getRegisterController().getRegister();
|
491
|
+
eq('word1\nword2', register.text);
|
492
|
+
is(!register.linewise);
|
493
|
+
eqPos(curStart, cm.getCursor());
|
494
|
+
}, { value: ' word1\nword2' });
|
495
|
+
testVim('d_inclusive', function(cm, vim, helpers) {
|
496
|
+
// Assert that when inclusive is set, the character the cursor is on gets
|
497
|
+
// deleted too.
|
498
|
+
var curStart = makeCursor(0, 1);
|
499
|
+
cm.setCursor(curStart);
|
500
|
+
helpers.doKeys('d', 'e');
|
501
|
+
eq(' ', cm.getValue());
|
502
|
+
var register = helpers.getRegisterController().getRegister();
|
503
|
+
eq('word1', register.text);
|
504
|
+
is(!register.linewise);
|
505
|
+
eqPos(curStart, cm.getCursor());
|
506
|
+
}, { value: ' word1 ' });
|
507
|
+
testVim('d_reverse', function(cm, vim, helpers) {
|
508
|
+
// Test that deleting in reverse works.
|
509
|
+
cm.setCursor(1, 0);
|
510
|
+
helpers.doKeys('d', 'b');
|
511
|
+
eq(' word2 ', cm.getValue());
|
512
|
+
var register = helpers.getRegisterController().getRegister();
|
513
|
+
eq('word1\n', register.text);
|
514
|
+
is(!register.linewise);
|
515
|
+
helpers.assertCursorAt(0, 1);
|
516
|
+
}, { value: ' word1\nword2 ' });
|
517
|
+
testVim('dd', function(cm, vim, helpers) {
|
518
|
+
cm.setCursor(0, 3);
|
519
|
+
var expectedBuffer = cm.getRange({ line: 0, ch: 0 },
|
520
|
+
{ line: 1, ch: 0 });
|
521
|
+
var expectedLineCount = cm.lineCount() - 1;
|
522
|
+
helpers.doKeys('d', 'd');
|
523
|
+
eq(expectedLineCount, cm.lineCount());
|
524
|
+
var register = helpers.getRegisterController().getRegister();
|
525
|
+
eq(expectedBuffer, register.text);
|
526
|
+
is(register.linewise);
|
527
|
+
helpers.assertCursorAt(0, lines[1].textStart);
|
528
|
+
});
|
529
|
+
testVim('dd_prefix_repeat', function(cm, vim, helpers) {
|
530
|
+
cm.setCursor(0, 3);
|
531
|
+
var expectedBuffer = cm.getRange({ line: 0, ch: 0 },
|
532
|
+
{ line: 2, ch: 0 });
|
533
|
+
var expectedLineCount = cm.lineCount() - 2;
|
534
|
+
helpers.doKeys('2', 'd', 'd');
|
535
|
+
eq(expectedLineCount, cm.lineCount());
|
536
|
+
var register = helpers.getRegisterController().getRegister();
|
537
|
+
eq(expectedBuffer, register.text);
|
538
|
+
is(register.linewise);
|
539
|
+
helpers.assertCursorAt(0, lines[2].textStart);
|
540
|
+
});
|
541
|
+
testVim('dd_motion_repeat', function(cm, vim, helpers) {
|
542
|
+
cm.setCursor(0, 3);
|
543
|
+
var expectedBuffer = cm.getRange({ line: 0, ch: 0 },
|
544
|
+
{ line: 2, ch: 0 });
|
545
|
+
var expectedLineCount = cm.lineCount() - 2;
|
546
|
+
helpers.doKeys('d', '2', 'd');
|
547
|
+
eq(expectedLineCount, cm.lineCount());
|
548
|
+
var register = helpers.getRegisterController().getRegister();
|
549
|
+
eq(expectedBuffer, register.text);
|
550
|
+
is(register.linewise);
|
551
|
+
helpers.assertCursorAt(0, lines[2].textStart);
|
552
|
+
});
|
553
|
+
testVim('dd_multiply_repeat', function(cm, vim, helpers) {
|
554
|
+
cm.setCursor(0, 3);
|
555
|
+
var expectedBuffer = cm.getRange({ line: 0, ch: 0 },
|
556
|
+
{ line: 6, ch: 0 });
|
557
|
+
var expectedLineCount = cm.lineCount() - 6;
|
558
|
+
helpers.doKeys('2', 'd', '3', 'd');
|
559
|
+
eq(expectedLineCount, cm.lineCount());
|
560
|
+
var register = helpers.getRegisterController().getRegister();
|
561
|
+
eq(expectedBuffer, register.text);
|
562
|
+
is(register.linewise);
|
563
|
+
helpers.assertCursorAt(0, lines[6].textStart);
|
564
|
+
});
|
565
|
+
// Yank commands should behave the exact same as d commands, expect that nothing
|
566
|
+
// gets deleted.
|
567
|
+
testVim('yw_repeat', function(cm, vim, helpers) {
|
568
|
+
// Assert that yw does yank newline if it should go to the next line, and
|
569
|
+
// that repeat works properly.
|
570
|
+
var curStart = makeCursor(0, 1);
|
571
|
+
cm.setCursor(curStart);
|
572
|
+
helpers.doKeys('y', '2', 'w');
|
573
|
+
eq(' word1\nword2', cm.getValue());
|
574
|
+
var register = helpers.getRegisterController().getRegister();
|
575
|
+
eq('word1\nword2', register.text);
|
576
|
+
is(!register.linewise);
|
577
|
+
eqPos(curStart, cm.getCursor());
|
578
|
+
}, { value: ' word1\nword2' });
|
579
|
+
testVim('yy_multiply_repeat', function(cm, vim, helpers) {
|
580
|
+
var curStart = makeCursor(0, 3);
|
581
|
+
cm.setCursor(curStart);
|
582
|
+
var expectedBuffer = cm.getRange({ line: 0, ch: 0 },
|
583
|
+
{ line: 6, ch: 0 });
|
584
|
+
var expectedLineCount = cm.lineCount();
|
585
|
+
helpers.doKeys('2', 'y', '3', 'y');
|
586
|
+
eq(expectedLineCount, cm.lineCount());
|
587
|
+
var register = helpers.getRegisterController().getRegister();
|
588
|
+
eq(expectedBuffer, register.text);
|
589
|
+
is(register.linewise);
|
590
|
+
eqPos(curStart, cm.getCursor());
|
591
|
+
});
|
592
|
+
// Change commands behave like d commands except that it also enters insert
|
593
|
+
// mode. In addition, when the change is linewise, an additional newline is
|
594
|
+
// inserted so that insert mode starts on that line.
|
595
|
+
testVim('cw_repeat', function(cm, vim, helpers) {
|
596
|
+
// Assert that cw does delete newline if it should go to the next line, and
|
597
|
+
// that repeat works properly.
|
598
|
+
var curStart = makeCursor(0, 1);
|
599
|
+
cm.setCursor(curStart);
|
600
|
+
helpers.doKeys('c', '2', 'w');
|
601
|
+
eq(' ', cm.getValue());
|
602
|
+
var register = helpers.getRegisterController().getRegister();
|
603
|
+
eq('word1\nword2', register.text);
|
604
|
+
is(!register.linewise);
|
605
|
+
eqPos(curStart, cm.getCursor());
|
606
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
607
|
+
}, { value: ' word1\nword2' });
|
608
|
+
testVim('cc_multiply_repeat', function(cm, vim, helpers) {
|
609
|
+
cm.setCursor(0, 3);
|
610
|
+
var expectedBuffer = cm.getRange({ line: 0, ch: 0 },
|
611
|
+
{ line: 6, ch: 0 });
|
612
|
+
var expectedLineCount = cm.lineCount() - 5;
|
613
|
+
helpers.doKeys('2', 'c', '3', 'c');
|
614
|
+
eq(expectedLineCount, cm.lineCount());
|
615
|
+
var register = helpers.getRegisterController().getRegister();
|
616
|
+
eq(expectedBuffer, register.text);
|
617
|
+
is(register.linewise);
|
618
|
+
helpers.assertCursorAt(0, lines[0].textStart);
|
619
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
620
|
+
});
|
621
|
+
// Swapcase commands edit in place and do not modify registers.
|
622
|
+
testVim('g~w_repeat', function(cm, vim, helpers) {
|
623
|
+
// Assert that dw does delete newline if it should go to the next line, and
|
624
|
+
// that repeat works properly.
|
625
|
+
var curStart = makeCursor(0, 1);
|
626
|
+
cm.setCursor(curStart);
|
627
|
+
helpers.doKeys('g', '~', '2', 'w');
|
628
|
+
eq(' WORD1\nWORD2', cm.getValue());
|
629
|
+
var register = helpers.getRegisterController().getRegister();
|
630
|
+
eq('', register.text);
|
631
|
+
is(!register.linewise);
|
632
|
+
eqPos(curStart, cm.getCursor());
|
633
|
+
}, { value: ' word1\nword2' });
|
634
|
+
testVim('g~g~', function(cm, vim, helpers) {
|
635
|
+
var curStart = makeCursor(0, 3);
|
636
|
+
cm.setCursor(curStart);
|
637
|
+
var expectedLineCount = cm.lineCount();
|
638
|
+
var expectedValue = cm.getValue().toUpperCase();
|
639
|
+
helpers.doKeys('2', 'g', '~', '3', 'g', '~');
|
640
|
+
eq(expectedValue, cm.getValue());
|
641
|
+
var register = helpers.getRegisterController().getRegister();
|
642
|
+
eq('', register.text);
|
643
|
+
is(!register.linewise);
|
644
|
+
eqPos(curStart, cm.getCursor());
|
645
|
+
}, { value: ' word1\nword2\nword3\nword4\nword5\nword6' });
|
646
|
+
testVim('>{motion}', function(cm, vim, helpers) {
|
647
|
+
cm.setCursor(1, 3);
|
648
|
+
var expectedLineCount = cm.lineCount();
|
649
|
+
var expectedValue = ' word1\n word2\nword3 ';
|
650
|
+
helpers.doKeys('>', 'k');
|
651
|
+
eq(expectedValue, cm.getValue());
|
652
|
+
var register = helpers.getRegisterController().getRegister();
|
653
|
+
eq('', register.text);
|
654
|
+
is(!register.linewise);
|
655
|
+
helpers.assertCursorAt(0, 3);
|
656
|
+
}, { value: ' word1\nword2\nword3 ', indentUnit: 2 });
|
657
|
+
testVim('>>', function(cm, vim, helpers) {
|
658
|
+
cm.setCursor(0, 3);
|
659
|
+
var expectedLineCount = cm.lineCount();
|
660
|
+
var expectedValue = ' word1\n word2\nword3 ';
|
661
|
+
helpers.doKeys('2', '>', '>');
|
662
|
+
eq(expectedValue, cm.getValue());
|
663
|
+
var register = helpers.getRegisterController().getRegister();
|
664
|
+
eq('', register.text);
|
665
|
+
is(!register.linewise);
|
666
|
+
helpers.assertCursorAt(0, 3);
|
667
|
+
}, { value: ' word1\nword2\nword3 ', indentUnit: 2 });
|
668
|
+
testVim('<{motion}', function(cm, vim, helpers) {
|
669
|
+
cm.setCursor(1, 3);
|
670
|
+
var expectedLineCount = cm.lineCount();
|
671
|
+
var expectedValue = ' word1\nword2\nword3 ';
|
672
|
+
helpers.doKeys('<', 'k');
|
673
|
+
eq(expectedValue, cm.getValue());
|
674
|
+
var register = helpers.getRegisterController().getRegister();
|
675
|
+
eq('', register.text);
|
676
|
+
is(!register.linewise);
|
677
|
+
helpers.assertCursorAt(0, 1);
|
678
|
+
}, { value: ' word1\n word2\nword3 ', indentUnit: 2 });
|
679
|
+
testVim('<<', function(cm, vim, helpers) {
|
680
|
+
cm.setCursor(0, 3);
|
681
|
+
var expectedLineCount = cm.lineCount();
|
682
|
+
var expectedValue = ' word1\nword2\nword3 ';
|
683
|
+
helpers.doKeys('2', '<', '<');
|
684
|
+
eq(expectedValue, cm.getValue());
|
685
|
+
var register = helpers.getRegisterController().getRegister();
|
686
|
+
eq('', register.text);
|
687
|
+
is(!register.linewise);
|
688
|
+
helpers.assertCursorAt(0, 1);
|
689
|
+
}, { value: ' word1\n word2\nword3 ', indentUnit: 2 });
|
690
|
+
|
691
|
+
// Operator-motion tests
|
692
|
+
testVim('D', function(cm, vim, helpers) {
|
693
|
+
var curStart = makeCursor(0, 3);
|
694
|
+
cm.setCursor(curStart);
|
695
|
+
helpers.doKeys('D');
|
696
|
+
eq(' wo\nword2\n word3', cm.getValue());
|
697
|
+
var register = helpers.getRegisterController().getRegister();
|
698
|
+
eq('rd1', register.text);
|
699
|
+
is(!register.linewise);
|
700
|
+
helpers.assertCursorAt(0, 3);
|
701
|
+
}, { value: ' word1\nword2\n word3' });
|
702
|
+
testVim('C', function(cm, vim, helpers) {
|
703
|
+
var curStart = makeCursor(0, 3);
|
704
|
+
cm.setCursor(curStart);
|
705
|
+
helpers.doKeys('C');
|
706
|
+
eq(' wo\nword2\n word3', cm.getValue());
|
707
|
+
var register = helpers.getRegisterController().getRegister();
|
708
|
+
eq('rd1', register.text);
|
709
|
+
is(!register.linewise);
|
710
|
+
helpers.assertCursorAt(0, 3);
|
711
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
712
|
+
}, { value: ' word1\nword2\n word3' });
|
713
|
+
testVim('Y', function(cm, vim, helpers) {
|
714
|
+
var curStart = makeCursor(0, 3);
|
715
|
+
cm.setCursor(curStart);
|
716
|
+
helpers.doKeys('Y');
|
717
|
+
eq(' word1\nword2\n word3', cm.getValue());
|
718
|
+
var register = helpers.getRegisterController().getRegister();
|
719
|
+
eq('rd1', register.text);
|
720
|
+
is(!register.linewise);
|
721
|
+
helpers.assertCursorAt(0, 3);
|
722
|
+
}, { value: ' word1\nword2\n word3' });
|
723
|
+
|
724
|
+
// Action tests
|
725
|
+
testVim('ctrl-a', function(cm, vim, helpers) {
|
726
|
+
cm.setCursor(0, 0);
|
727
|
+
helpers.doKeys('Ctrl-a');
|
728
|
+
eq('-9', cm.getValue());
|
729
|
+
helpers.assertCursorAt(0, 1);
|
730
|
+
helpers.doKeys('2','Ctrl-a');
|
731
|
+
eq('-7', cm.getValue());
|
732
|
+
}, {value: '-10'});
|
733
|
+
testVim('ctrl-x', function(cm, vim, helpers) {
|
734
|
+
cm.setCursor(0, 0);
|
735
|
+
helpers.doKeys('Ctrl-x');
|
736
|
+
eq('-1', cm.getValue());
|
737
|
+
helpers.assertCursorAt(0, 1);
|
738
|
+
helpers.doKeys('2','Ctrl-x');
|
739
|
+
eq('-3', cm.getValue());
|
740
|
+
}, {value: '0'});
|
741
|
+
testVim('Ctrl-x/Ctrl-a search forward', function(cm, vim, helpers) {
|
742
|
+
['Ctrl-x', 'Ctrl-a'].forEach(function(key) {
|
743
|
+
cm.setCursor(0, 0);
|
744
|
+
helpers.doKeys(key);
|
745
|
+
helpers.assertCursorAt(0, 5);
|
746
|
+
helpers.doKeys('l');
|
747
|
+
helpers.doKeys(key);
|
748
|
+
helpers.assertCursorAt(0, 10);
|
749
|
+
cm.setCursor(0, 11);
|
750
|
+
helpers.doKeys(key);
|
751
|
+
helpers.assertCursorAt(0, 11);
|
752
|
+
});
|
753
|
+
}, {value: '__jmp1 jmp2 jmp'});
|
754
|
+
testVim('a', function(cm, vim, helpers) {
|
755
|
+
cm.setCursor(0, 1);
|
756
|
+
helpers.doKeys('a');
|
757
|
+
helpers.assertCursorAt(0, 2);
|
758
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
759
|
+
});
|
760
|
+
testVim('a_eol', function(cm, vim, helpers) {
|
761
|
+
cm.setCursor(0, lines[0].length - 1);
|
762
|
+
helpers.doKeys('a');
|
763
|
+
helpers.assertCursorAt(0, lines[0].length);
|
764
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
765
|
+
});
|
766
|
+
testVim('i', function(cm, vim, helpers) {
|
767
|
+
cm.setCursor(0, 1);
|
768
|
+
helpers.doKeys('i');
|
769
|
+
helpers.assertCursorAt(0, 1);
|
770
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
771
|
+
});
|
772
|
+
testVim('A', function(cm, vim, helpers) {
|
773
|
+
cm.setCursor(0, 0);
|
774
|
+
helpers.doKeys('A');
|
775
|
+
helpers.assertCursorAt(0, lines[0].length);
|
776
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
777
|
+
});
|
778
|
+
testVim('I', function(cm, vim, helpers) {
|
779
|
+
cm.setCursor(0, 4);
|
780
|
+
helpers.doKeys('I');
|
781
|
+
helpers.assertCursorAt(0, lines[0].textStart);
|
782
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
783
|
+
});
|
784
|
+
testVim('o', function(cm, vim, helpers) {
|
785
|
+
cm.setCursor(0, 4);
|
786
|
+
helpers.doKeys('o');
|
787
|
+
eq('word1\n\nword2', cm.getValue());
|
788
|
+
helpers.assertCursorAt(1, 0);
|
789
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
790
|
+
}, { value: 'word1\nword2' });
|
791
|
+
testVim('O', function(cm, vim, helpers) {
|
792
|
+
cm.setCursor(0, 4);
|
793
|
+
helpers.doKeys('O');
|
794
|
+
eq('\nword1\nword2', cm.getValue());
|
795
|
+
helpers.assertCursorAt(0, 0);
|
796
|
+
eq('vim-insert', cm.getOption('keyMap'));
|
797
|
+
}, { value: 'word1\nword2' });
|
798
|
+
testVim('J', function(cm, vim, helpers) {
|
799
|
+
cm.setCursor(0, 4);
|
800
|
+
helpers.doKeys('J');
|
801
|
+
var expectedValue = 'word1 word2\nword3\n word4';
|
802
|
+
eq(expectedValue, cm.getValue());
|
803
|
+
helpers.assertCursorAt(0, expectedValue.indexOf('word2') - 1);
|
804
|
+
}, { value: 'word1 \n word2\nword3\n word4' });
|
805
|
+
testVim('J_repeat', function(cm, vim, helpers) {
|
806
|
+
cm.setCursor(0, 4);
|
807
|
+
helpers.doKeys('3', 'J');
|
808
|
+
var expectedValue = 'word1 word2 word3\n word4';
|
809
|
+
eq(expectedValue, cm.getValue());
|
810
|
+
helpers.assertCursorAt(0, expectedValue.indexOf('word3') - 1);
|
811
|
+
}, { value: 'word1 \n word2\nword3\n word4' });
|
812
|
+
testVim('p', function(cm, vim, helpers) {
|
813
|
+
cm.setCursor(0, 1);
|
814
|
+
helpers.getRegisterController().pushText('"', 'yank', 'abc\ndef', false);
|
815
|
+
helpers.doKeys('p');
|
816
|
+
eq('__abc\ndef_', cm.getValue());
|
817
|
+
helpers.assertCursorAt(1, 2);
|
818
|
+
}, { value: '___' });
|
819
|
+
testVim('p_register', function(cm, vim, helpers) {
|
820
|
+
cm.setCursor(0, 1);
|
821
|
+
helpers.getRegisterController().getRegister('a').set('abc\ndef', false);
|
822
|
+
helpers.doKeys('"', 'a', 'p');
|
823
|
+
eq('__abc\ndef_', cm.getValue());
|
824
|
+
helpers.assertCursorAt(1, 2);
|
825
|
+
}, { value: '___' });
|
826
|
+
testVim('p_wrong_register', function(cm, vim, helpers) {
|
827
|
+
cm.setCursor(0, 1);
|
828
|
+
helpers.getRegisterController().getRegister('a').set('abc\ndef', false);
|
829
|
+
helpers.doKeys('p');
|
830
|
+
eq('___', cm.getValue());
|
831
|
+
helpers.assertCursorAt(0, 1);
|
832
|
+
}, { value: '___' });
|
833
|
+
testVim('p_line', function(cm, vim, helpers) {
|
834
|
+
cm.setCursor(0, 1);
|
835
|
+
helpers.getRegisterController().pushText('"', 'yank', ' a\nd\n', true);
|
836
|
+
helpers.doKeys('2', 'p');
|
837
|
+
eq('___\n a\nd\n a\nd', cm.getValue());
|
838
|
+
helpers.assertCursorAt(1, 2);
|
839
|
+
}, { value: '___' });
|
840
|
+
testVim('P', function(cm, vim, helpers) {
|
841
|
+
cm.setCursor(0, 1);
|
842
|
+
helpers.getRegisterController().pushText('"', 'yank', 'abc\ndef', false);
|
843
|
+
helpers.doKeys('P');
|
844
|
+
eq('_abc\ndef__', cm.getValue());
|
845
|
+
helpers.assertCursorAt(1, 3);
|
846
|
+
}, { value: '___' });
|
847
|
+
testVim('P_line', function(cm, vim, helpers) {
|
848
|
+
cm.setCursor(0, 1);
|
849
|
+
helpers.getRegisterController().pushText('"', 'yank', ' a\nd\n', true);
|
850
|
+
helpers.doKeys('2', 'P');
|
851
|
+
eq(' a\nd\n a\nd\n___', cm.getValue());
|
852
|
+
helpers.assertCursorAt(0, 2);
|
853
|
+
}, { value: '___' });
|
854
|
+
testVim('r', function(cm, vim, helpers) {
|
855
|
+
cm.setCursor(0, 1);
|
856
|
+
helpers.doKeys('3', 'r', 'u');
|
857
|
+
eq('wuuuet\nanother', cm.getValue(),'3r failed');
|
858
|
+
helpers.assertCursorAt(0, 3);
|
859
|
+
cm.setCursor(0, 4);
|
860
|
+
helpers.doKeys('v', 'j', 'h', 'r', 'Space');
|
861
|
+
eq('wuuu \n her', cm.getValue(),'Replacing selection by space-characters failed');
|
862
|
+
}, { value: 'wordet\nanother' });
|
863
|
+
testVim('mark', function(cm, vim, helpers) {
|
864
|
+
cm.setCursor(2, 2);
|
865
|
+
helpers.doKeys('m', 't');
|
866
|
+
cm.setCursor(0, 0);
|
867
|
+
helpers.doKeys('\'', 't');
|
868
|
+
helpers.assertCursorAt(2, 2);
|
869
|
+
cm.setCursor(0, 0);
|
870
|
+
helpers.doKeys('`', 't');
|
871
|
+
helpers.assertCursorAt(2, 2);
|
872
|
+
});
|
873
|
+
testVim('jumpToMark_next', function(cm, vim, helpers) {
|
874
|
+
cm.setCursor(2, 2);
|
875
|
+
helpers.doKeys('m', 't');
|
876
|
+
cm.setCursor(0, 0);
|
877
|
+
helpers.doKeys(']', '`');
|
878
|
+
helpers.assertCursorAt(2, 2);
|
879
|
+
cm.setCursor(0, 0);
|
880
|
+
helpers.doKeys(']', '\'');
|
881
|
+
helpers.assertCursorAt(2, 0);
|
882
|
+
});
|
883
|
+
testVim('jumpToMark_next_repeat', function(cm, vim, helpers) {
|
884
|
+
cm.setCursor(2, 2);
|
885
|
+
helpers.doKeys('m', 'a');
|
886
|
+
cm.setCursor(3, 2);
|
887
|
+
helpers.doKeys('m', 'b');
|
888
|
+
cm.setCursor(4, 2);
|
889
|
+
helpers.doKeys('m', 'c');
|
890
|
+
cm.setCursor(0, 0);
|
891
|
+
helpers.doKeys('2', ']', '`');
|
892
|
+
helpers.assertCursorAt(3, 2);
|
893
|
+
cm.setCursor(0, 0);
|
894
|
+
helpers.doKeys('2', ']', '\'');
|
895
|
+
helpers.assertCursorAt(3, 1);
|
896
|
+
});
|
897
|
+
testVim('jumpToMark_next_sameline', function(cm, vim, helpers) {
|
898
|
+
cm.setCursor(2, 0);
|
899
|
+
helpers.doKeys('m', 'a');
|
900
|
+
cm.setCursor(2, 4);
|
901
|
+
helpers.doKeys('m', 'b');
|
902
|
+
cm.setCursor(2, 2);
|
903
|
+
helpers.doKeys(']', '`');
|
904
|
+
helpers.assertCursorAt(2, 4);
|
905
|
+
});
|
906
|
+
testVim('jumpToMark_next_onlyprev', function(cm, vim, helpers) {
|
907
|
+
cm.setCursor(2, 0);
|
908
|
+
helpers.doKeys('m', 'a');
|
909
|
+
cm.setCursor(4, 0);
|
910
|
+
helpers.doKeys(']', '`');
|
911
|
+
helpers.assertCursorAt(4, 0);
|
912
|
+
});
|
913
|
+
testVim('jumpToMark_next_nomark', function(cm, vim, helpers) {
|
914
|
+
cm.setCursor(2, 2);
|
915
|
+
helpers.doKeys(']', '`');
|
916
|
+
helpers.assertCursorAt(2, 2);
|
917
|
+
helpers.doKeys(']', '\'');
|
918
|
+
helpers.assertCursorAt(2, 0);
|
919
|
+
});
|
920
|
+
testVim('jumpToMark_next_linewise_over', function(cm, vim, helpers) {
|
921
|
+
cm.setCursor(2, 2);
|
922
|
+
helpers.doKeys('m', 'a');
|
923
|
+
cm.setCursor(3, 4);
|
924
|
+
helpers.doKeys('m', 'b');
|
925
|
+
cm.setCursor(2, 1);
|
926
|
+
helpers.doKeys(']', '\'');
|
927
|
+
helpers.assertCursorAt(3, 1);
|
928
|
+
});
|
929
|
+
testVim('jumpToMark_next_action', function(cm, vim, helpers) {
|
930
|
+
cm.setCursor(2, 2);
|
931
|
+
helpers.doKeys('m', 't');
|
932
|
+
cm.setCursor(0, 0);
|
933
|
+
helpers.doKeys('d', ']', '`');
|
934
|
+
helpers.assertCursorAt(0, 0);
|
935
|
+
var actual = cm.getLine(0);
|
936
|
+
var expected = 'pop pop 0 1 2 3 4';
|
937
|
+
eq(actual, expected, "Deleting while jumping to the next mark failed.");
|
938
|
+
});
|
939
|
+
testVim('jumpToMark_next_line_action', function(cm, vim, helpers) {
|
940
|
+
cm.setCursor(2, 2);
|
941
|
+
helpers.doKeys('m', 't');
|
942
|
+
cm.setCursor(0, 0);
|
943
|
+
helpers.doKeys('d', ']', '\'');
|
944
|
+
helpers.assertCursorAt(0, 1);
|
945
|
+
var actual = cm.getLine(0);
|
946
|
+
var expected = ' (a) [b] {c} '
|
947
|
+
eq(actual, expected, "Deleting while jumping to the next mark line failed.");
|
948
|
+
});
|
949
|
+
testVim('jumpToMark_prev', function(cm, vim, helpers) {
|
950
|
+
cm.setCursor(2, 2);
|
951
|
+
helpers.doKeys('m', 't');
|
952
|
+
cm.setCursor(4, 0);
|
953
|
+
helpers.doKeys('[', '`');
|
954
|
+
helpers.assertCursorAt(2, 2);
|
955
|
+
cm.setCursor(4, 0);
|
956
|
+
helpers.doKeys('[', '\'');
|
957
|
+
helpers.assertCursorAt(2, 0);
|
958
|
+
});
|
959
|
+
testVim('jumpToMark_prev_repeat', function(cm, vim, helpers) {
|
960
|
+
cm.setCursor(2, 2);
|
961
|
+
helpers.doKeys('m', 'a');
|
962
|
+
cm.setCursor(3, 2);
|
963
|
+
helpers.doKeys('m', 'b');
|
964
|
+
cm.setCursor(4, 2);
|
965
|
+
helpers.doKeys('m', 'c');
|
966
|
+
cm.setCursor(5, 0);
|
967
|
+
helpers.doKeys('2', '[', '`');
|
968
|
+
helpers.assertCursorAt(3, 2);
|
969
|
+
cm.setCursor(5, 0);
|
970
|
+
helpers.doKeys('2', '[', '\'');
|
971
|
+
helpers.assertCursorAt(3, 1);
|
972
|
+
});
|
973
|
+
testVim('jumpToMark_prev_sameline', function(cm, vim, helpers) {
|
974
|
+
cm.setCursor(2, 0);
|
975
|
+
helpers.doKeys('m', 'a');
|
976
|
+
cm.setCursor(2, 4);
|
977
|
+
helpers.doKeys('m', 'b');
|
978
|
+
cm.setCursor(2, 2);
|
979
|
+
helpers.doKeys('[', '`');
|
980
|
+
helpers.assertCursorAt(2, 0);
|
981
|
+
});
|
982
|
+
testVim('jumpToMark_prev_onlynext', function(cm, vim, helpers) {
|
983
|
+
cm.setCursor(4, 4);
|
984
|
+
helpers.doKeys('m', 'a');
|
985
|
+
cm.setCursor(2, 0);
|
986
|
+
helpers.doKeys('[', '`');
|
987
|
+
helpers.assertCursorAt(2, 0);
|
988
|
+
});
|
989
|
+
testVim('jumpToMark_prev_nomark', function(cm, vim, helpers) {
|
990
|
+
cm.setCursor(2, 2);
|
991
|
+
helpers.doKeys('[', '`');
|
992
|
+
helpers.assertCursorAt(2, 2);
|
993
|
+
helpers.doKeys('[', '\'');
|
994
|
+
helpers.assertCursorAt(2, 0);
|
995
|
+
});
|
996
|
+
testVim('jumpToMark_prev_linewise_over', function(cm, vim, helpers) {
|
997
|
+
cm.setCursor(2, 2);
|
998
|
+
helpers.doKeys('m', 'a');
|
999
|
+
cm.setCursor(3, 4);
|
1000
|
+
helpers.doKeys('m', 'b');
|
1001
|
+
cm.setCursor(3, 6);
|
1002
|
+
helpers.doKeys('[', '\'');
|
1003
|
+
helpers.assertCursorAt(2, 0);
|
1004
|
+
});
|
1005
|
+
testVim('delmark_single', function(cm, vim, helpers) {
|
1006
|
+
cm.setCursor(1, 2);
|
1007
|
+
helpers.doKeys('m', 't');
|
1008
|
+
helpers.doEx('delmarks t');
|
1009
|
+
cm.setCursor(0, 0);
|
1010
|
+
helpers.doKeys('`', 't');
|
1011
|
+
helpers.assertCursorAt(0, 0);
|
1012
|
+
});
|
1013
|
+
testVim('delmark_range', function(cm, vim, helpers) {
|
1014
|
+
cm.setCursor(1, 2);
|
1015
|
+
helpers.doKeys('m', 'a');
|
1016
|
+
cm.setCursor(2, 2);
|
1017
|
+
helpers.doKeys('m', 'b');
|
1018
|
+
cm.setCursor(3, 2);
|
1019
|
+
helpers.doKeys('m', 'c');
|
1020
|
+
cm.setCursor(4, 2);
|
1021
|
+
helpers.doKeys('m', 'd');
|
1022
|
+
cm.setCursor(5, 2);
|
1023
|
+
helpers.doKeys('m', 'e');
|
1024
|
+
helpers.doEx('delmarks b-d');
|
1025
|
+
cm.setCursor(0, 0);
|
1026
|
+
helpers.doKeys('`', 'a');
|
1027
|
+
helpers.assertCursorAt(1, 2);
|
1028
|
+
helpers.doKeys('`', 'b');
|
1029
|
+
helpers.assertCursorAt(1, 2);
|
1030
|
+
helpers.doKeys('`', 'c');
|
1031
|
+
helpers.assertCursorAt(1, 2);
|
1032
|
+
helpers.doKeys('`', 'd');
|
1033
|
+
helpers.assertCursorAt(1, 2);
|
1034
|
+
helpers.doKeys('`', 'e');
|
1035
|
+
helpers.assertCursorAt(5, 2);
|
1036
|
+
});
|
1037
|
+
testVim('delmark_multi', function(cm, vim, helpers) {
|
1038
|
+
cm.setCursor(1, 2);
|
1039
|
+
helpers.doKeys('m', 'a');
|
1040
|
+
cm.setCursor(2, 2);
|
1041
|
+
helpers.doKeys('m', 'b');
|
1042
|
+
cm.setCursor(3, 2);
|
1043
|
+
helpers.doKeys('m', 'c');
|
1044
|
+
cm.setCursor(4, 2);
|
1045
|
+
helpers.doKeys('m', 'd');
|
1046
|
+
cm.setCursor(5, 2);
|
1047
|
+
helpers.doKeys('m', 'e');
|
1048
|
+
helpers.doEx('delmarks bcd');
|
1049
|
+
cm.setCursor(0, 0);
|
1050
|
+
helpers.doKeys('`', 'a');
|
1051
|
+
helpers.assertCursorAt(1, 2);
|
1052
|
+
helpers.doKeys('`', 'b');
|
1053
|
+
helpers.assertCursorAt(1, 2);
|
1054
|
+
helpers.doKeys('`', 'c');
|
1055
|
+
helpers.assertCursorAt(1, 2);
|
1056
|
+
helpers.doKeys('`', 'd');
|
1057
|
+
helpers.assertCursorAt(1, 2);
|
1058
|
+
helpers.doKeys('`', 'e');
|
1059
|
+
helpers.assertCursorAt(5, 2);
|
1060
|
+
});
|
1061
|
+
testVim('delmark_multi_space', function(cm, vim, helpers) {
|
1062
|
+
cm.setCursor(1, 2);
|
1063
|
+
helpers.doKeys('m', 'a');
|
1064
|
+
cm.setCursor(2, 2);
|
1065
|
+
helpers.doKeys('m', 'b');
|
1066
|
+
cm.setCursor(3, 2);
|
1067
|
+
helpers.doKeys('m', 'c');
|
1068
|
+
cm.setCursor(4, 2);
|
1069
|
+
helpers.doKeys('m', 'd');
|
1070
|
+
cm.setCursor(5, 2);
|
1071
|
+
helpers.doKeys('m', 'e');
|
1072
|
+
helpers.doEx('delmarks b c d');
|
1073
|
+
cm.setCursor(0, 0);
|
1074
|
+
helpers.doKeys('`', 'a');
|
1075
|
+
helpers.assertCursorAt(1, 2);
|
1076
|
+
helpers.doKeys('`', 'b');
|
1077
|
+
helpers.assertCursorAt(1, 2);
|
1078
|
+
helpers.doKeys('`', 'c');
|
1079
|
+
helpers.assertCursorAt(1, 2);
|
1080
|
+
helpers.doKeys('`', 'd');
|
1081
|
+
helpers.assertCursorAt(1, 2);
|
1082
|
+
helpers.doKeys('`', 'e');
|
1083
|
+
helpers.assertCursorAt(5, 2);
|
1084
|
+
});
|
1085
|
+
testVim('delmark_all', function(cm, vim, helpers) {
|
1086
|
+
cm.setCursor(1, 2);
|
1087
|
+
helpers.doKeys('m', 'a');
|
1088
|
+
cm.setCursor(2, 2);
|
1089
|
+
helpers.doKeys('m', 'b');
|
1090
|
+
cm.setCursor(3, 2);
|
1091
|
+
helpers.doKeys('m', 'c');
|
1092
|
+
cm.setCursor(4, 2);
|
1093
|
+
helpers.doKeys('m', 'd');
|
1094
|
+
cm.setCursor(5, 2);
|
1095
|
+
helpers.doKeys('m', 'e');
|
1096
|
+
helpers.doEx('delmarks a b-de');
|
1097
|
+
cm.setCursor(0, 0);
|
1098
|
+
helpers.doKeys('`', 'a');
|
1099
|
+
helpers.assertCursorAt(0, 0);
|
1100
|
+
helpers.doKeys('`', 'b');
|
1101
|
+
helpers.assertCursorAt(0, 0);
|
1102
|
+
helpers.doKeys('`', 'c');
|
1103
|
+
helpers.assertCursorAt(0, 0);
|
1104
|
+
helpers.doKeys('`', 'd');
|
1105
|
+
helpers.assertCursorAt(0, 0);
|
1106
|
+
helpers.doKeys('`', 'e');
|
1107
|
+
helpers.assertCursorAt(0, 0);
|
1108
|
+
});
|
1109
|
+
testVim('visual', function(cm, vim, helpers) {
|
1110
|
+
helpers.doKeys('l', 'v', 'l', 'l');
|
1111
|
+
helpers.assertCursorAt(0, 3);
|
1112
|
+
eqPos(makeCursor(0, 1), cm.getCursor('anchor'));
|
1113
|
+
helpers.doKeys('d');
|
1114
|
+
eq('15', cm.getValue());
|
1115
|
+
}, { value: '12345' });
|
1116
|
+
testVim('visual_line', function(cm, vim, helpers) {
|
1117
|
+
helpers.doKeys('l', 'V', 'l', 'j', 'j', 'd');
|
1118
|
+
eq(' 4\n 5', cm.getValue());
|
1119
|
+
}, { value: ' 1\n 2\n 3\n 4\n 5' });
|
1120
|
+
testVim('visual_marks', function(cm, vim, helpers) {
|
1121
|
+
helpers.doKeys('l', 'v', 'l', 'l', 'v');
|
1122
|
+
// Test visual mode marks
|
1123
|
+
cm.setCursor(0, 0);
|
1124
|
+
helpers.doKeys('\'', '<');
|
1125
|
+
helpers.assertCursorAt(0, 1);
|
1126
|
+
helpers.doKeys('\'', '>');
|
1127
|
+
helpers.assertCursorAt(0, 3);
|
1128
|
+
});
|
1129
|
+
testVim('visual_join', function(cm, vim, helpers) {
|
1130
|
+
helpers.doKeys('l', 'V', 'l', 'j', 'j', 'J');
|
1131
|
+
eq(' 1 2 3\n 4\n 5', cm.getValue());
|
1132
|
+
}, { value: ' 1\n 2\n 3\n 4\n 5' });
|
1133
|
+
testVim('/ and n/N', function(cm, vim, helpers) {
|
1134
|
+
cm.openDialog = helpers.fakeOpenDialog('match');
|
1135
|
+
helpers.doKeys('/');
|
1136
|
+
helpers.assertCursorAt(0, 11);
|
1137
|
+
helpers.doKeys('n');
|
1138
|
+
helpers.assertCursorAt(1, 6);
|
1139
|
+
helpers.doKeys('N');
|
1140
|
+
helpers.assertCursorAt(0, 11);
|
1141
|
+
|
1142
|
+
cm.setCursor(0, 0);
|
1143
|
+
helpers.doKeys('2', '/');
|
1144
|
+
helpers.assertCursorAt(1, 6);
|
1145
|
+
}, { value: 'match nope match \n nope Match' });
|
1146
|
+
testVim('/_case', function(cm, vim, helpers) {
|
1147
|
+
cm.openDialog = helpers.fakeOpenDialog('Match');
|
1148
|
+
helpers.doKeys('/');
|
1149
|
+
helpers.assertCursorAt(1, 6);
|
1150
|
+
}, { value: 'match nope match \n nope Match' });
|
1151
|
+
testVim('? and n/N', function(cm, vim, helpers) {
|
1152
|
+
cm.openDialog = helpers.fakeOpenDialog('match');
|
1153
|
+
helpers.doKeys('?');
|
1154
|
+
helpers.assertCursorAt(1, 6);
|
1155
|
+
helpers.doKeys('n');
|
1156
|
+
helpers.assertCursorAt(0, 11);
|
1157
|
+
helpers.doKeys('N');
|
1158
|
+
helpers.assertCursorAt(1, 6);
|
1159
|
+
|
1160
|
+
cm.setCursor(0, 0);
|
1161
|
+
helpers.doKeys('2', '?');
|
1162
|
+
helpers.assertCursorAt(0, 11);
|
1163
|
+
}, { value: 'match nope match \n nope Match' });
|
1164
|
+
testVim('*', function(cm, vim, helpers) {
|
1165
|
+
cm.setCursor(0, 9);
|
1166
|
+
helpers.doKeys('*');
|
1167
|
+
helpers.assertCursorAt(0, 22);
|
1168
|
+
|
1169
|
+
cm.setCursor(0, 9);
|
1170
|
+
helpers.doKeys('2', '*');
|
1171
|
+
helpers.assertCursorAt(1, 8);
|
1172
|
+
}, { value: 'nomatch match nomatch match \nnomatch Match' });
|
1173
|
+
testVim('*_no_word', function(cm, vim, helpers) {
|
1174
|
+
cm.setCursor(0, 0);
|
1175
|
+
helpers.doKeys('*');
|
1176
|
+
helpers.assertCursorAt(0, 0);
|
1177
|
+
}, { value: ' \n match \n' });
|
1178
|
+
testVim('*_symbol', function(cm, vim, helpers) {
|
1179
|
+
cm.setCursor(0, 0);
|
1180
|
+
helpers.doKeys('*');
|
1181
|
+
helpers.assertCursorAt(1, 0);
|
1182
|
+
}, { value: ' /}\n/} match \n' });
|
1183
|
+
testVim('#', function(cm, vim, helpers) {
|
1184
|
+
cm.setCursor(0, 9);
|
1185
|
+
helpers.doKeys('#');
|
1186
|
+
helpers.assertCursorAt(1, 8);
|
1187
|
+
|
1188
|
+
cm.setCursor(0, 9);
|
1189
|
+
helpers.doKeys('2', '#');
|
1190
|
+
helpers.assertCursorAt(0, 22);
|
1191
|
+
}, { value: 'nomatch match nomatch match \nnomatch Match' });
|
1192
|
+
testVim('*_seek', function(cm, vim, helpers) {
|
1193
|
+
// Should skip over space and symbols.
|
1194
|
+
cm.setCursor(0, 3);
|
1195
|
+
helpers.doKeys('*');
|
1196
|
+
helpers.assertCursorAt(0, 22);
|
1197
|
+
}, { value: ' := match nomatch match \nnomatch Match' });
|
1198
|
+
testVim('#', function(cm, vim, helpers) {
|
1199
|
+
// Should skip over space and symbols.
|
1200
|
+
cm.setCursor(0, 3);
|
1201
|
+
helpers.doKeys('#');
|
1202
|
+
helpers.assertCursorAt(1, 8);
|
1203
|
+
}, { value: ' := match nomatch match \nnomatch Match' });
|
1204
|
+
testVim('.', function(cm, vim, helpers) {
|
1205
|
+
cm.setCursor(0, 0);
|
1206
|
+
helpers.doKeys('2', 'd', 'w');
|
1207
|
+
helpers.doKeys('.');
|
1208
|
+
eq('5 6', cm.getValue());
|
1209
|
+
}, { value: '1 2 3 4 5 6'});
|
1210
|
+
testVim('._repeat', function(cm, vim, helpers) {
|
1211
|
+
cm.setCursor(0, 0);
|
1212
|
+
helpers.doKeys('2', 'd', 'w');
|
1213
|
+
helpers.doKeys('3', '.');
|
1214
|
+
eq('6', cm.getValue());
|
1215
|
+
}, { value: '1 2 3 4 5 6'});
|
1216
|
+
testVim('f;', function(cm, vim, helpers) {
|
1217
|
+
cm.setCursor(0, 0);
|
1218
|
+
helpers.doKeys('f', 'x');
|
1219
|
+
helpers.doKeys(';');
|
1220
|
+
helpers.doKeys('2', ';');
|
1221
|
+
eq(9, cm.getCursor().ch);
|
1222
|
+
}, { value: '01x3xx678x'});
|
1223
|
+
testVim('F;', function(cm, vim, helpers) {
|
1224
|
+
cm.setCursor(0, 8);
|
1225
|
+
helpers.doKeys('F', 'x');
|
1226
|
+
helpers.doKeys(';');
|
1227
|
+
helpers.doKeys('2', ';');
|
1228
|
+
eq(2, cm.getCursor().ch);
|
1229
|
+
}, { value: '01x3xx6x8x'});
|
1230
|
+
testVim('t;', function(cm, vim, helpers) {
|
1231
|
+
cm.setCursor(0, 0);
|
1232
|
+
helpers.doKeys('t', 'x');
|
1233
|
+
helpers.doKeys(';');
|
1234
|
+
helpers.doKeys('2', ';');
|
1235
|
+
eq(8, cm.getCursor().ch);
|
1236
|
+
}, { value: '01x3xx678x'});
|
1237
|
+
testVim('T;', function(cm, vim, helpers) {
|
1238
|
+
cm.setCursor(0, 9);
|
1239
|
+
helpers.doKeys('T', 'x');
|
1240
|
+
helpers.doKeys(';');
|
1241
|
+
helpers.doKeys('2', ';');
|
1242
|
+
eq(2, cm.getCursor().ch);
|
1243
|
+
}, { value: '0xx3xx678x'});
|
1244
|
+
testVim('f,', function(cm, vim, helpers) {
|
1245
|
+
cm.setCursor(0, 6);
|
1246
|
+
helpers.doKeys('f', 'x');
|
1247
|
+
helpers.doKeys(',');
|
1248
|
+
helpers.doKeys('2', ',');
|
1249
|
+
eq(2, cm.getCursor().ch);
|
1250
|
+
}, { value: '01x3xx678x'});
|
1251
|
+
testVim('F,', function(cm, vim, helpers) {
|
1252
|
+
cm.setCursor(0, 3);
|
1253
|
+
helpers.doKeys('F', 'x');
|
1254
|
+
helpers.doKeys(',');
|
1255
|
+
helpers.doKeys('2', ',');
|
1256
|
+
eq(9, cm.getCursor().ch);
|
1257
|
+
}, { value: '01x3xx678x'});
|
1258
|
+
testVim('t,', function(cm, vim, helpers) {
|
1259
|
+
cm.setCursor(0, 6);
|
1260
|
+
helpers.doKeys('t', 'x');
|
1261
|
+
helpers.doKeys(',');
|
1262
|
+
helpers.doKeys('2', ',');
|
1263
|
+
eq(3, cm.getCursor().ch);
|
1264
|
+
}, { value: '01x3xx678x'});
|
1265
|
+
testVim('T,', function(cm, vim, helpers) {
|
1266
|
+
cm.setCursor(0, 4);
|
1267
|
+
helpers.doKeys('T', 'x');
|
1268
|
+
helpers.doKeys(',');
|
1269
|
+
helpers.doKeys('2', ',');
|
1270
|
+
eq(8, cm.getCursor().ch);
|
1271
|
+
}, { value: '01x3xx67xx'});
|
1272
|
+
testVim('fd,;', function(cm, vim, helpers) {
|
1273
|
+
cm.setCursor(0, 0);
|
1274
|
+
helpers.doKeys('f', '4');
|
1275
|
+
cm.setCursor(0, 0);
|
1276
|
+
helpers.doKeys('d', ';');
|
1277
|
+
eq('56789', cm.getValue());
|
1278
|
+
helpers.doKeys('u');
|
1279
|
+
cm.setCursor(0, 9);
|
1280
|
+
helpers.doKeys('d', ',');
|
1281
|
+
eq('01239', cm.getValue());
|
1282
|
+
}, { value: '0123456789'});
|
1283
|
+
testVim('Fd,;', function(cm, vim, helpers) {
|
1284
|
+
cm.setCursor(0, 9);
|
1285
|
+
helpers.doKeys('F', '4');
|
1286
|
+
cm.setCursor(0, 9);
|
1287
|
+
helpers.doKeys('d', ';');
|
1288
|
+
eq('01239', cm.getValue());
|
1289
|
+
helpers.doKeys('u');
|
1290
|
+
cm.setCursor(0, 0);
|
1291
|
+
helpers.doKeys('d', ',');
|
1292
|
+
eq('56789', cm.getValue());
|
1293
|
+
}, { value: '0123456789'});
|
1294
|
+
testVim('td,;', function(cm, vim, helpers) {
|
1295
|
+
cm.setCursor(0, 0);
|
1296
|
+
helpers.doKeys('t', '4');
|
1297
|
+
cm.setCursor(0, 0);
|
1298
|
+
helpers.doKeys('d', ';');
|
1299
|
+
eq('456789', cm.getValue());
|
1300
|
+
helpers.doKeys('u');
|
1301
|
+
cm.setCursor(0, 9);
|
1302
|
+
helpers.doKeys('d', ',');
|
1303
|
+
eq('012349', cm.getValue());
|
1304
|
+
}, { value: '0123456789'});
|
1305
|
+
testVim('Td,;', function(cm, vim, helpers) {
|
1306
|
+
cm.setCursor(0, 9);
|
1307
|
+
helpers.doKeys('T', '4');
|
1308
|
+
cm.setCursor(0, 9);
|
1309
|
+
helpers.doKeys('d', ';');
|
1310
|
+
eq('012349', cm.getValue());
|
1311
|
+
helpers.doKeys('u');
|
1312
|
+
cm.setCursor(0, 0);
|
1313
|
+
helpers.doKeys('d', ',');
|
1314
|
+
eq('456789', cm.getValue());
|
1315
|
+
}, { value: '0123456789'});
|
1316
|
+
testVim('fc,;', function(cm, vim, helpers) {
|
1317
|
+
cm.setCursor(0, 0);
|
1318
|
+
helpers.doKeys('f', '4');
|
1319
|
+
cm.setCursor(0, 0);
|
1320
|
+
helpers.doKeys('c', ';', 'Esc');
|
1321
|
+
eq('56789', cm.getValue());
|
1322
|
+
helpers.doKeys('u');
|
1323
|
+
cm.setCursor(0, 9);
|
1324
|
+
helpers.doKeys('c', ',');
|
1325
|
+
eq('01239', cm.getValue());
|
1326
|
+
}, { value: '0123456789'});
|
1327
|
+
testVim('Fc,;', function(cm, vim, helpers) {
|
1328
|
+
cm.setCursor(0, 9);
|
1329
|
+
helpers.doKeys('F', '4');
|
1330
|
+
cm.setCursor(0, 9);
|
1331
|
+
helpers.doKeys('c', ';', 'Esc');
|
1332
|
+
eq('01239', cm.getValue());
|
1333
|
+
helpers.doKeys('u');
|
1334
|
+
cm.setCursor(0, 0);
|
1335
|
+
helpers.doKeys('c', ',');
|
1336
|
+
eq('56789', cm.getValue());
|
1337
|
+
}, { value: '0123456789'});
|
1338
|
+
testVim('tc,;', function(cm, vim, helpers) {
|
1339
|
+
cm.setCursor(0, 0);
|
1340
|
+
helpers.doKeys('t', '4');
|
1341
|
+
cm.setCursor(0, 0);
|
1342
|
+
helpers.doKeys('c', ';', 'Esc');
|
1343
|
+
eq('456789', cm.getValue());
|
1344
|
+
helpers.doKeys('u');
|
1345
|
+
cm.setCursor(0, 9);
|
1346
|
+
helpers.doKeys('c', ',');
|
1347
|
+
eq('012349', cm.getValue());
|
1348
|
+
}, { value: '0123456789'});
|
1349
|
+
testVim('Tc,;', function(cm, vim, helpers) {
|
1350
|
+
cm.setCursor(0, 9);
|
1351
|
+
helpers.doKeys('T', '4');
|
1352
|
+
cm.setCursor(0, 9);
|
1353
|
+
helpers.doKeys('c', ';', 'Esc');
|
1354
|
+
eq('012349', cm.getValue());
|
1355
|
+
helpers.doKeys('u');
|
1356
|
+
cm.setCursor(0, 0);
|
1357
|
+
helpers.doKeys('c', ',');
|
1358
|
+
eq('456789', cm.getValue());
|
1359
|
+
}, { value: '0123456789'});
|
1360
|
+
testVim('fy,;', function(cm, vim, helpers) {
|
1361
|
+
cm.setCursor(0, 0);
|
1362
|
+
helpers.doKeys('f', '4');
|
1363
|
+
cm.setCursor(0, 0);
|
1364
|
+
helpers.doKeys('y', ';', 'P');
|
1365
|
+
eq('012340123456789', cm.getValue());
|
1366
|
+
helpers.doKeys('u');
|
1367
|
+
cm.setCursor(0, 9);
|
1368
|
+
helpers.doKeys('y', ',', 'P');
|
1369
|
+
eq('012345678456789', cm.getValue());
|
1370
|
+
}, { value: '0123456789'});
|
1371
|
+
testVim('Fy,;', function(cm, vim, helpers) {
|
1372
|
+
cm.setCursor(0, 9);
|
1373
|
+
helpers.doKeys('F', '4');
|
1374
|
+
cm.setCursor(0, 9);
|
1375
|
+
helpers.doKeys('y', ';', 'p');
|
1376
|
+
eq('012345678945678', cm.getValue());
|
1377
|
+
helpers.doKeys('u');
|
1378
|
+
cm.setCursor(0, 0);
|
1379
|
+
helpers.doKeys('y', ',', 'P');
|
1380
|
+
eq('012340123456789', cm.getValue());
|
1381
|
+
}, { value: '0123456789'});
|
1382
|
+
testVim('ty,;', function(cm, vim, helpers) {
|
1383
|
+
cm.setCursor(0, 0);
|
1384
|
+
helpers.doKeys('t', '4');
|
1385
|
+
cm.setCursor(0, 0);
|
1386
|
+
helpers.doKeys('y', ';', 'P');
|
1387
|
+
eq('01230123456789', cm.getValue());
|
1388
|
+
helpers.doKeys('u');
|
1389
|
+
cm.setCursor(0, 9);
|
1390
|
+
helpers.doKeys('y', ',', 'p');
|
1391
|
+
eq('01234567895678', cm.getValue());
|
1392
|
+
}, { value: '0123456789'});
|
1393
|
+
testVim('Ty,;', function(cm, vim, helpers) {
|
1394
|
+
cm.setCursor(0, 9);
|
1395
|
+
helpers.doKeys('T', '4');
|
1396
|
+
cm.setCursor(0, 9);
|
1397
|
+
helpers.doKeys('y', ';', 'p');
|
1398
|
+
eq('01234567895678', cm.getValue());
|
1399
|
+
helpers.doKeys('u');
|
1400
|
+
cm.setCursor(0, 0);
|
1401
|
+
helpers.doKeys('y', ',', 'P');
|
1402
|
+
eq('01230123456789', cm.getValue());
|
1403
|
+
}, { value: '0123456789'});
|
1404
|
+
testVim('HML', function(cm, vim, helpers) {
|
1405
|
+
cm.setSize(600, 400);
|
1406
|
+
cm.setCursor(120, 0);
|
1407
|
+
helpers.doKeys('H');
|
1408
|
+
helpers.assertCursorAt(90, 2);
|
1409
|
+
helpers.doKeys('L');
|
1410
|
+
helpers.assertCursorAt(119, 4);
|
1411
|
+
helpers.doKeys('M');
|
1412
|
+
helpers.assertCursorAt(104,4);
|
1413
|
+
}, { value: (function(){
|
1414
|
+
var upperLines = new Array(100);
|
1415
|
+
var lowerLines = new Array(100);
|
1416
|
+
var upper = ' xx\n';
|
1417
|
+
var lower = ' xx\n';
|
1418
|
+
upper = upperLines.join(upper);
|
1419
|
+
lower = upperLines.join(lower);
|
1420
|
+
return upper + lower;
|
1421
|
+
})()});
|
1422
|
+
var squareBracketMotionSandbox = ''+
|
1423
|
+
'({\n'+//0
|
1424
|
+
' ({\n'+//11
|
1425
|
+
' /*comment {\n'+//2
|
1426
|
+
' */(\n'+//3
|
1427
|
+
'#else \n'+//4
|
1428
|
+
' /* )\n'+//5
|
1429
|
+
'#if }\n'+//6
|
1430
|
+
' )}*/\n'+//7
|
1431
|
+
')}\n'+//8
|
1432
|
+
'{}\n'+//9
|
1433
|
+
'#else {{\n'+//10
|
1434
|
+
'{}\n'+//11
|
1435
|
+
'}\n'+//12
|
1436
|
+
'{\n'+//13
|
1437
|
+
'#endif\n'+//14
|
1438
|
+
'}\n'+//15
|
1439
|
+
'}\n'+//16
|
1440
|
+
'#else';//17
|
1441
|
+
testVim('[[, ]]', function(cm, vim, helpers) {
|
1442
|
+
cm.setCursor(0, 0);
|
1443
|
+
helpers.doKeys(']', ']');
|
1444
|
+
helpers.assertCursorAt(9,0);
|
1445
|
+
helpers.doKeys('2', ']', ']');
|
1446
|
+
helpers.assertCursorAt(13,0);
|
1447
|
+
helpers.doKeys(']', ']');
|
1448
|
+
helpers.assertCursorAt(17,0);
|
1449
|
+
helpers.doKeys('[', '[');
|
1450
|
+
helpers.assertCursorAt(13,0);
|
1451
|
+
helpers.doKeys('2', '[', '[');
|
1452
|
+
helpers.assertCursorAt(9,0);
|
1453
|
+
helpers.doKeys('[', '[');
|
1454
|
+
helpers.assertCursorAt(0,0);
|
1455
|
+
}, { value: squareBracketMotionSandbox});
|
1456
|
+
testVim('[], ][', function(cm, vim, helpers) {
|
1457
|
+
cm.setCursor(0, 0);
|
1458
|
+
helpers.doKeys(']', '[');
|
1459
|
+
helpers.assertCursorAt(12,0);
|
1460
|
+
helpers.doKeys('2', ']', '[');
|
1461
|
+
helpers.assertCursorAt(16,0);
|
1462
|
+
helpers.doKeys(']', '[');
|
1463
|
+
helpers.assertCursorAt(17,0);
|
1464
|
+
helpers.doKeys('[', ']');
|
1465
|
+
helpers.assertCursorAt(16,0);
|
1466
|
+
helpers.doKeys('2', '[', ']');
|
1467
|
+
helpers.assertCursorAt(12,0);
|
1468
|
+
helpers.doKeys('[', ']');
|
1469
|
+
helpers.assertCursorAt(0,0);
|
1470
|
+
}, { value: squareBracketMotionSandbox});
|
1471
|
+
testVim('[{, ]}', function(cm, vim, helpers) {
|
1472
|
+
cm.setCursor(4, 10);
|
1473
|
+
helpers.doKeys('[', '{');
|
1474
|
+
helpers.assertCursorAt(2,12);
|
1475
|
+
helpers.doKeys('2', '[', '{');
|
1476
|
+
helpers.assertCursorAt(0,1);
|
1477
|
+
cm.setCursor(4, 10);
|
1478
|
+
helpers.doKeys(']', '}');
|
1479
|
+
helpers.assertCursorAt(6,11);
|
1480
|
+
helpers.doKeys('2', ']', '}');
|
1481
|
+
helpers.assertCursorAt(8,1);
|
1482
|
+
cm.setCursor(0,1);
|
1483
|
+
helpers.doKeys(']', '}');
|
1484
|
+
helpers.assertCursorAt(8,1);
|
1485
|
+
helpers.doKeys('[', '{');
|
1486
|
+
helpers.assertCursorAt(0,1);
|
1487
|
+
}, { value: squareBracketMotionSandbox});
|
1488
|
+
testVim('[(, ])', function(cm, vim, helpers) {
|
1489
|
+
cm.setCursor(4, 10);
|
1490
|
+
helpers.doKeys('[', '(');
|
1491
|
+
helpers.assertCursorAt(3,14);
|
1492
|
+
helpers.doKeys('2', '[', '(');
|
1493
|
+
helpers.assertCursorAt(0,0);
|
1494
|
+
cm.setCursor(4, 10);
|
1495
|
+
helpers.doKeys(']', ')');
|
1496
|
+
helpers.assertCursorAt(5,11);
|
1497
|
+
helpers.doKeys('2', ']', ')');
|
1498
|
+
helpers.assertCursorAt(8,0);
|
1499
|
+
helpers.doKeys('[', '(');
|
1500
|
+
helpers.assertCursorAt(0,0);
|
1501
|
+
helpers.doKeys(']', ')');
|
1502
|
+
helpers.assertCursorAt(8,0);
|
1503
|
+
}, { value: squareBracketMotionSandbox});
|
1504
|
+
testVim('[*, ]*, [/, ]/', function(cm, vim, helpers) {
|
1505
|
+
['*', '/'].forEach(function(key){
|
1506
|
+
cm.setCursor(7, 0);
|
1507
|
+
helpers.doKeys('2', '[', key);
|
1508
|
+
helpers.assertCursorAt(2,2);
|
1509
|
+
helpers.doKeys('2', ']', key);
|
1510
|
+
helpers.assertCursorAt(7,5);
|
1511
|
+
});
|
1512
|
+
}, { value: squareBracketMotionSandbox});
|
1513
|
+
testVim('[#, ]#', function(cm, vim, helpers) {
|
1514
|
+
cm.setCursor(10, 3);
|
1515
|
+
helpers.doKeys('2', '[', '#');
|
1516
|
+
helpers.assertCursorAt(4,0);
|
1517
|
+
helpers.doKeys('5', ']', '#');
|
1518
|
+
helpers.assertCursorAt(17,0);
|
1519
|
+
cm.setCursor(10, 3);
|
1520
|
+
helpers.doKeys(']', '#');
|
1521
|
+
helpers.assertCursorAt(14,0);
|
1522
|
+
}, { value: squareBracketMotionSandbox});
|
1523
|
+
testVim('[m, ]m, [M, ]M', function(cm, vim, helpers) {
|
1524
|
+
cm.setCursor(11, 0);
|
1525
|
+
helpers.doKeys('[', 'm');
|
1526
|
+
helpers.assertCursorAt(10,7);
|
1527
|
+
helpers.doKeys('4', '[', 'm');
|
1528
|
+
helpers.assertCursorAt(1,3);
|
1529
|
+
helpers.doKeys('5', ']', 'm');
|
1530
|
+
helpers.assertCursorAt(11,0);
|
1531
|
+
helpers.doKeys('[', 'M');
|
1532
|
+
helpers.assertCursorAt(9,1);
|
1533
|
+
helpers.doKeys('3', ']', 'M');
|
1534
|
+
helpers.assertCursorAt(15,0);
|
1535
|
+
helpers.doKeys('5', '[', 'M');
|
1536
|
+
helpers.assertCursorAt(7,3);
|
1537
|
+
}, { value: squareBracketMotionSandbox});
|
1538
|
+
|
1539
|
+
// Ex mode tests
|
1540
|
+
testVim('ex_go_to_line', function(cm, vim, helpers) {
|
1541
|
+
cm.setCursor(0, 0);
|
1542
|
+
helpers.doEx('4');
|
1543
|
+
helpers.assertCursorAt(3, 0);
|
1544
|
+
}, { value: 'a\nb\nc\nd\ne\n'});
|
1545
|
+
testVim('ex_write', function(cm, vim, helpers) {
|
1546
|
+
var tmp = CodeMirror.commands.save;
|
1547
|
+
var written;
|
1548
|
+
var actualCm;
|
1549
|
+
CodeMirror.commands.save = function(cm) {
|
1550
|
+
written = true;
|
1551
|
+
actualCm = cm;
|
1552
|
+
};
|
1553
|
+
// Test that w, wr, wri ... write all trigger :write.
|
1554
|
+
var command = 'write';
|
1555
|
+
for (var i = 1; i < command.length; i++) {
|
1556
|
+
written = false;
|
1557
|
+
actualCm = null;
|
1558
|
+
helpers.doEx(command.substring(0, i));
|
1559
|
+
eq(written, true);
|
1560
|
+
eq(actualCm, cm);
|
1561
|
+
}
|
1562
|
+
CodeMirror.commands.save = tmp;
|
1563
|
+
});
|
1564
|
+
testVim('ex_substitute_same_line', function(cm, vim, helpers) {
|
1565
|
+
cm.setCursor(1, 0);
|
1566
|
+
helpers.doEx('s/one/two');
|
1567
|
+
eq('one one\n two two', cm.getValue());
|
1568
|
+
}, { value: 'one one\n one one'});
|
1569
|
+
testVim('ex_substitute_global', function(cm, vim, helpers) {
|
1570
|
+
cm.setCursor(1, 0);
|
1571
|
+
helpers.doEx('%s/one/two');
|
1572
|
+
eq('two two\n two two', cm.getValue());
|
1573
|
+
}, { value: 'one one\n one one'});
|
1574
|
+
testVim('ex_substitute_input_range', function(cm, vim, helpers) {
|
1575
|
+
cm.setCursor(1, 0);
|
1576
|
+
helpers.doEx('1,3s/\\d/0');
|
1577
|
+
eq('0\n0\n0\n4', cm.getValue());
|
1578
|
+
}, { value: '1\n2\n3\n4' });
|
1579
|
+
testVim('ex_substitute_visual_range', function(cm, vim, helpers) {
|
1580
|
+
cm.setCursor(1, 0);
|
1581
|
+
// Set last visual mode selection marks '< and '> at lines 2 and 4
|
1582
|
+
helpers.doKeys('V', '2', 'j', 'v');
|
1583
|
+
helpers.doEx('\'<,\'>s/\\d/0');
|
1584
|
+
eq('1\n0\n0\n0\n5', cm.getValue());
|
1585
|
+
}, { value: '1\n2\n3\n4\n5' });
|
1586
|
+
testVim('ex_substitute_capture', function(cm, vim, helpers) {
|
1587
|
+
cm.setCursor(1, 0);
|
1588
|
+
helpers.doEx('s/(\\d+)/$1$1/')
|
1589
|
+
eq('a1111 a1212 a1313', cm.getValue());
|
1590
|
+
}, { value: 'a11 a12 a13' });
|
1591
|
+
testVim('ex_substitute_empty_query', function(cm, vim, helpers) {
|
1592
|
+
// If the query is empty, use last query.
|
1593
|
+
cm.setCursor(1, 0);
|
1594
|
+
cm.openDialog = helpers.fakeOpenDialog('1');
|
1595
|
+
helpers.doKeys('/');
|
1596
|
+
helpers.doEx('s//b');
|
1597
|
+
eq('abb ab2 ab3', cm.getValue());
|
1598
|
+
}, { value: 'a11 a12 a13' });
|
1599
|
+
testVim('ex_substitute_count', function(cm, vim, helpers) {
|
1600
|
+
cm.setCursor(1, 0);
|
1601
|
+
helpers.doEx('s/\\d/0/i 2');
|
1602
|
+
eq('1\n0\n0\n4', cm.getValue());
|
1603
|
+
}, { value: '1\n2\n3\n4' });
|
1604
|
+
testVim('ex_substitute_count_with_range', function(cm, vim, helpers) {
|
1605
|
+
cm.setCursor(1, 0);
|
1606
|
+
helpers.doEx('1,3s/\\d/0/ 3');
|
1607
|
+
eq('1\n2\n0\n0', cm.getValue());
|
1608
|
+
}, { value: '1\n2\n3\n4' });
|
1609
|
+
//:noh should clear highlighting of search-results but allow to resume search through n
|
1610
|
+
testVim('ex_noh_clearSearchHighlight', function(cm, vim, helpers) {
|
1611
|
+
cm.openDialog = helpers.fakeOpenDialog('match');
|
1612
|
+
helpers.doKeys('?');
|
1613
|
+
helpers.doEx('noh');
|
1614
|
+
eq(vim.searchState_.getOverlay(),null,'match-highlighting wasn\'t cleared');
|
1615
|
+
helpers.doKeys('n');
|
1616
|
+
helpers.assertCursorAt(0, 11,'can\'t resume search after clearing highlighting');
|
1617
|
+
}, { value: 'match nope match \n nope Match' });
|
1618
|
+
// TODO: Reset key maps after each test.
|
1619
|
+
testVim('ex_map_key2key', function(cm, vim, helpers) {
|
1620
|
+
helpers.doEx('map a x');
|
1621
|
+
helpers.doKeys('a');
|
1622
|
+
helpers.assertCursorAt(0, 0);
|
1623
|
+
eq('bc', cm.getValue());
|
1624
|
+
}, { value: 'abc' });
|
1625
|
+
testVim('ex_map_key2key_to_colon', function(cm, vim, helpers) {
|
1626
|
+
helpers.doEx('map ; :');
|
1627
|
+
var dialogOpened = false;
|
1628
|
+
cm.openDialog = function() {
|
1629
|
+
dialogOpened = true;
|
1630
|
+
}
|
1631
|
+
helpers.doKeys(';');
|
1632
|
+
eq(dialogOpened, true);
|
1633
|
+
});
|
1634
|
+
testVim('ex_map_ex2key:', function(cm, vim, helpers) {
|
1635
|
+
helpers.doEx('map :del x');
|
1636
|
+
helpers.doEx('del');
|
1637
|
+
helpers.assertCursorAt(0, 0);
|
1638
|
+
eq('bc', cm.getValue());
|
1639
|
+
}, { value: 'abc' });
|
1640
|
+
testVim('ex_map_ex2ex', function(cm, vim, helpers) {
|
1641
|
+
helpers.doEx('map :del :w');
|
1642
|
+
var tmp = CodeMirror.commands.save;
|
1643
|
+
var written = false;
|
1644
|
+
var actualCm;
|
1645
|
+
CodeMirror.commands.save = function(cm) {
|
1646
|
+
written = true;
|
1647
|
+
actualCm = cm;
|
1648
|
+
};
|
1649
|
+
helpers.doEx('del');
|
1650
|
+
CodeMirror.commands.save = tmp;
|
1651
|
+
eq(written, true);
|
1652
|
+
eq(actualCm, cm);
|
1653
|
+
});
|
1654
|
+
testVim('ex_map_key2ex', function(cm, vim, helpers) {
|
1655
|
+
helpers.doEx('map a :w');
|
1656
|
+
var tmp = CodeMirror.commands.save;
|
1657
|
+
var written = false;
|
1658
|
+
var actualCm;
|
1659
|
+
CodeMirror.commands.save = function(cm) {
|
1660
|
+
written = true;
|
1661
|
+
actualCm = cm;
|
1662
|
+
};
|
1663
|
+
helpers.doKeys('a');
|
1664
|
+
CodeMirror.commands.save = tmp;
|
1665
|
+
eq(written, true);
|
1666
|
+
eq(actualCm, cm);
|
1667
|
+
});
|
1668
|
+
// Testing registration of functions as ex-commands and mapping to <Key>-keys
|
1669
|
+
testVim('ex_api_test', function(cm, vim, helpers) {
|
1670
|
+
var res=false;
|
1671
|
+
var val='from';
|
1672
|
+
CodeMirror.Vim.defineEx('extest','ext',function(cm,params){
|
1673
|
+
if(params.args)val=params.args[0];
|
1674
|
+
else res=true;
|
1675
|
+
});
|
1676
|
+
helpers.doEx(':ext to');
|
1677
|
+
eq(val,'to','Defining ex-command failed');
|
1678
|
+
CodeMirror.Vim.map('<C-CR><Space>',':ext');
|
1679
|
+
helpers.doKeys('Ctrl-Enter','Space');
|
1680
|
+
is(res,'Mapping to key failed');
|
1681
|
+
});
|
1682
|
+
// For now, this test needs to be last because it messes up : for future tests.
|
1683
|
+
testVim('ex_map_key2key_from_colon', function(cm, vim, helpers) {
|
1684
|
+
helpers.doEx('map : x');
|
1685
|
+
helpers.doKeys(':');
|
1686
|
+
helpers.assertCursorAt(0, 0);
|
1687
|
+
eq('bc', cm.getValue());
|
1688
|
+
}, { value: 'abc' });
|