aced_rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/aced_rails.gemspec +19 -0
- data/lib/aced_rails.rb +7 -0
- data/lib/aced_rails/engine.rb +4 -0
- data/lib/aced_rails/version.rb +3 -0
- data/vendor/assets/javascripts/ace/ace-compat-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/ace-compat-uncompressed-noconflict.js +480 -0
- data/vendor/assets/javascripts/ace/ace-compat-uncompressed.js +480 -0
- data/vendor/assets/javascripts/ace/ace-compat.js +1 -0
- data/vendor/assets/javascripts/ace/ace-noconflict.js +10 -0
- data/vendor/assets/javascripts/ace/ace-uncompressed-noconflict.js +14649 -0
- data/vendor/assets/javascripts/ace/ace-uncompressed.js +14649 -0
- data/vendor/assets/javascripts/ace/ace.js +10 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs-uncompressed-noconflict.js +405 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs-uncompressed.js +405 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +1 -0
- data/vendor/assets/javascripts/ace/keybinding-vim-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/keybinding-vim-uncompressed-noconflict.js +393 -0
- data/vendor/assets/javascripts/ace/keybinding-vim-uncompressed.js +393 -0
- data/vendor/assets/javascripts/ace/keybinding-vim.js +1 -0
- data/vendor/assets/javascripts/ace/mode-c_cpp-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-c_cpp-uncompressed-noconflict.js +918 -0
- data/vendor/assets/javascripts/ace/mode-c_cpp-uncompressed.js +918 -0
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +1 -0
- data/vendor/assets/javascripts/ace/mode-clojure-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-clojure-uncompressed-noconflict.js +422 -0
- data/vendor/assets/javascripts/ace/mode-clojure-uncompressed.js +422 -0
- data/vendor/assets/javascripts/ace/mode-clojure.js +1 -0
- data/vendor/assets/javascripts/ace/mode-coffee-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-coffee-uncompressed-noconflict.js +605 -0
- data/vendor/assets/javascripts/ace/mode-coffee-uncompressed.js +605 -0
- data/vendor/assets/javascripts/ace/mode-coffee.js +1 -0
- data/vendor/assets/javascripts/ace/mode-coldfusion-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-coldfusion-uncompressed-noconflict.js +2361 -0
- data/vendor/assets/javascripts/ace/mode-coldfusion-uncompressed.js +2361 -0
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +1 -0
- data/vendor/assets/javascripts/ace/mode-csharp-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-csharp-uncompressed-noconflict.js +768 -0
- data/vendor/assets/javascripts/ace/mode-csharp-uncompressed.js +768 -0
- data/vendor/assets/javascripts/ace/mode-csharp.js +1 -0
- data/vendor/assets/javascripts/ace/mode-css-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-css-uncompressed-noconflict.js +664 -0
- data/vendor/assets/javascripts/ace/mode-css-uncompressed.js +664 -0
- data/vendor/assets/javascripts/ace/mode-css.js +1 -0
- data/vendor/assets/javascripts/ace/mode-groovy-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-groovy-uncompressed-noconflict.js +1280 -0
- data/vendor/assets/javascripts/ace/mode-groovy-uncompressed.js +1280 -0
- data/vendor/assets/javascripts/ace/mode-groovy.js +1 -0
- data/vendor/assets/javascripts/ace/mode-haxe-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-haxe-uncompressed-noconflict.js +768 -0
- data/vendor/assets/javascripts/ace/mode-haxe-uncompressed.js +768 -0
- data/vendor/assets/javascripts/ace/mode-haxe.js +1 -0
- data/vendor/assets/javascripts/ace/mode-html-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-html-uncompressed-noconflict.js +2377 -0
- data/vendor/assets/javascripts/ace/mode-html-uncompressed.js +2377 -0
- data/vendor/assets/javascripts/ace/mode-html.js +1 -0
- data/vendor/assets/javascripts/ace/mode-java-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-java-uncompressed-noconflict.js +1282 -0
- data/vendor/assets/javascripts/ace/mode-java-uncompressed.js +1282 -0
- data/vendor/assets/javascripts/ace/mode-java.js +1 -0
- data/vendor/assets/javascripts/ace/mode-javascript-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-javascript-uncompressed-noconflict.js +1113 -0
- data/vendor/assets/javascripts/ace/mode-javascript-uncompressed.js +1113 -0
- data/vendor/assets/javascripts/ace/mode-javascript.js +1 -0
- data/vendor/assets/javascripts/ace/mode-json-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-json-uncompressed-noconflict.js +696 -0
- data/vendor/assets/javascripts/ace/mode-json-uncompressed.js +696 -0
- data/vendor/assets/javascripts/ace/mode-json.js +1 -0
- data/vendor/assets/javascripts/ace/mode-latex-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-latex-uncompressed-noconflict.js +95 -0
- data/vendor/assets/javascripts/ace/mode-latex-uncompressed.js +95 -0
- data/vendor/assets/javascripts/ace/mode-latex.js +1 -0
- data/vendor/assets/javascripts/ace/mode-lua-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-lua-uncompressed-noconflict.js +523 -0
- data/vendor/assets/javascripts/ace/mode-lua-uncompressed.js +523 -0
- data/vendor/assets/javascripts/ace/mode-lua.js +1 -0
- data/vendor/assets/javascripts/ace/mode-markdown-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-markdown-uncompressed-noconflict.js +2819 -0
- data/vendor/assets/javascripts/ace/mode-markdown-uncompressed.js +2819 -0
- data/vendor/assets/javascripts/ace/mode-markdown.js +1 -0
- data/vendor/assets/javascripts/ace/mode-ocaml-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-ocaml-uncompressed-noconflict.js +539 -0
- data/vendor/assets/javascripts/ace/mode-ocaml-uncompressed.js +539 -0
- data/vendor/assets/javascripts/ace/mode-ocaml.js +1 -0
- data/vendor/assets/javascripts/ace/mode-perl-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-perl-uncompressed-noconflict.js +573 -0
- data/vendor/assets/javascripts/ace/mode-perl-uncompressed.js +573 -0
- data/vendor/assets/javascripts/ace/mode-perl.js +1 -0
- data/vendor/assets/javascripts/ace/mode-pgsql-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-pgsql-uncompressed-noconflict.js +1107 -0
- data/vendor/assets/javascripts/ace/mode-pgsql-uncompressed.js +1107 -0
- data/vendor/assets/javascripts/ace/mode-pgsql.js +1 -0
- data/vendor/assets/javascripts/ace/mode-php-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-php-uncompressed-noconflict.js +1884 -0
- data/vendor/assets/javascripts/ace/mode-php-uncompressed.js +1884 -0
- data/vendor/assets/javascripts/ace/mode-php.js +1 -0
- data/vendor/assets/javascripts/ace/mode-powershell-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-powershell-uncompressed-noconflict.js +706 -0
- data/vendor/assets/javascripts/ace/mode-powershell-uncompressed.js +706 -0
- data/vendor/assets/javascripts/ace/mode-powershell.js +1 -0
- data/vendor/assets/javascripts/ace/mode-python-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-python-uncompressed-noconflict.js +506 -0
- data/vendor/assets/javascripts/ace/mode-python-uncompressed.js +506 -0
- data/vendor/assets/javascripts/ace/mode-python.js +1 -0
- data/vendor/assets/javascripts/ace/mode-ruby-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-ruby-uncompressed-noconflict.js +391 -0
- data/vendor/assets/javascripts/ace/mode-ruby-uncompressed.js +391 -0
- data/vendor/assets/javascripts/ace/mode-ruby.js +1 -0
- data/vendor/assets/javascripts/ace/mode-scad-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-scad-uncompressed-noconflict.js +906 -0
- data/vendor/assets/javascripts/ace/mode-scad-uncompressed.js +906 -0
- data/vendor/assets/javascripts/ace/mode-scad.js +1 -0
- data/vendor/assets/javascripts/ace/mode-scala-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-scala-uncompressed-noconflict.js +1282 -0
- data/vendor/assets/javascripts/ace/mode-scala-uncompressed.js +1282 -0
- data/vendor/assets/javascripts/ace/mode-scala.js +1 -0
- data/vendor/assets/javascripts/ace/mode-scss-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-scss-uncompressed-noconflict.js +678 -0
- data/vendor/assets/javascripts/ace/mode-scss-uncompressed.js +678 -0
- data/vendor/assets/javascripts/ace/mode-scss.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sh-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sh-uncompressed-noconflict.js +268 -0
- data/vendor/assets/javascripts/ace/mode-sh-uncompressed.js +268 -0
- data/vendor/assets/javascripts/ace/mode-sh.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sql-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sql-uncompressed-noconflict.js +159 -0
- data/vendor/assets/javascripts/ace/mode-sql-uncompressed.js +159 -0
- data/vendor/assets/javascripts/ace/mode-sql.js +1 -0
- data/vendor/assets/javascripts/ace/mode-svg-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-svg-uncompressed-noconflict.js +2016 -0
- data/vendor/assets/javascripts/ace/mode-svg-uncompressed.js +2016 -0
- data/vendor/assets/javascripts/ace/mode-svg.js +1 -0
- data/vendor/assets/javascripts/ace/mode-text-noconflict.js +0 -0
- data/vendor/assets/javascripts/ace/mode-text-uncompressed-noconflict.js +0 -0
- data/vendor/assets/javascripts/ace/mode-text-uncompressed.js +0 -0
- data/vendor/assets/javascripts/ace/mode-text.js +0 -0
- data/vendor/assets/javascripts/ace/mode-textile-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-textile-uncompressed-noconflict.js +254 -0
- data/vendor/assets/javascripts/ace/mode-textile-uncompressed.js +254 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
- data/vendor/assets/javascripts/ace/mode-xml-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/mode-xml-uncompressed-noconflict.js +1001 -0
- data/vendor/assets/javascripts/ace/mode-xml-uncompressed.js +1001 -0
- data/vendor/assets/javascripts/ace/mode-xml.js +1 -0
- data/vendor/assets/javascripts/ace/theme-chrome-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-chrome-uncompressed-noconflict.js +212 -0
- data/vendor/assets/javascripts/ace/theme-chrome-uncompressed.js +212 -0
- data/vendor/assets/javascripts/ace/theme-chrome.js +1 -0
- data/vendor/assets/javascripts/ace/theme-clouds-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-clouds-uncompressed-noconflict.js +155 -0
- data/vendor/assets/javascripts/ace/theme-clouds-uncompressed.js +155 -0
- data/vendor/assets/javascripts/ace/theme-clouds.js +1 -0
- data/vendor/assets/javascripts/ace/theme-clouds_midnight-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-clouds_midnight-uncompressed-noconflict.js +156 -0
- data/vendor/assets/javascripts/ace/theme-clouds_midnight-uncompressed.js +156 -0
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -0
- data/vendor/assets/javascripts/ace/theme-cobalt-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-cobalt-uncompressed-noconflict.js +170 -0
- data/vendor/assets/javascripts/ace/theme-cobalt-uncompressed.js +170 -0
- data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -0
- data/vendor/assets/javascripts/ace/theme-crimson_editor-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-crimson_editor-uncompressed-noconflict.js +198 -0
- data/vendor/assets/javascripts/ace/theme-crimson_editor-uncompressed.js +198 -0
- data/vendor/assets/javascripts/ace/theme-crimson_editor.js +1 -0
- data/vendor/assets/javascripts/ace/theme-dawn-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-dawn-uncompressed-noconflict.js +174 -0
- data/vendor/assets/javascripts/ace/theme-dawn-uncompressed.js +174 -0
- data/vendor/assets/javascripts/ace/theme-dawn.js +1 -0
- data/vendor/assets/javascripts/ace/theme-dreamweaver-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-dreamweaver-uncompressed-noconflict.js +227 -0
- data/vendor/assets/javascripts/ace/theme-dreamweaver-uncompressed.js +227 -0
- data/vendor/assets/javascripts/ace/theme-dreamweaver.js +1 -0
- data/vendor/assets/javascripts/ace/theme-eclipse-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-eclipse-uncompressed-noconflict.js +147 -0
- data/vendor/assets/javascripts/ace/theme-eclipse-uncompressed.js +147 -0
- data/vendor/assets/javascripts/ace/theme-eclipse.js +1 -0
- data/vendor/assets/javascripts/ace/theme-idle_fingers-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-idle_fingers-uncompressed-noconflict.js +162 -0
- data/vendor/assets/javascripts/ace/theme-idle_fingers-uncompressed.js +162 -0
- data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -0
- data/vendor/assets/javascripts/ace/theme-kr_theme-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-kr_theme-uncompressed-noconflict.js +165 -0
- data/vendor/assets/javascripts/ace/theme-kr_theme-uncompressed.js +165 -0
- data/vendor/assets/javascripts/ace/theme-kr_theme.js +1 -0
- data/vendor/assets/javascripts/ace/theme-merbivore-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-merbivore-uncompressed-noconflict.js +165 -0
- data/vendor/assets/javascripts/ace/theme-merbivore-uncompressed.js +165 -0
- data/vendor/assets/javascripts/ace/theme-merbivore.js +1 -0
- data/vendor/assets/javascripts/ace/theme-merbivore_soft-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-merbivore_soft-uncompressed-noconflict.js +171 -0
- data/vendor/assets/javascripts/ace/theme-merbivore_soft-uncompressed.js +171 -0
- data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +1 -0
- data/vendor/assets/javascripts/ace/theme-mono_industrial-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-mono_industrial-uncompressed-noconflict.js +169 -0
- data/vendor/assets/javascripts/ace/theme-mono_industrial-uncompressed.js +169 -0
- data/vendor/assets/javascripts/ace/theme-mono_industrial.js +1 -0
- data/vendor/assets/javascripts/ace/theme-monokai-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-monokai-uncompressed-noconflict.js +171 -0
- data/vendor/assets/javascripts/ace/theme-monokai-uncompressed.js +171 -0
- data/vendor/assets/javascripts/ace/theme-monokai.js +1 -0
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark-uncompressed-noconflict.js +179 -0
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark-uncompressed.js +179 -0
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +1 -0
- data/vendor/assets/javascripts/ace/theme-solarized_dark-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-solarized_dark-uncompressed-noconflict.js +160 -0
- data/vendor/assets/javascripts/ace/theme-solarized_dark-uncompressed.js +160 -0
- data/vendor/assets/javascripts/ace/theme-solarized_dark.js +1 -0
- data/vendor/assets/javascripts/ace/theme-solarized_light-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-solarized_light-uncompressed-noconflict.js +159 -0
- data/vendor/assets/javascripts/ace/theme-solarized_light-uncompressed.js +159 -0
- data/vendor/assets/javascripts/ace/theme-solarized_light.js +1 -0
- data/vendor/assets/javascripts/ace/theme-textmate-noconflict.js +0 -0
- data/vendor/assets/javascripts/ace/theme-textmate-uncompressed-noconflict.js +0 -0
- data/vendor/assets/javascripts/ace/theme-textmate-uncompressed.js +0 -0
- data/vendor/assets/javascripts/ace/theme-textmate.js +0 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow-uncompressed-noconflict.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow-uncompressed.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night-uncompressed-noconflict.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night-uncompressed.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue-uncompressed-noconflict.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue-uncompressed.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright-uncompressed-noconflict.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright-uncompressed.js +189 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties-uncompressed-noconflict.js +185 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties-uncompressed.js +185 -0
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +1 -0
- data/vendor/assets/javascripts/ace/theme-twilight-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-twilight-uncompressed-noconflict.js +183 -0
- data/vendor/assets/javascripts/ace/theme-twilight-uncompressed.js +183 -0
- data/vendor/assets/javascripts/ace/theme-twilight.js +1 -0
- data/vendor/assets/javascripts/ace/theme-vibrant_ink-noconflict.js +1 -0
- data/vendor/assets/javascripts/ace/theme-vibrant_ink-uncompressed-noconflict.js +166 -0
- data/vendor/assets/javascripts/ace/theme-vibrant_ink-uncompressed.js +166 -0
- data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +1 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +7456 -0
- data/vendor/assets/javascripts/ace/worker-css.js +11693 -0
- data/vendor/assets/javascripts/ace/worker-javascript.js +10305 -0
- data/vendor/assets/javascripts/ace/worker-json.js +3062 -0
- metadata +310 -0
@@ -0,0 +1 @@
|
|
1
|
+
define("ace/keyboard/keybinding/emacs",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}"use strict";var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
@@ -0,0 +1 @@
|
|
1
|
+
ace.define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){"use strict";var d=a("../state_handler").StateHandler,e=a("../state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","gotoright"),f("(h|left)","gotoleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(g)}),ace.define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}"use strict";var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(var b in a)this.$buildBindingsRegex(a[b]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?("key"in a||(a.key=new RegExp("^"+a.regex[1]+"$")),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c,d){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var e=[];b&1&&e.push("ctrl"),b&8&&e.push("command"),b&2&&e.push("option"),b&4&&e.push("shift"),c&&e.push(c);var f=e.join("-"),g=a.buffer+f;b!=2&&(a.buffer=g);var h={bufferToUse:g,symbolicName:f};return d&&(h.keyIdentifier=d.keyIdentifier),h},$find:function(a,b,c,e,f,g){var h={};return this.keymapping[a.state].some(function(i){var j;if(i.key&&!i.key.test(c))return!1;if(i.regex&&!(j=i.regex.exec(b)))return!1;if(i.match&&!i.match(b,e,f,c,g))return!1;if(i.disallowMatches)for(var k=0;k<i.disallowMatches.length;k++)if(!!j[i.disallowMatches[k]])return!1;if(i.exec){h.command=i.exec;if(i.params){var l;h.args={},i.params.forEach(function(a){a.match!=null&&j!=null?l=j[a.match]||a.defaultValue:l=a.defaultValue,a.type==="number"&&(l=parseInt(l)),h.args[a.name]=l})}a.buffer=""}return i.then&&(a.state=i.then,a.buffer=""),h.command==null&&(h.command="null"),d&&console.log("KeyboardStateMapper#find",i),!0}),h.command?h:(a.buffer="",!1)},handleKeyboard:function(a,b,c,e,f){if(b==0||c!=""&&c!=String.fromCharCode(0)){var g=this.$composeBuffer(a,b,c,f),h=g.bufferToUse,i=g.symbolicName,j=g.keyIdentifier;return g=this.$find(a,h,i,b,c,j),d&&console.log("KeyboardStateMapper#match",h,i,g),g}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
@@ -0,0 +1,393 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Mozilla Skywriter.
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Mozilla.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2009
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Julian Viereck (julian.viereck@gmail.com)
|
23
|
+
*
|
24
|
+
* Alternatively, the contents of this file may be used under the terms of
|
25
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
26
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
27
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
28
|
+
* of those above. If you wish to allow use of your version of this file only
|
29
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
30
|
+
* use your version of this file under the terms of the MPL, indicate your
|
31
|
+
* decision by deleting the provisions above and replace them with the notice
|
32
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
33
|
+
* the provisions above, a recipient may use your version of this file under
|
34
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
35
|
+
*
|
36
|
+
* ***** END LICENSE BLOCK ***** */
|
37
|
+
|
38
|
+
ace.define('ace/keyboard/keybinding/vim', ['require', 'exports', 'module' , 'ace/keyboard/state_handler'], function(require, exports, module) {
|
39
|
+
"use strict";
|
40
|
+
|
41
|
+
var StateHandler = require("../state_handler").StateHandler;
|
42
|
+
var matchCharacterOnly = require("../state_handler").matchCharacterOnly;
|
43
|
+
|
44
|
+
var vimcommand = function(key, exec, then) {
|
45
|
+
return {
|
46
|
+
regex: [ "([0-9]*)", key ],
|
47
|
+
exec: exec,
|
48
|
+
params: [
|
49
|
+
{
|
50
|
+
name: "times",
|
51
|
+
match: 1,
|
52
|
+
type: "number",
|
53
|
+
defaultValue: 1
|
54
|
+
}
|
55
|
+
],
|
56
|
+
then: then
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
var vimStates = {
|
61
|
+
start: [
|
62
|
+
{
|
63
|
+
key: "i",
|
64
|
+
then: "insertMode"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
key: "d",
|
68
|
+
then: "deleteMode"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
key: "a",
|
72
|
+
exec: "gotoright",
|
73
|
+
then: "insertMode"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
key: "shift-i",
|
77
|
+
exec: "gotolinestart",
|
78
|
+
then: "insertMode"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
key: "shift-a",
|
82
|
+
exec: "gotolineend",
|
83
|
+
then: "insertMode"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
key: "shift-c",
|
87
|
+
exec: "removetolineend",
|
88
|
+
then: "insertMode"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
key: "shift-r",
|
92
|
+
exec: "overwrite",
|
93
|
+
then: "replaceMode"
|
94
|
+
},
|
95
|
+
vimcommand("(k|up)", "golineup"),
|
96
|
+
vimcommand("(j|down)", "golinedown"),
|
97
|
+
vimcommand("(l|right)", "gotoright"),
|
98
|
+
vimcommand("(h|left)", "gotoleft"),
|
99
|
+
{
|
100
|
+
key: "shift-g",
|
101
|
+
exec: "gotoend"
|
102
|
+
},
|
103
|
+
vimcommand("b", "gotowordleft"),
|
104
|
+
vimcommand("e", "gotowordright"),
|
105
|
+
vimcommand("x", "del"),
|
106
|
+
vimcommand("shift-x", "backspace"),
|
107
|
+
vimcommand("shift-d", "removetolineend"),
|
108
|
+
vimcommand("u", "undo"), // [count] on this may/may not work, depending on browser implementation...
|
109
|
+
{
|
110
|
+
comment: "Catch some keyboard input to stop it here",
|
111
|
+
match: matchCharacterOnly
|
112
|
+
}
|
113
|
+
],
|
114
|
+
insertMode: [
|
115
|
+
{
|
116
|
+
key: "esc",
|
117
|
+
then: "start"
|
118
|
+
}
|
119
|
+
],
|
120
|
+
replaceMode: [
|
121
|
+
{
|
122
|
+
key: "esc",
|
123
|
+
exec: "overwrite",
|
124
|
+
then: "start"
|
125
|
+
}
|
126
|
+
],
|
127
|
+
deleteMode: [
|
128
|
+
{
|
129
|
+
key: "d",
|
130
|
+
exec: "removeline",
|
131
|
+
then: "start"
|
132
|
+
}
|
133
|
+
]
|
134
|
+
};
|
135
|
+
|
136
|
+
exports.Vim = new StateHandler(vimStates);
|
137
|
+
|
138
|
+
});
|
139
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
140
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
141
|
+
*
|
142
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
143
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
144
|
+
* the License. You may obtain a copy of the License at
|
145
|
+
* http://www.mozilla.org/MPL/
|
146
|
+
*
|
147
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
148
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
149
|
+
* for the specific language governing rights and limitations under the
|
150
|
+
* License.
|
151
|
+
*
|
152
|
+
* The Original Code is Mozilla Skywriter.
|
153
|
+
*
|
154
|
+
* The Initial Developer of the Original Code is
|
155
|
+
* Mozilla.
|
156
|
+
* Portions created by the Initial Developer are Copyright (C) 2009
|
157
|
+
* the Initial Developer. All Rights Reserved.
|
158
|
+
*
|
159
|
+
* Contributor(s):
|
160
|
+
* Julian Viereck (julian.viereck@gmail.com)
|
161
|
+
*
|
162
|
+
* Alternatively, the contents of this file may be used under the terms of
|
163
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
164
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
165
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
166
|
+
* of those above. If you wish to allow use of your version of this file only
|
167
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
168
|
+
* use your version of this file under the terms of the MPL, indicate your
|
169
|
+
* decision by deleting the provisions above and replace them with the notice
|
170
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
171
|
+
* the provisions above, a recipient may use your version of this file under
|
172
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
173
|
+
*
|
174
|
+
* ***** END LICENSE BLOCK ***** */
|
175
|
+
|
176
|
+
ace.define('ace/keyboard/state_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
|
177
|
+
"use strict";
|
178
|
+
|
179
|
+
// If you're developing a new keymapping and want to get an idea what's going
|
180
|
+
// on, then enable debugging.
|
181
|
+
var DEBUG = false;
|
182
|
+
|
183
|
+
function StateHandler(keymapping) {
|
184
|
+
this.keymapping = this.$buildKeymappingRegex(keymapping);
|
185
|
+
}
|
186
|
+
|
187
|
+
StateHandler.prototype = {
|
188
|
+
/**
|
189
|
+
* Build the RegExp from the keymapping as RegExp can't stored directly
|
190
|
+
* in the metadata JSON and as the RegExp used to match the keys/buffer
|
191
|
+
* need to be adapted.
|
192
|
+
*/
|
193
|
+
$buildKeymappingRegex: function(keymapping) {
|
194
|
+
for (var state in keymapping) {
|
195
|
+
this.$buildBindingsRegex(keymapping[state]);
|
196
|
+
}
|
197
|
+
return keymapping;
|
198
|
+
},
|
199
|
+
|
200
|
+
$buildBindingsRegex: function(bindings) {
|
201
|
+
// Escape a given Regex string.
|
202
|
+
bindings.forEach(function(binding) {
|
203
|
+
if (binding.key) {
|
204
|
+
binding.key = new RegExp('^' + binding.key + '$');
|
205
|
+
} else if (Array.isArray(binding.regex)) {
|
206
|
+
if (!('key' in binding))
|
207
|
+
binding.key = new RegExp('^' + binding.regex[1] + '$');
|
208
|
+
binding.regex = new RegExp(binding.regex.join('') + '$');
|
209
|
+
} else if (binding.regex) {
|
210
|
+
binding.regex = new RegExp(binding.regex + '$');
|
211
|
+
}
|
212
|
+
});
|
213
|
+
},
|
214
|
+
|
215
|
+
$composeBuffer: function(data, hashId, key, e) {
|
216
|
+
// Initialize the data object.
|
217
|
+
if (data.state == null || data.buffer == null) {
|
218
|
+
data.state = "start";
|
219
|
+
data.buffer = "";
|
220
|
+
}
|
221
|
+
|
222
|
+
var keyArray = [];
|
223
|
+
if (hashId & 1) keyArray.push("ctrl");
|
224
|
+
if (hashId & 8) keyArray.push("command");
|
225
|
+
if (hashId & 2) keyArray.push("option");
|
226
|
+
if (hashId & 4) keyArray.push("shift");
|
227
|
+
if (key) keyArray.push(key);
|
228
|
+
|
229
|
+
var symbolicName = keyArray.join("-");
|
230
|
+
var bufferToUse = data.buffer + symbolicName;
|
231
|
+
|
232
|
+
// Don't add the symbolic name to the key buffer if the alt_ key is
|
233
|
+
// part of the symbolic name. If it starts with alt_, this means
|
234
|
+
// that the user hit an alt keycombo and there will be a single,
|
235
|
+
// new character detected after this event, which then will be
|
236
|
+
// added to the buffer (e.g. alt_j will result in ∆).
|
237
|
+
//
|
238
|
+
// We test for 2 and not for & 2 as we only want to exclude the case where
|
239
|
+
// the option key is pressed alone.
|
240
|
+
if (hashId != 2) {
|
241
|
+
data.buffer = bufferToUse;
|
242
|
+
}
|
243
|
+
|
244
|
+
var bufferObj = {
|
245
|
+
bufferToUse: bufferToUse,
|
246
|
+
symbolicName: symbolicName,
|
247
|
+
};
|
248
|
+
|
249
|
+
if (e) {
|
250
|
+
bufferObj.keyIdentifier = e.keyIdentifier
|
251
|
+
}
|
252
|
+
|
253
|
+
return bufferObj;
|
254
|
+
},
|
255
|
+
|
256
|
+
$find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
|
257
|
+
// Holds the command to execute and the args if a command matched.
|
258
|
+
var result = {};
|
259
|
+
|
260
|
+
// Loop over all the bindings of the keymap until a match is found.
|
261
|
+
this.keymapping[data.state].some(function(binding) {
|
262
|
+
var match;
|
263
|
+
|
264
|
+
// Check if the key matches.
|
265
|
+
if (binding.key && !binding.key.test(symbolicName)) {
|
266
|
+
return false;
|
267
|
+
}
|
268
|
+
|
269
|
+
// Check if the regex matches.
|
270
|
+
if (binding.regex && !(match = binding.regex.exec(buffer))) {
|
271
|
+
return false;
|
272
|
+
}
|
273
|
+
|
274
|
+
// Check if the match function matches.
|
275
|
+
if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
|
276
|
+
return false;
|
277
|
+
}
|
278
|
+
|
279
|
+
// Check for disallowed matches.
|
280
|
+
if (binding.disallowMatches) {
|
281
|
+
for (var i = 0; i < binding.disallowMatches.length; i++) {
|
282
|
+
if (!!match[binding.disallowMatches[i]]) {
|
283
|
+
return false;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
// If there is a command to execute, then figure out the
|
289
|
+
// command and the arguments.
|
290
|
+
if (binding.exec) {
|
291
|
+
result.command = binding.exec;
|
292
|
+
|
293
|
+
// Build the arguments.
|
294
|
+
if (binding.params) {
|
295
|
+
var value;
|
296
|
+
result.args = {};
|
297
|
+
binding.params.forEach(function(param) {
|
298
|
+
if (param.match != null && match != null) {
|
299
|
+
value = match[param.match] || param.defaultValue;
|
300
|
+
} else {
|
301
|
+
value = param.defaultValue;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (param.type === 'number') {
|
305
|
+
value = parseInt(value);
|
306
|
+
}
|
307
|
+
|
308
|
+
result.args[param.name] = value;
|
309
|
+
});
|
310
|
+
}
|
311
|
+
data.buffer = "";
|
312
|
+
}
|
313
|
+
|
314
|
+
// Handle the 'then' property.
|
315
|
+
if (binding.then) {
|
316
|
+
data.state = binding.then;
|
317
|
+
data.buffer = "";
|
318
|
+
}
|
319
|
+
|
320
|
+
// If no command is set, then execute the "null" fake command.
|
321
|
+
if (result.command == null) {
|
322
|
+
result.command = "null";
|
323
|
+
}
|
324
|
+
|
325
|
+
if (DEBUG) {
|
326
|
+
console.log("KeyboardStateMapper#find", binding);
|
327
|
+
}
|
328
|
+
return true;
|
329
|
+
});
|
330
|
+
|
331
|
+
if (result.command) {
|
332
|
+
return result;
|
333
|
+
} else {
|
334
|
+
data.buffer = "";
|
335
|
+
return false;
|
336
|
+
}
|
337
|
+
},
|
338
|
+
|
339
|
+
/**
|
340
|
+
* This function is called by keyBinding.
|
341
|
+
*/
|
342
|
+
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
343
|
+
// If we pressed any command key but no other key, then ignore the input.
|
344
|
+
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
|
345
|
+
// which results in "shift-shift-g" which doesn't make sense.
|
346
|
+
if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
|
347
|
+
return null;
|
348
|
+
}
|
349
|
+
|
350
|
+
// Compute the current value of the keyboard input buffer.
|
351
|
+
var r = this.$composeBuffer(data, hashId, key, e);
|
352
|
+
var buffer = r.bufferToUse;
|
353
|
+
var symbolicName = r.symbolicName;
|
354
|
+
var keyId = r.keyIdentifier;
|
355
|
+
|
356
|
+
r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
|
357
|
+
if (DEBUG) {
|
358
|
+
console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
|
359
|
+
}
|
360
|
+
|
361
|
+
return r;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
|
365
|
+
/**
|
366
|
+
* This is a useful matching function and therefore is defined here so that
|
367
|
+
* users of KeyboardStateMapper can use it.
|
368
|
+
*
|
369
|
+
* @return boolean
|
370
|
+
* If no command key (Command|Option|Shift|Ctrl) is pressed, it
|
371
|
+
* returns true. If the only the Shift key is pressed + a character
|
372
|
+
* true is returned as well. Otherwise, false is returned.
|
373
|
+
* Summing up, the function returns true whenever the user typed
|
374
|
+
* a normal character on the keyboard and no shortcut.
|
375
|
+
*/
|
376
|
+
exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
|
377
|
+
// If no command keys are pressed, then catch the input.
|
378
|
+
if (hashId == 0) {
|
379
|
+
return true;
|
380
|
+
}
|
381
|
+
// If only the shift key is pressed and a character key, then
|
382
|
+
// catch that input as well.
|
383
|
+
else if ((hashId == 4) && key.length == 1) {
|
384
|
+
return true;
|
385
|
+
}
|
386
|
+
// Otherwise, we let the input got through.
|
387
|
+
else {
|
388
|
+
return false;
|
389
|
+
}
|
390
|
+
};
|
391
|
+
|
392
|
+
exports.StateHandler = StateHandler;
|
393
|
+
});
|
@@ -0,0 +1,393 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Mozilla Skywriter.
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Mozilla.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2009
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Julian Viereck (julian.viereck@gmail.com)
|
23
|
+
*
|
24
|
+
* Alternatively, the contents of this file may be used under the terms of
|
25
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
26
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
27
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
28
|
+
* of those above. If you wish to allow use of your version of this file only
|
29
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
30
|
+
* use your version of this file under the terms of the MPL, indicate your
|
31
|
+
* decision by deleting the provisions above and replace them with the notice
|
32
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
33
|
+
* the provisions above, a recipient may use your version of this file under
|
34
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
35
|
+
*
|
36
|
+
* ***** END LICENSE BLOCK ***** */
|
37
|
+
|
38
|
+
define('ace/keyboard/keybinding/vim', ['require', 'exports', 'module' , 'ace/keyboard/state_handler'], function(require, exports, module) {
|
39
|
+
"use strict";
|
40
|
+
|
41
|
+
var StateHandler = require("../state_handler").StateHandler;
|
42
|
+
var matchCharacterOnly = require("../state_handler").matchCharacterOnly;
|
43
|
+
|
44
|
+
var vimcommand = function(key, exec, then) {
|
45
|
+
return {
|
46
|
+
regex: [ "([0-9]*)", key ],
|
47
|
+
exec: exec,
|
48
|
+
params: [
|
49
|
+
{
|
50
|
+
name: "times",
|
51
|
+
match: 1,
|
52
|
+
type: "number",
|
53
|
+
defaultValue: 1
|
54
|
+
}
|
55
|
+
],
|
56
|
+
then: then
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
var vimStates = {
|
61
|
+
start: [
|
62
|
+
{
|
63
|
+
key: "i",
|
64
|
+
then: "insertMode"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
key: "d",
|
68
|
+
then: "deleteMode"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
key: "a",
|
72
|
+
exec: "gotoright",
|
73
|
+
then: "insertMode"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
key: "shift-i",
|
77
|
+
exec: "gotolinestart",
|
78
|
+
then: "insertMode"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
key: "shift-a",
|
82
|
+
exec: "gotolineend",
|
83
|
+
then: "insertMode"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
key: "shift-c",
|
87
|
+
exec: "removetolineend",
|
88
|
+
then: "insertMode"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
key: "shift-r",
|
92
|
+
exec: "overwrite",
|
93
|
+
then: "replaceMode"
|
94
|
+
},
|
95
|
+
vimcommand("(k|up)", "golineup"),
|
96
|
+
vimcommand("(j|down)", "golinedown"),
|
97
|
+
vimcommand("(l|right)", "gotoright"),
|
98
|
+
vimcommand("(h|left)", "gotoleft"),
|
99
|
+
{
|
100
|
+
key: "shift-g",
|
101
|
+
exec: "gotoend"
|
102
|
+
},
|
103
|
+
vimcommand("b", "gotowordleft"),
|
104
|
+
vimcommand("e", "gotowordright"),
|
105
|
+
vimcommand("x", "del"),
|
106
|
+
vimcommand("shift-x", "backspace"),
|
107
|
+
vimcommand("shift-d", "removetolineend"),
|
108
|
+
vimcommand("u", "undo"), // [count] on this may/may not work, depending on browser implementation...
|
109
|
+
{
|
110
|
+
comment: "Catch some keyboard input to stop it here",
|
111
|
+
match: matchCharacterOnly
|
112
|
+
}
|
113
|
+
],
|
114
|
+
insertMode: [
|
115
|
+
{
|
116
|
+
key: "esc",
|
117
|
+
then: "start"
|
118
|
+
}
|
119
|
+
],
|
120
|
+
replaceMode: [
|
121
|
+
{
|
122
|
+
key: "esc",
|
123
|
+
exec: "overwrite",
|
124
|
+
then: "start"
|
125
|
+
}
|
126
|
+
],
|
127
|
+
deleteMode: [
|
128
|
+
{
|
129
|
+
key: "d",
|
130
|
+
exec: "removeline",
|
131
|
+
then: "start"
|
132
|
+
}
|
133
|
+
]
|
134
|
+
};
|
135
|
+
|
136
|
+
exports.Vim = new StateHandler(vimStates);
|
137
|
+
|
138
|
+
});
|
139
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
140
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
141
|
+
*
|
142
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
143
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
144
|
+
* the License. You may obtain a copy of the License at
|
145
|
+
* http://www.mozilla.org/MPL/
|
146
|
+
*
|
147
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
148
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
149
|
+
* for the specific language governing rights and limitations under the
|
150
|
+
* License.
|
151
|
+
*
|
152
|
+
* The Original Code is Mozilla Skywriter.
|
153
|
+
*
|
154
|
+
* The Initial Developer of the Original Code is
|
155
|
+
* Mozilla.
|
156
|
+
* Portions created by the Initial Developer are Copyright (C) 2009
|
157
|
+
* the Initial Developer. All Rights Reserved.
|
158
|
+
*
|
159
|
+
* Contributor(s):
|
160
|
+
* Julian Viereck (julian.viereck@gmail.com)
|
161
|
+
*
|
162
|
+
* Alternatively, the contents of this file may be used under the terms of
|
163
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
164
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
165
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
166
|
+
* of those above. If you wish to allow use of your version of this file only
|
167
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
168
|
+
* use your version of this file under the terms of the MPL, indicate your
|
169
|
+
* decision by deleting the provisions above and replace them with the notice
|
170
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
171
|
+
* the provisions above, a recipient may use your version of this file under
|
172
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
173
|
+
*
|
174
|
+
* ***** END LICENSE BLOCK ***** */
|
175
|
+
|
176
|
+
define('ace/keyboard/state_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
|
177
|
+
"use strict";
|
178
|
+
|
179
|
+
// If you're developing a new keymapping and want to get an idea what's going
|
180
|
+
// on, then enable debugging.
|
181
|
+
var DEBUG = false;
|
182
|
+
|
183
|
+
function StateHandler(keymapping) {
|
184
|
+
this.keymapping = this.$buildKeymappingRegex(keymapping);
|
185
|
+
}
|
186
|
+
|
187
|
+
StateHandler.prototype = {
|
188
|
+
/**
|
189
|
+
* Build the RegExp from the keymapping as RegExp can't stored directly
|
190
|
+
* in the metadata JSON and as the RegExp used to match the keys/buffer
|
191
|
+
* need to be adapted.
|
192
|
+
*/
|
193
|
+
$buildKeymappingRegex: function(keymapping) {
|
194
|
+
for (var state in keymapping) {
|
195
|
+
this.$buildBindingsRegex(keymapping[state]);
|
196
|
+
}
|
197
|
+
return keymapping;
|
198
|
+
},
|
199
|
+
|
200
|
+
$buildBindingsRegex: function(bindings) {
|
201
|
+
// Escape a given Regex string.
|
202
|
+
bindings.forEach(function(binding) {
|
203
|
+
if (binding.key) {
|
204
|
+
binding.key = new RegExp('^' + binding.key + '$');
|
205
|
+
} else if (Array.isArray(binding.regex)) {
|
206
|
+
if (!('key' in binding))
|
207
|
+
binding.key = new RegExp('^' + binding.regex[1] + '$');
|
208
|
+
binding.regex = new RegExp(binding.regex.join('') + '$');
|
209
|
+
} else if (binding.regex) {
|
210
|
+
binding.regex = new RegExp(binding.regex + '$');
|
211
|
+
}
|
212
|
+
});
|
213
|
+
},
|
214
|
+
|
215
|
+
$composeBuffer: function(data, hashId, key, e) {
|
216
|
+
// Initialize the data object.
|
217
|
+
if (data.state == null || data.buffer == null) {
|
218
|
+
data.state = "start";
|
219
|
+
data.buffer = "";
|
220
|
+
}
|
221
|
+
|
222
|
+
var keyArray = [];
|
223
|
+
if (hashId & 1) keyArray.push("ctrl");
|
224
|
+
if (hashId & 8) keyArray.push("command");
|
225
|
+
if (hashId & 2) keyArray.push("option");
|
226
|
+
if (hashId & 4) keyArray.push("shift");
|
227
|
+
if (key) keyArray.push(key);
|
228
|
+
|
229
|
+
var symbolicName = keyArray.join("-");
|
230
|
+
var bufferToUse = data.buffer + symbolicName;
|
231
|
+
|
232
|
+
// Don't add the symbolic name to the key buffer if the alt_ key is
|
233
|
+
// part of the symbolic name. If it starts with alt_, this means
|
234
|
+
// that the user hit an alt keycombo and there will be a single,
|
235
|
+
// new character detected after this event, which then will be
|
236
|
+
// added to the buffer (e.g. alt_j will result in ∆).
|
237
|
+
//
|
238
|
+
// We test for 2 and not for & 2 as we only want to exclude the case where
|
239
|
+
// the option key is pressed alone.
|
240
|
+
if (hashId != 2) {
|
241
|
+
data.buffer = bufferToUse;
|
242
|
+
}
|
243
|
+
|
244
|
+
var bufferObj = {
|
245
|
+
bufferToUse: bufferToUse,
|
246
|
+
symbolicName: symbolicName,
|
247
|
+
};
|
248
|
+
|
249
|
+
if (e) {
|
250
|
+
bufferObj.keyIdentifier = e.keyIdentifier
|
251
|
+
}
|
252
|
+
|
253
|
+
return bufferObj;
|
254
|
+
},
|
255
|
+
|
256
|
+
$find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
|
257
|
+
// Holds the command to execute and the args if a command matched.
|
258
|
+
var result = {};
|
259
|
+
|
260
|
+
// Loop over all the bindings of the keymap until a match is found.
|
261
|
+
this.keymapping[data.state].some(function(binding) {
|
262
|
+
var match;
|
263
|
+
|
264
|
+
// Check if the key matches.
|
265
|
+
if (binding.key && !binding.key.test(symbolicName)) {
|
266
|
+
return false;
|
267
|
+
}
|
268
|
+
|
269
|
+
// Check if the regex matches.
|
270
|
+
if (binding.regex && !(match = binding.regex.exec(buffer))) {
|
271
|
+
return false;
|
272
|
+
}
|
273
|
+
|
274
|
+
// Check if the match function matches.
|
275
|
+
if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
|
276
|
+
return false;
|
277
|
+
}
|
278
|
+
|
279
|
+
// Check for disallowed matches.
|
280
|
+
if (binding.disallowMatches) {
|
281
|
+
for (var i = 0; i < binding.disallowMatches.length; i++) {
|
282
|
+
if (!!match[binding.disallowMatches[i]]) {
|
283
|
+
return false;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
// If there is a command to execute, then figure out the
|
289
|
+
// command and the arguments.
|
290
|
+
if (binding.exec) {
|
291
|
+
result.command = binding.exec;
|
292
|
+
|
293
|
+
// Build the arguments.
|
294
|
+
if (binding.params) {
|
295
|
+
var value;
|
296
|
+
result.args = {};
|
297
|
+
binding.params.forEach(function(param) {
|
298
|
+
if (param.match != null && match != null) {
|
299
|
+
value = match[param.match] || param.defaultValue;
|
300
|
+
} else {
|
301
|
+
value = param.defaultValue;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (param.type === 'number') {
|
305
|
+
value = parseInt(value);
|
306
|
+
}
|
307
|
+
|
308
|
+
result.args[param.name] = value;
|
309
|
+
});
|
310
|
+
}
|
311
|
+
data.buffer = "";
|
312
|
+
}
|
313
|
+
|
314
|
+
// Handle the 'then' property.
|
315
|
+
if (binding.then) {
|
316
|
+
data.state = binding.then;
|
317
|
+
data.buffer = "";
|
318
|
+
}
|
319
|
+
|
320
|
+
// If no command is set, then execute the "null" fake command.
|
321
|
+
if (result.command == null) {
|
322
|
+
result.command = "null";
|
323
|
+
}
|
324
|
+
|
325
|
+
if (DEBUG) {
|
326
|
+
console.log("KeyboardStateMapper#find", binding);
|
327
|
+
}
|
328
|
+
return true;
|
329
|
+
});
|
330
|
+
|
331
|
+
if (result.command) {
|
332
|
+
return result;
|
333
|
+
} else {
|
334
|
+
data.buffer = "";
|
335
|
+
return false;
|
336
|
+
}
|
337
|
+
},
|
338
|
+
|
339
|
+
/**
|
340
|
+
* This function is called by keyBinding.
|
341
|
+
*/
|
342
|
+
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
343
|
+
// If we pressed any command key but no other key, then ignore the input.
|
344
|
+
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
|
345
|
+
// which results in "shift-shift-g" which doesn't make sense.
|
346
|
+
if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
|
347
|
+
return null;
|
348
|
+
}
|
349
|
+
|
350
|
+
// Compute the current value of the keyboard input buffer.
|
351
|
+
var r = this.$composeBuffer(data, hashId, key, e);
|
352
|
+
var buffer = r.bufferToUse;
|
353
|
+
var symbolicName = r.symbolicName;
|
354
|
+
var keyId = r.keyIdentifier;
|
355
|
+
|
356
|
+
r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
|
357
|
+
if (DEBUG) {
|
358
|
+
console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
|
359
|
+
}
|
360
|
+
|
361
|
+
return r;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
|
365
|
+
/**
|
366
|
+
* This is a useful matching function and therefore is defined here so that
|
367
|
+
* users of KeyboardStateMapper can use it.
|
368
|
+
*
|
369
|
+
* @return boolean
|
370
|
+
* If no command key (Command|Option|Shift|Ctrl) is pressed, it
|
371
|
+
* returns true. If the only the Shift key is pressed + a character
|
372
|
+
* true is returned as well. Otherwise, false is returned.
|
373
|
+
* Summing up, the function returns true whenever the user typed
|
374
|
+
* a normal character on the keyboard and no shortcut.
|
375
|
+
*/
|
376
|
+
exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
|
377
|
+
// If no command keys are pressed, then catch the input.
|
378
|
+
if (hashId == 0) {
|
379
|
+
return true;
|
380
|
+
}
|
381
|
+
// If only the shift key is pressed and a character key, then
|
382
|
+
// catch that input as well.
|
383
|
+
else if ((hashId == 4) && key.length == 1) {
|
384
|
+
return true;
|
385
|
+
}
|
386
|
+
// Otherwise, we let the input got through.
|
387
|
+
else {
|
388
|
+
return false;
|
389
|
+
}
|
390
|
+
};
|
391
|
+
|
392
|
+
exports.StateHandler = StateHandler;
|
393
|
+
});
|