ace-rails-ap 2.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace/ace.js +14194 -13349
- data/vendor/assets/javascripts/ace/ext-beautify.js +335 -0
- data/vendor/assets/javascripts/ace/ext-chromevox.js +6 -1
- data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +8 -33
- data/vendor/assets/javascripts/ace/ext-emmet.js +487 -424
- data/vendor/assets/javascripts/ace/ext-error_marker.js +6 -0
- data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +45 -72
- data/vendor/assets/javascripts/ace/ext-language_tools.js +734 -578
- data/vendor/assets/javascripts/ace/ext-linking.js +53 -0
- data/vendor/assets/javascripts/ace/ext-modelist.js +25 -10
- data/vendor/assets/javascripts/ace/ext-old_ie.js +93 -120
- data/vendor/assets/javascripts/ace/ext-searchbox.js +8 -41
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +229 -234
- data/vendor/assets/javascripts/ace/ext-spellcheck.js +7 -3
- data/vendor/assets/javascripts/ace/ext-split.js +13 -37
- data/vendor/assets/javascripts/ace/ext-static_highlight.js +16 -39
- data/vendor/assets/javascripts/ace/ext-statusbar.js +8 -2
- data/vendor/assets/javascripts/ace/ext-textarea.js +254 -99
- data/vendor/assets/javascripts/ace/ext-themelist.js +13 -40
- data/vendor/assets/javascripts/ace/ext-whitespace.js +17 -41
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +803 -788
- data/vendor/assets/javascripts/ace/keybinding-vim.js +1559 -1560
- data/vendor/assets/javascripts/ace/mode-abap.js +52 -83
- data/vendor/assets/javascripts/ace/mode-actionscript.js +27 -63
- data/vendor/assets/javascripts/ace/mode-ada.js +27 -58
- data/vendor/assets/javascripts/ace/mode-apache_conf.js +310 -0
- data/vendor/assets/javascripts/ace/mode-applescript.js +226 -0
- data/vendor/assets/javascripts/ace/mode-asciidoc.js +39 -70
- data/vendor/assets/javascripts/ace/mode-assembly_x86.js +26 -58
- data/vendor/assets/javascripts/ace/mode-autohotkey.js +27 -63
- data/vendor/assets/javascripts/ace/mode-batchfile.js +27 -63
- data/vendor/assets/javascripts/ace/mode-c9search.js +92 -112
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +224 -223
- data/vendor/assets/javascripts/ace/mode-cirru.js +202 -0
- data/vendor/assets/javascripts/ace/mode-clojure.js +98 -92
- data/vendor/assets/javascripts/ace/mode-cobol.js +27 -58
- data/vendor/assets/javascripts/ace/mode-coffee.js +90 -122
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +1908 -1464
- data/vendor/assets/javascripts/ace/mode-csharp.js +291 -264
- data/vendor/assets/javascripts/ace/mode-css.js +266 -267
- data/vendor/assets/javascripts/ace/mode-curly.js +796 -815
- data/vendor/assets/javascripts/ace/mode-d.js +64 -95
- data/vendor/assets/javascripts/ace/mode-dart.js +254 -256
- data/vendor/assets/javascripts/ace/mode-diff.js +27 -58
- data/vendor/assets/javascripts/ace/mode-django.js +856 -866
- data/vendor/assets/javascripts/ace/mode-dockerfile.js +759 -0
- data/vendor/assets/javascripts/ace/mode-dot.js +106 -106
- data/vendor/assets/javascripts/ace/mode-eiffel.js +135 -0
- data/vendor/assets/javascripts/ace/mode-ejs.js +931 -938
- data/vendor/assets/javascripts/ace/mode-erlang.js +27 -58
- data/vendor/assets/javascripts/ace/mode-forth.js +27 -63
- data/vendor/assets/javascripts/ace/mode-ftl.js +457 -508
- data/vendor/assets/javascripts/ace/mode-gcode.js +85 -0
- data/vendor/assets/javascripts/ace/mode-gherkin.js +129 -0
- data/vendor/assets/javascripts/ace/mode-gitignore.js +50 -0
- data/vendor/assets/javascripts/ace/mode-glsl.js +252 -248
- data/vendor/assets/javascripts/ace/mode-golang.js +206 -179
- data/vendor/assets/javascripts/ace/mode-groovy.js +310 -242
- data/vendor/assets/javascripts/ace/mode-haml.js +156 -190
- data/vendor/assets/javascripts/ace/mode-handlebars.js +815 -784
- data/vendor/assets/javascripts/ace/mode-haskell.js +27 -63
- data/vendor/assets/javascripts/ace/mode-haxe.js +206 -176
- data/vendor/assets/javascripts/ace/mode-html.js +779 -792
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +916 -923
- data/vendor/assets/javascripts/ace/mode-ini.js +27 -58
- data/vendor/assets/javascripts/ace/mode-io.js +201 -0
- data/vendor/assets/javascripts/ace/mode-jack.js +169 -170
- data/vendor/assets/javascripts/ace/mode-jade.js +722 -774
- data/vendor/assets/javascripts/ace/mode-java.js +310 -245
- data/vendor/assets/javascripts/ace/mode-javascript.js +285 -247
- data/vendor/assets/javascripts/ace/mode-json.js +183 -184
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +3211 -1274
- data/vendor/assets/javascripts/ace/mode-jsp.js +481 -504
- data/vendor/assets/javascripts/ace/mode-jsx.js +206 -176
- data/vendor/assets/javascripts/ace/mode-julia.js +33 -69
- data/vendor/assets/javascripts/ace/mode-latex.js +74 -41
- data/vendor/assets/javascripts/ace/mode-less.js +250 -251
- data/vendor/assets/javascripts/ace/mode-liquid.js +424 -475
- data/vendor/assets/javascripts/ace/mode-lisp.js +24 -57
- data/vendor/assets/javascripts/ace/mode-livescript.js +42 -41
- data/vendor/assets/javascripts/ace/mode-logiql.js +229 -230
- data/vendor/assets/javascripts/ace/mode-lsl.js +200 -441
- data/vendor/assets/javascripts/ace/mode-lua.js +136 -167
- data/vendor/assets/javascripts/ace/mode-luapage.js +904 -884
- data/vendor/assets/javascripts/ace/mode-lucene.js +22 -17
- data/vendor/assets/javascripts/ace/mode-makefile.js +162 -137
- data/vendor/assets/javascripts/ace/mode-markdown.js +846 -854
- data/vendor/assets/javascripts/ace/mode-matlab.js +98 -72
- data/vendor/assets/javascripts/ace/mode-mel.js +569 -0
- data/vendor/assets/javascripts/ace/mode-mushcode.js +84 -115
- data/vendor/assets/javascripts/ace/mode-mysql.js +49 -80
- data/vendor/assets/javascripts/ace/mode-nix.js +252 -256
- data/vendor/assets/javascripts/ace/mode-objectivec.js +242 -274
- data/vendor/assets/javascripts/ace/mode-ocaml.js +71 -102
- data/vendor/assets/javascripts/ace/mode-pascal.js +32 -68
- data/vendor/assets/javascripts/ace/mode-perl.js +67 -98
- data/vendor/assets/javascripts/ace/mode-pgsql.js +990 -982
- data/vendor/assets/javascripts/ace/mode-php.js +1878 -1900
- data/vendor/assets/javascripts/ace/mode-plain_text.js +3 -34
- data/vendor/assets/javascripts/ace/mode-powershell.js +181 -151
- data/vendor/assets/javascripts/ace/mode-praat.js +418 -0
- data/vendor/assets/javascripts/ace/mode-prolog.js +27 -63
- data/vendor/assets/javascripts/ace/mode-properties.js +20 -48
- data/vendor/assets/javascripts/ace/mode-protobuf.js +252 -259
- data/vendor/assets/javascripts/ace/mode-python.js +84 -115
- data/vendor/assets/javascripts/ace/mode-r.js +105 -140
- data/vendor/assets/javascripts/ace/mode-rdoc.js +84 -89
- data/vendor/assets/javascripts/ace/mode-rhtml.js +892 -908
- data/vendor/assets/javascripts/ace/mode-ruby.js +434 -98
- data/vendor/assets/javascripts/ace/mode-rust.js +27 -63
- data/vendor/assets/javascripts/ace/mode-sass.js +75 -106
- data/vendor/assets/javascripts/ace/mode-scad.js +219 -220
- data/vendor/assets/javascripts/ace/mode-scala.js +311 -243
- data/vendor/assets/javascripts/ace/mode-scheme.js +24 -60
- data/vendor/assets/javascripts/ace/mode-scss.js +250 -251
- data/vendor/assets/javascripts/ace/mode-sh.js +506 -118
- data/vendor/assets/javascripts/ace/mode-sjs.js +314 -280
- data/vendor/assets/javascripts/ace/mode-smarty.js +2474 -0
- data/vendor/assets/javascripts/ace/mode-snippets.js +89 -89
- data/vendor/assets/javascripts/ace/mode-soy_template.js +792 -811
- data/vendor/assets/javascripts/ace/mode-space.js +22 -23
- data/vendor/assets/javascripts/ace/mode-sql.js +31 -58
- data/vendor/assets/javascripts/ace/mode-stylus.js +161 -197
- data/vendor/assets/javascripts/ace/mode-svg.js +906 -836
- data/vendor/assets/javascripts/ace/mode-tcl.js +61 -92
- data/vendor/assets/javascripts/ace/mode-tex.js +36 -73
- data/vendor/assets/javascripts/ace/mode-text.js +1 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +41 -72
- data/vendor/assets/javascripts/ace/mode-toml.js +26 -62
- data/vendor/assets/javascripts/ace/mode-twig.js +1196 -892
- data/vendor/assets/javascripts/ace/mode-typescript.js +313 -277
- data/vendor/assets/javascripts/ace/mode-vala.js +982 -0
- data/vendor/assets/javascripts/ace/mode-vbscript.js +25 -62
- data/vendor/assets/javascripts/ace/mode-velocity.js +2251 -1242
- data/vendor/assets/javascripts/ace/mode-verilog.js +27 -59
- data/vendor/assets/javascripts/ace/mode-vhdl.js +26 -55
- data/vendor/assets/javascripts/ace/mode-xml.js +319 -644
- data/vendor/assets/javascripts/ace/mode-xquery.js +2503 -588
- data/vendor/assets/javascripts/ace/mode-yaml.js +56 -90
- data/vendor/assets/javascripts/ace/snippets/abap.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/actionscript.js +159 -0
- data/vendor/assets/javascripts/ace/snippets/ada.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/apache_conf.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/applescript.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/asciidoc.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/autohotkey.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/batchfile.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/c9search.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/c_cpp.js +138 -0
- data/vendor/assets/javascripts/ace/snippets/cirru.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/clojure.js +97 -0
- data/vendor/assets/javascripts/ace/snippets/cobol.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/coffee.js +102 -0
- data/vendor/assets/javascripts/ace/snippets/coldfusion.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/csharp.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/css.js +974 -0
- data/vendor/assets/javascripts/ace/snippets/curly.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/d.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/dart.js +90 -0
- data/vendor/assets/javascripts/ace/snippets/diff.js +18 -0
- data/vendor/assets/javascripts/ace/snippets/django.js +115 -0
- data/vendor/assets/javascripts/ace/snippets/dockerfile.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/dot.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/eiffel.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/ejs.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/erlang.js +167 -0
- data/vendor/assets/javascripts/ace/snippets/forth.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/ftl.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/gcode.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/gherkin.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/gitignore.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/glsl.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/golang.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/groovy.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/haml.js +27 -0
- data/vendor/assets/javascripts/ace/snippets/handlebars.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/haskell.js +89 -0
- data/vendor/assets/javascripts/ace/snippets/haxe.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/html.js +835 -0
- data/vendor/assets/javascripts/ace/snippets/html_ruby.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/ini.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/io.js +69 -0
- data/vendor/assets/javascripts/ace/snippets/jack.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/jade.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/java.js +241 -0
- data/vendor/assets/javascripts/ace/snippets/javascript.js +189 -0
- data/vendor/assets/javascripts/ace/snippets/json.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/jsoniq.js +68 -0
- data/vendor/assets/javascripts/ace/snippets/jsp.js +106 -0
- data/vendor/assets/javascripts/ace/snippets/jsx.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/julia.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/latex.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/less.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/liquid.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/lisp.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/livescript.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/logiql.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/lsl.js +1073 -0
- data/vendor/assets/javascripts/ace/snippets/lua.js +28 -0
- data/vendor/assets/javascripts/ace/snippets/luapage.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/lucene.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/makefile.js +11 -0
- data/vendor/assets/javascripts/ace/snippets/markdown.js +95 -0
- data/vendor/assets/javascripts/ace/snippets/matlab.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/mel.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/mushcode.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/mysql.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/nix.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/objectivec.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/ocaml.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/pascal.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/perl.js +354 -0
- data/vendor/assets/javascripts/ace/snippets/pgsql.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/php.js +283 -0
- data/vendor/assets/javascripts/ace/snippets/plain_text.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/powershell.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/praat.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/prolog.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/properties.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/protobuf.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/python.js +165 -0
- data/vendor/assets/javascripts/ace/snippets/r.js +128 -0
- data/vendor/assets/javascripts/ace/snippets/rdoc.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/rhtml.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/ruby.js +935 -0
- data/vendor/assets/javascripts/ace/snippets/rust.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/sass.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/scad.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/scala.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/scheme.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/scss.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/sh.js +90 -0
- data/vendor/assets/javascripts/ace/snippets/sjs.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/smarty.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/snippets.js +16 -0
- data/vendor/assets/javascripts/ace/snippets/soy_template.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/space.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/sql.js +33 -0
- data/vendor/assets/javascripts/ace/snippets/stylus.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/svg.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/tcl.js +99 -0
- data/vendor/assets/javascripts/ace/snippets/tex.js +197 -0
- data/vendor/assets/javascripts/ace/snippets/text.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/textile.js +37 -0
- data/vendor/assets/javascripts/ace/snippets/toml.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/twig.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/typescript.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/vala.js +193 -0
- data/vendor/assets/javascripts/ace/snippets/vbscript.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/velocity.js +36 -0
- data/vendor/assets/javascripts/ace/snippets/verilog.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/vhdl.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/xml.js +7 -0
- data/vendor/assets/javascripts/ace/snippets/xquery.js +68 -0
- data/vendor/assets/javascripts/ace/snippets/yaml.js +7 -0
- data/vendor/assets/javascripts/ace/theme-ambiance.js +4 -24
- data/vendor/assets/javascripts/ace/theme-chaos.js +2 -25
- data/vendor/assets/javascripts/ace/theme-chrome.js +2 -31
- data/vendor/assets/javascripts/ace/theme-clouds.js +1 -31
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -31
- data/vendor/assets/javascripts/ace/theme-cobalt.js +1 -31
- data/vendor/assets/javascripts/ace/theme-crimson_editor.js +1 -31
- data/vendor/assets/javascripts/ace/theme-dawn.js +1 -31
- data/vendor/assets/javascripts/ace/theme-dreamweaver.js +5 -31
- data/vendor/assets/javascripts/ace/theme-eclipse.js +7 -33
- data/vendor/assets/javascripts/ace/theme-github.js +2 -35
- data/vendor/assets/javascripts/ace/theme-idle_fingers.js +1 -31
- data/vendor/assets/javascripts/ace/theme-katzenmilch.js +119 -0
- data/vendor/assets/javascripts/ace/theme-kr.js +1 -31
- data/vendor/assets/javascripts/ace/theme-kr_theme.js +57 -141
- data/vendor/assets/javascripts/ace/theme-kuroir.js +59 -0
- data/vendor/assets/javascripts/ace/theme-merbivore.js +1 -31
- data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +1 -31
- data/vendor/assets/javascripts/ace/theme-mono_industrial.js +1 -31
- data/vendor/assets/javascripts/ace/theme-monokai.js +1 -31
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +1 -31
- data/vendor/assets/javascripts/ace/theme-solarized_dark.js +1 -31
- data/vendor/assets/javascripts/ace/theme-solarized_light.js +1 -31
- data/vendor/assets/javascripts/ace/theme-terminal.js +1 -31
- data/vendor/assets/javascripts/ace/theme-textmate.js +3 -32
- data/vendor/assets/javascripts/ace/theme-tomorrow.js +1 -31
- data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +1 -31
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +1 -31
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +1 -31
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +1 -31
- data/vendor/assets/javascripts/ace/theme-twilight.js +1 -31
- data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +1 -31
- data/vendor/assets/javascripts/ace/theme-xcode.js +2 -33
- data/vendor/assets/javascripts/ace/worker-coffee.js +5026 -5008
- data/vendor/assets/javascripts/ace/worker-css.js +5489 -5134
- data/vendor/assets/javascripts/ace/worker-html.js +11517 -0
- data/vendor/assets/javascripts/ace/worker-javascript.js +9810 -9501
- data/vendor/assets/javascripts/ace/worker-json.js +1583 -1564
- data/vendor/assets/javascripts/ace/worker-lua.js +2631 -2612
- data/vendor/assets/javascripts/ace/worker-php.js +2385 -2341
- data/vendor/assets/javascripts/ace/worker-xquery.js +31643 -3993
- metadata +147 -11
@@ -1,37 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
* Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
|
5
|
-
* All rights reserved.
|
6
|
-
*
|
7
|
-
* Contributed to Ajax.org under the BSD license.
|
8
|
-
*
|
9
|
-
* Redistribution and use in source and binary forms, with or without
|
10
|
-
* modification, are permitted provided that the following conditions are met:
|
11
|
-
* * Redistributions of source code must retain the above copyright
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
13
|
-
* * Redistributions in binary form must reproduce the above copyright
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
16
|
-
* * Neither the name of Ajax.org B.V. nor the
|
17
|
-
* names of its contributors may be used to endorse or promote products
|
18
|
-
* derived from this software without specific prior written permission.
|
19
|
-
*
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
21
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
-
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
24
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
26
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
27
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
*
|
31
|
-
* ***** END LICENSE BLOCK ***** */
|
32
|
-
|
33
|
-
define('ace/ext/themelist', ['require', 'exports', 'module' ], function(require, exports, module) {
|
34
|
-
|
1
|
+
define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
|
2
|
+
"use strict";
|
3
|
+
require("ace/lib/fixoldbrowsers");
|
35
4
|
|
36
5
|
var themeData = [
|
37
6
|
["Chrome" ],
|
@@ -66,21 +35,25 @@ var themeData = [
|
|
66
35
|
["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
|
67
36
|
["Twilight" ,"twilight" , "dark"],
|
68
37
|
["Vibrant Ink" ,"vibrant_ink" , "dark"]
|
69
|
-
]
|
38
|
+
];
|
70
39
|
|
71
40
|
|
72
41
|
exports.themesByName = {};
|
73
42
|
exports.themes = themeData.map(function(data) {
|
74
43
|
var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
|
75
44
|
var theme = {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
45
|
+
caption: data[0],
|
46
|
+
theme: "ace/theme/" + name,
|
47
|
+
isDark: data[2] == "dark",
|
48
|
+
name: name
|
80
49
|
};
|
81
50
|
exports.themesByName[name] = theme;
|
82
51
|
return theme;
|
83
52
|
});
|
84
53
|
|
85
54
|
});
|
86
|
-
|
55
|
+
;
|
56
|
+
(function() {
|
57
|
+
window.require(["ace/ext/themelist"], function() {});
|
58
|
+
})();
|
59
|
+
|
@@ -1,35 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
*
|
4
|
-
* Copyright (c) 2010, Ajax.org B.V.
|
5
|
-
* All rights reserved.
|
6
|
-
*
|
7
|
-
* Redistribution and use in source and binary forms, with or without
|
8
|
-
* modification, are permitted provided that the following conditions are met:
|
9
|
-
* * Redistributions of source code must retain the above copyright
|
10
|
-
* notice, this list of conditions and the following disclaimer.
|
11
|
-
* * Redistributions in binary form must reproduce the above copyright
|
12
|
-
* notice, this list of conditions and the following disclaimer in the
|
13
|
-
* documentation and/or other materials provided with the distribution.
|
14
|
-
* * Neither the name of Ajax.org B.V. nor the
|
15
|
-
* names of its contributors may be used to endorse or promote products
|
16
|
-
* derived from this software without specific prior written permission.
|
17
|
-
*
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
-
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
-
*
|
29
|
-
* ***** END LICENSE BLOCK ***** */
|
30
|
-
|
31
|
-
define('ace/ext/whitespace', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
|
32
|
-
|
1
|
+
define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"], function(require, exports, module) {
|
2
|
+
"use strict";
|
33
3
|
|
34
4
|
var lang = require("../lib/lang");
|
35
5
|
exports.$detectIndentation = function(lines, fallback) {
|
@@ -43,7 +13,6 @@ exports.$detectIndentation = function(lines, fallback) {
|
|
43
13
|
if (!/^\s*[^*+\-\s]/.test(line))
|
44
14
|
continue;
|
45
15
|
|
46
|
-
var tabs = line.match(/^\t*/)[0].length;
|
47
16
|
if (line[0] == "\t")
|
48
17
|
tabIndents++;
|
49
18
|
|
@@ -56,10 +25,10 @@ exports.$detectIndentation = function(lines, fallback) {
|
|
56
25
|
stats[spaces] = (stats[spaces] || 0) + 1;
|
57
26
|
}
|
58
27
|
prevSpaces = spaces;
|
59
|
-
while (line[line.length - 1] == "\\")
|
28
|
+
while (i < max && line[line.length - 1] == "\\")
|
60
29
|
line = lines[i++];
|
61
30
|
}
|
62
|
-
|
31
|
+
|
63
32
|
function getScore(indent) {
|
64
33
|
var score = 0;
|
65
34
|
for (var i = indent; i < stats.length; i += indent)
|
@@ -72,15 +41,17 @@ exports.$detectIndentation = function(lines, fallback) {
|
|
72
41
|
var first = {score: 0, length: 0};
|
73
42
|
var spaceIndents = 0;
|
74
43
|
for (var i = 1; i < 12; i++) {
|
44
|
+
var score = getScore(i);
|
75
45
|
if (i == 1) {
|
76
|
-
spaceIndents =
|
77
|
-
|
46
|
+
spaceIndents = score;
|
47
|
+
score = stats[1] ? 0.9 : 0.8;
|
48
|
+
if (!stats.length)
|
49
|
+
score = 0
|
78
50
|
} else
|
79
|
-
|
51
|
+
score /= spaceIndents;
|
80
52
|
|
81
|
-
if (changes[i])
|
53
|
+
if (changes[i])
|
82
54
|
score += changes[i] / changesTotal;
|
83
|
-
}
|
84
55
|
|
85
56
|
if (score > first.score)
|
86
57
|
first = {score: score, length: i};
|
@@ -92,7 +63,7 @@ exports.$detectIndentation = function(lines, fallback) {
|
|
92
63
|
if (tabIndents > spaceIndents + 1)
|
93
64
|
return {ch: "\t", length: tabLength};
|
94
65
|
|
95
|
-
if (spaceIndents + 1
|
66
|
+
if (spaceIndents > tabIndents + 1)
|
96
67
|
return {ch: " ", length: tabLength};
|
97
68
|
};
|
98
69
|
|
@@ -204,3 +175,8 @@ exports.commands = [{
|
|
204
175
|
}];
|
205
176
|
|
206
177
|
});
|
178
|
+
;
|
179
|
+
(function() {
|
180
|
+
window.require(["ace/ext/whitespace"], function() {});
|
181
|
+
})();
|
182
|
+
|
@@ -1,548 +1,369 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
*
|
4
|
-
* Copyright (c) 2010, Ajax.org B.V.
|
5
|
-
* All rights reserved.
|
6
|
-
*
|
7
|
-
* Redistribution and use in source and binary forms, with or without
|
8
|
-
* modification, are permitted provided that the following conditions are met:
|
9
|
-
* * Redistributions of source code must retain the above copyright
|
10
|
-
* notice, this list of conditions and the following disclaimer.
|
11
|
-
* * Redistributions in binary form must reproduce the above copyright
|
12
|
-
* notice, this list of conditions and the following disclaimer in the
|
13
|
-
* documentation and/or other materials provided with the distribution.
|
14
|
-
* * Neither the name of Ajax.org B.V. nor the
|
15
|
-
* names of its contributors may be used to endorse or promote products
|
16
|
-
* derived from this software without specific prior written permission.
|
17
|
-
*
|
18
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
-
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
-
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
-
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
-
*
|
29
|
-
* ***** END LICENSE BLOCK ***** */
|
30
|
-
|
31
|
-
define('ace/keyboard/emacs', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/incremental_search', 'ace/commands/incremental_search_commands', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
1
|
+
define("ace/occur",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/edit_session","ace/search_highlight","ace/lib/dom"], function(require, exports, module) {
|
2
|
+
"use strict";
|
32
3
|
|
4
|
+
var oop = require("./lib/oop");
|
5
|
+
var Range = require("./range").Range;
|
6
|
+
var Search = require("./search").Search;
|
7
|
+
var EditSession = require("./edit_session").EditSession;
|
8
|
+
var SearchHighlight = require("./search_highlight").SearchHighlight;
|
9
|
+
function Occur() {}
|
33
10
|
|
34
|
-
|
35
|
-
require("../incremental_search");
|
36
|
-
var iSearchCommandModule = require("../commands/incremental_search_commands");
|
11
|
+
oop.inherits(Occur, Search);
|
37
12
|
|
13
|
+
(function() {
|
14
|
+
this.enter = function(editor, options) {
|
15
|
+
if (!options.needle) return false;
|
16
|
+
var pos = editor.getCursorPosition();
|
17
|
+
this.displayOccurContent(editor, options);
|
18
|
+
var translatedPos = this.originalToOccurPosition(editor.session, pos);
|
19
|
+
editor.moveCursorToPosition(translatedPos);
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
this.exit = function(editor, options) {
|
23
|
+
var pos = options.translatePosition && editor.getCursorPosition();
|
24
|
+
var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
|
25
|
+
this.displayOriginalContent(editor);
|
26
|
+
if (translatedPos)
|
27
|
+
editor.moveCursorToPosition(translatedPos);
|
28
|
+
return true;
|
29
|
+
}
|
38
30
|
|
39
|
-
|
40
|
-
|
31
|
+
this.highlight = function(sess, regexp) {
|
32
|
+
var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(
|
33
|
+
new SearchHighlight(null, "ace_occur-highlight", "text"));
|
34
|
+
hl.setRegexp(regexp);
|
35
|
+
sess._emit("changeBackMarker"); // force highlight layer redraw
|
36
|
+
}
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
38
|
+
this.displayOccurContent = function(editor, options) {
|
39
|
+
this.$originalSession = editor.session;
|
40
|
+
var found = this.matchingLines(editor.session, options);
|
41
|
+
var lines = found.map(function(foundLine) { return foundLine.content; });
|
42
|
+
var occurSession = new EditSession(lines.join('\n'));
|
43
|
+
occurSession.$occur = this;
|
44
|
+
occurSession.$occurMatchingLines = found;
|
45
|
+
editor.setSession(occurSession);
|
46
|
+
this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart;
|
47
|
+
occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
|
48
|
+
this.highlight(occurSession, options.re);
|
49
|
+
occurSession._emit('changeBackMarker');
|
50
|
+
}
|
48
51
|
|
49
|
-
|
50
|
-
|
52
|
+
this.displayOriginalContent = function(editor) {
|
53
|
+
editor.setSession(this.$originalSession);
|
54
|
+
this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
|
55
|
+
}
|
56
|
+
this.originalToOccurPosition = function(session, pos) {
|
57
|
+
var lines = session.$occurMatchingLines;
|
58
|
+
var nullPos = {row: 0, column: 0};
|
59
|
+
if (!lines) return nullPos;
|
60
|
+
for (var i = 0; i < lines.length; i++) {
|
61
|
+
if (lines[i].row === pos.row)
|
62
|
+
return {row: i, column: pos.column};
|
63
|
+
}
|
64
|
+
return nullPos;
|
65
|
+
}
|
66
|
+
this.occurToOriginalPosition = function(session, pos) {
|
67
|
+
var lines = session.$occurMatchingLines;
|
68
|
+
if (!lines || !lines[pos.row])
|
69
|
+
return pos;
|
70
|
+
return {row: lines[pos.row].row, column: pos.column};
|
71
|
+
}
|
51
72
|
|
52
|
-
|
53
|
-
|
73
|
+
this.matchingLines = function(session, options) {
|
74
|
+
options = oop.mixin({}, options);
|
75
|
+
if (!session || !options.needle) return [];
|
76
|
+
var search = new Search();
|
77
|
+
search.set(options);
|
78
|
+
return search.findAll(session).reduce(function(lines, range) {
|
79
|
+
var row = range.start.row;
|
80
|
+
var last = lines[lines.length-1];
|
81
|
+
return last && last.row === row ?
|
82
|
+
lines :
|
83
|
+
lines.concat({row: row, content: session.getLine(row)});
|
84
|
+
}, []);
|
85
|
+
}
|
54
86
|
|
55
|
-
|
56
|
-
exports.handler.$id = "ace/keyboard/emacs";
|
87
|
+
}).call(Occur.prototype);
|
57
88
|
|
58
|
-
var
|
59
|
-
|
60
|
-
|
89
|
+
var dom = require('./lib/dom');
|
90
|
+
dom.importCssString(".ace_occur-highlight {\n\
|
91
|
+
border-radius: 4px;\n\
|
92
|
+
background-color: rgba(87, 255, 8, 0.25);\n\
|
93
|
+
position: absolute;\n\
|
94
|
+
z-index: 4;\n\
|
95
|
+
-moz-box-sizing: border-box;\n\
|
96
|
+
-webkit-box-sizing: border-box;\n\
|
97
|
+
box-sizing: border-box;\n\
|
98
|
+
box-shadow: 0 0 4px rgb(91, 255, 50);\n\
|
99
|
+
}\n\
|
100
|
+
.ace_dark .ace_occur-highlight {\n\
|
101
|
+
background-color: rgb(80, 140, 85);\n\
|
102
|
+
box-shadow: 0 0 4px rgb(60, 120, 70);\n\
|
103
|
+
}\n", "incremental-occur-highlighting");
|
61
104
|
|
62
|
-
exports.
|
63
|
-
if (!initialized) {
|
64
|
-
initialized = true;
|
65
|
-
dom.importCssString('\
|
66
|
-
.emacs-mode .ace_cursor{\
|
67
|
-
border: 2px rgba(50,250,50,0.8) solid!important;\
|
68
|
-
-moz-box-sizing: border-box!important;\
|
69
|
-
-webkit-box-sizing: border-box!important;\
|
70
|
-
box-sizing: border-box!important;\
|
71
|
-
background-color: rgba(0,250,0,0.9);\
|
72
|
-
opacity: 0.5;\
|
73
|
-
}\
|
74
|
-
.emacs-mode .ace_hidden-cursors .ace_cursor{\
|
75
|
-
opacity: 1;\
|
76
|
-
background-color: transparent;\
|
77
|
-
}\
|
78
|
-
.emacs-mode .ace_overwrite-cursors .ace_cursor {\
|
79
|
-
opacity: 1;\
|
80
|
-
background-color: transparent;\
|
81
|
-
border-width: 0 0 2px 2px !important;\
|
82
|
-
}\
|
83
|
-
.emacs-mode .ace_text-layer {\
|
84
|
-
z-index: 4\
|
85
|
-
}\
|
86
|
-
.emacs-mode .ace_cursor-layer {\
|
87
|
-
z-index: 2\
|
88
|
-
}', 'emacsMode'
|
89
|
-
);
|
90
|
-
}
|
91
|
-
$formerLongWords = editor.session.$selectLongWords;
|
92
|
-
editor.session.$selectLongWords = true;
|
93
|
-
$formerLineStart = editor.session.$useEmacsStyleLineStart;
|
94
|
-
editor.session.$useEmacsStyleLineStart = true;
|
105
|
+
exports.Occur = Occur;
|
95
106
|
|
96
|
-
|
97
|
-
editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];
|
107
|
+
});
|
98
108
|
|
99
|
-
|
100
|
-
return this.session.$emacsMark;
|
101
|
-
}
|
109
|
+
define("ace/commands/occur_commands",["require","exports","module","ace/config","ace/occur","ace/keyboard/hash_handler","ace/lib/oop"], function(require, exports, module) {
|
102
110
|
|
103
|
-
|
104
|
-
|
105
|
-
|
111
|
+
var config = require("../config"),
|
112
|
+
Occur = require("../occur").Occur;
|
113
|
+
var occurStartCommand = {
|
114
|
+
name: "occur",
|
115
|
+
exec: function(editor, options) {
|
116
|
+
var alreadyInOccur = !!editor.session.$occur;
|
117
|
+
var occurSessionActive = new Occur().enter(editor, options);
|
118
|
+
if (occurSessionActive && !alreadyInOccur)
|
119
|
+
OccurKeyboardHandler.installIn(editor);
|
120
|
+
},
|
121
|
+
readOnly: true
|
122
|
+
};
|
106
123
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
124
|
+
var occurCommands = [{
|
125
|
+
name: "occurexit",
|
126
|
+
bindKey: 'esc|Ctrl-G',
|
127
|
+
exec: function(editor) {
|
128
|
+
var occur = editor.session.$occur;
|
129
|
+
if (!occur) return;
|
130
|
+
occur.exit(editor, {});
|
131
|
+
if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
|
132
|
+
},
|
133
|
+
readOnly: true
|
134
|
+
}, {
|
135
|
+
name: "occuraccept",
|
136
|
+
bindKey: 'enter',
|
137
|
+
exec: function(editor) {
|
138
|
+
var occur = editor.session.$occur;
|
139
|
+
if (!occur) return;
|
140
|
+
occur.exit(editor, {translatePosition: true});
|
141
|
+
if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
|
142
|
+
},
|
143
|
+
readOnly: true
|
144
|
+
}];
|
114
145
|
|
115
|
-
|
116
|
-
|
117
|
-
if (mark) { this.setEmacsMark(null); return mark; }
|
118
|
-
return this.session.$emacsMarkRing.pop();
|
119
|
-
}
|
146
|
+
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
147
|
+
var oop = require("../lib/oop");
|
120
148
|
|
121
|
-
editor.getLastEmacsMark = function(p) {
|
122
|
-
return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
|
123
|
-
}
|
124
149
|
|
125
|
-
|
126
|
-
editor.on("changeSession", $kbSessionChange);
|
127
|
-
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
|
128
|
-
editor.setStyle("emacs-mode");
|
129
|
-
editor.commands.addCommands(commands);
|
130
|
-
exports.handler.platform = editor.commands.platform;
|
131
|
-
editor.$emacsModeHandler = this;
|
132
|
-
editor.addEventListener('copy', this.onCopy);
|
133
|
-
editor.addEventListener('paste', this.onPaste);
|
134
|
-
};
|
150
|
+
function OccurKeyboardHandler() {}
|
135
151
|
|
136
|
-
|
137
|
-
delete editor.renderer.screenToTextCoordinates;
|
138
|
-
editor.session.$selectLongWords = $formerLongWords;
|
139
|
-
editor.session.$useEmacsStyleLineStart = $formerLineStart;
|
140
|
-
editor.removeEventListener("click", $resetMarkMode);
|
141
|
-
editor.removeEventListener("changeSession", $kbSessionChange);
|
142
|
-
editor.unsetStyle("emacs-mode");
|
143
|
-
editor.commands.removeCommands(commands);
|
144
|
-
editor.removeEventListener('copy', this.onCopy);
|
145
|
-
editor.removeEventListener('paste', this.onPaste);
|
146
|
-
};
|
152
|
+
oop.inherits(OccurKeyboardHandler, HashHandler);
|
147
153
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
154
|
+
;(function() {
|
155
|
+
|
156
|
+
this.isOccurHandler = true;
|
157
|
+
|
158
|
+
this.attach = function(editor) {
|
159
|
+
HashHandler.call(this, occurCommands, editor.commands.platform);
|
160
|
+
this.$editor = editor;
|
152
161
|
}
|
153
162
|
|
154
|
-
$
|
155
|
-
|
156
|
-
|
157
|
-
|
163
|
+
var handleKeyboard$super = this.handleKeyboard;
|
164
|
+
this.handleKeyboard = function(data, hashId, key, keyCode) {
|
165
|
+
var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
|
166
|
+
return (cmd && cmd.command) ? cmd : undefined;
|
167
|
+
}
|
158
168
|
|
159
|
-
|
160
|
-
e.session.$emacsMark = null;
|
161
|
-
if (!e.session.hasOwnProperty('$emacsMarkRing'))
|
162
|
-
e.session.$emacsMarkRing = [];
|
163
|
-
}
|
169
|
+
}).call(OccurKeyboardHandler.prototype);
|
164
170
|
|
165
|
-
|
166
|
-
|
171
|
+
OccurKeyboardHandler.installIn = function(editor) {
|
172
|
+
var handler = new this();
|
173
|
+
editor.keyBinding.addKeyboardHandler(handler);
|
174
|
+
editor.commands.addCommands(occurCommands);
|
167
175
|
}
|
168
176
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
"CMD", "M", "S", "C"];
|
175
|
-
combinations.forEach(function(c) {
|
176
|
-
var hashId = 0;
|
177
|
-
c.split("-").forEach(function(c) {
|
178
|
-
hashId = hashId | keys[eMods[c]];
|
179
|
-
});
|
180
|
-
eMods[hashId] = c.toLowerCase() + "-";
|
181
|
-
});
|
182
|
-
|
183
|
-
exports.handler.onCopy = function(e, editor) {
|
184
|
-
if (editor.$handlesEmacsOnCopy) return;
|
185
|
-
editor.$handlesEmacsOnCopy = true;
|
186
|
-
exports.handler.commands.killRingSave.exec(editor);
|
187
|
-
delete editor.$handlesEmacsOnCopy;
|
177
|
+
OccurKeyboardHandler.uninstallFrom = function(editor) {
|
178
|
+
editor.commands.removeCommands(occurCommands);
|
179
|
+
var handler = editor.getKeyboardHandler();
|
180
|
+
if (handler.isOccurHandler)
|
181
|
+
editor.keyBinding.removeKeyboardHandler(handler);
|
188
182
|
}
|
189
183
|
|
190
|
-
exports.
|
191
|
-
editor.pushEmacsMark(editor.getCursorPosition());
|
192
|
-
}
|
184
|
+
exports.occurStartCommand = occurStartCommand;
|
193
185
|
|
194
|
-
|
195
|
-
if (!key)
|
196
|
-
return;
|
186
|
+
});
|
197
187
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
188
|
+
define("ace/commands/incremental_search_commands",["require","exports","module","ace/config","ace/lib/oop","ace/keyboard/hash_handler","ace/commands/occur_commands"], function(require, exports, module) {
|
189
|
+
|
190
|
+
var config = require("../config");
|
191
|
+
var oop = require("../lib/oop");
|
192
|
+
var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
193
|
+
var occurStartCommand = require("./occur_commands").occurStartCommand;
|
194
|
+
exports.iSearchStartCommands = [{
|
195
|
+
name: "iSearch",
|
196
|
+
bindKey: {win: "Ctrl-F", mac: "Command-F"},
|
197
|
+
exec: function(editor, options) {
|
198
|
+
config.loadModule(["core", "ace/incremental_search"], function(e) {
|
199
|
+
var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
|
200
|
+
iSearch.activate(editor, options.backwards);
|
201
|
+
if (options.jumpToFirstMatch) iSearch.next(options);
|
208
202
|
});
|
209
|
-
},
|
203
|
+
},
|
204
|
+
readOnly: true
|
205
|
+
}, {
|
206
|
+
name: "iSearchBackwards",
|
207
|
+
exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },
|
208
|
+
readOnly: true
|
209
|
+
}, {
|
210
|
+
name: "iSearchAndGo",
|
211
|
+
bindKey: {win: "Ctrl-K", mac: "Command-G"},
|
212
|
+
exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },
|
213
|
+
readOnly: true
|
214
|
+
}, {
|
215
|
+
name: "iSearchBackwardsAndGo",
|
216
|
+
bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"},
|
217
|
+
exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },
|
218
|
+
readOnly: true
|
219
|
+
}];
|
220
|
+
exports.iSearchCommands = [{
|
221
|
+
name: "restartSearch",
|
222
|
+
bindKey: {win: "Ctrl-F", mac: "Command-F"},
|
223
|
+
exec: function(iSearch) {
|
224
|
+
iSearch.cancelSearch(true);
|
225
|
+
},
|
226
|
+
readOnly: true,
|
227
|
+
isIncrementalSearchCommand: true
|
228
|
+
}, {
|
229
|
+
name: "searchForward",
|
230
|
+
bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
|
231
|
+
exec: function(iSearch, options) {
|
232
|
+
options.useCurrentOrPrevSearch = true;
|
233
|
+
iSearch.next(options);
|
234
|
+
},
|
235
|
+
readOnly: true,
|
236
|
+
isIncrementalSearchCommand: true
|
237
|
+
}, {
|
238
|
+
name: "searchBackward",
|
239
|
+
bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
|
240
|
+
exec: function(iSearch, options) {
|
241
|
+
options.useCurrentOrPrevSearch = true;
|
242
|
+
options.backwards = true;
|
243
|
+
iSearch.next(options);
|
244
|
+
},
|
245
|
+
readOnly: true,
|
246
|
+
isIncrementalSearchCommand: true
|
247
|
+
}, {
|
248
|
+
name: "extendSearchTerm",
|
249
|
+
exec: function(iSearch, string) {
|
250
|
+
iSearch.addString(string);
|
251
|
+
},
|
252
|
+
readOnly: true,
|
253
|
+
isIncrementalSearchCommand: true
|
254
|
+
}, {
|
255
|
+
name: "extendSearchTermSpace",
|
256
|
+
bindKey: "space",
|
257
|
+
exec: function(iSearch) { iSearch.addString(' '); },
|
258
|
+
readOnly: true,
|
259
|
+
isIncrementalSearchCommand: true
|
260
|
+
}, {
|
261
|
+
name: "shrinkSearchTerm",
|
262
|
+
bindKey: "backspace",
|
263
|
+
exec: function(iSearch) {
|
264
|
+
iSearch.removeChar();
|
265
|
+
},
|
266
|
+
readOnly: true,
|
267
|
+
isIncrementalSearchCommand: true
|
268
|
+
}, {
|
269
|
+
name: 'confirmSearch',
|
270
|
+
bindKey: 'return',
|
271
|
+
exec: function(iSearch) { iSearch.deactivate(); },
|
272
|
+
readOnly: true,
|
273
|
+
isIncrementalSearchCommand: true
|
274
|
+
}, {
|
275
|
+
name: 'cancelSearch',
|
276
|
+
bindKey: 'esc|Ctrl-G',
|
277
|
+
exec: function(iSearch) { iSearch.deactivate(true); },
|
278
|
+
readOnly: true,
|
279
|
+
isIncrementalSearchCommand: true
|
280
|
+
}, {
|
281
|
+
name: 'occurisearch',
|
282
|
+
bindKey: 'Ctrl-O',
|
283
|
+
exec: function(iSearch) {
|
284
|
+
var options = oop.mixin({}, iSearch.$options);
|
285
|
+
iSearch.deactivate();
|
286
|
+
occurStartCommand.exec(iSearch.$editor, options);
|
287
|
+
},
|
288
|
+
readOnly: true,
|
289
|
+
isIncrementalSearchCommand: true
|
290
|
+
}, {
|
291
|
+
name: "yankNextWord",
|
292
|
+
bindKey: "Ctrl-w",
|
293
|
+
exec: function(iSearch) {
|
294
|
+
var ed = iSearch.$editor,
|
295
|
+
range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }),
|
296
|
+
string = ed.session.getTextRange(range);
|
297
|
+
iSearch.addString(string);
|
298
|
+
},
|
299
|
+
readOnly: true,
|
300
|
+
isIncrementalSearchCommand: true
|
301
|
+
}, {
|
302
|
+
name: "yankNextChar",
|
303
|
+
bindKey: "Ctrl-Alt-y",
|
304
|
+
exec: function(iSearch) {
|
305
|
+
var ed = iSearch.$editor,
|
306
|
+
range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }),
|
307
|
+
string = ed.session.getTextRange(range);
|
308
|
+
iSearch.addString(string);
|
309
|
+
},
|
310
|
+
readOnly: true,
|
311
|
+
isIncrementalSearchCommand: true
|
312
|
+
}, {
|
313
|
+
name: 'recenterTopBottom',
|
314
|
+
bindKey: 'Ctrl-l',
|
315
|
+
exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); },
|
316
|
+
readOnly: true,
|
317
|
+
isIncrementalSearchCommand: true
|
318
|
+
}];
|
319
|
+
|
320
|
+
function IncrementalSearchKeyboardHandler(iSearch) {
|
321
|
+
this.$iSearch = iSearch;
|
210
322
|
}
|
211
323
|
|
212
|
-
|
213
|
-
var editor = data.editor;
|
214
|
-
if (hashId == -1) {
|
215
|
-
editor.pushEmacsMark();
|
216
|
-
if (data.count) {
|
217
|
-
var str = Array(data.count + 1).join(key);
|
218
|
-
data.count = null;
|
219
|
-
return {command: "insertstring", args: str};
|
220
|
-
}
|
221
|
-
}
|
324
|
+
oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
|
222
325
|
|
223
|
-
|
326
|
+
;(function() {
|
224
327
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
}
|
328
|
+
this.attach = function(editor) {
|
329
|
+
var iSearch = this.$iSearch;
|
330
|
+
HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
|
331
|
+
this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
|
332
|
+
if (!e.command.isIncrementalSearchCommand) return undefined;
|
333
|
+
e.stopPropagation();
|
334
|
+
e.preventDefault();
|
335
|
+
return e.command.exec(iSearch, e.args || {});
|
336
|
+
});
|
235
337
|
}
|
236
|
-
data.universalArgument = false;
|
237
|
-
if (modifier) key = modifier + key;
|
238
|
-
if (data.keyChain) key = data.keyChain += " " + key;
|
239
|
-
var command = this.commandKeyBinding[key];
|
240
|
-
data.keyChain = command == "null" ? key : "";
|
241
|
-
if (!command) return undefined;
|
242
|
-
if (command === "null") return {command: "null"};
|
243
338
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
var args;
|
249
|
-
if (typeof command !== "string") {
|
250
|
-
args = command.args;
|
251
|
-
if (command.command) command = command.command;
|
252
|
-
if (command === "goorselect") {
|
253
|
-
command = editor.emacsMark() ? args[1] : args[0];
|
254
|
-
args = null;
|
255
|
-
}
|
339
|
+
this.detach = function(editor) {
|
340
|
+
if (!this.$commandExecHandler) return;
|
341
|
+
editor.commands.removeEventListener('exec', this.$commandExecHandler);
|
342
|
+
delete this.$commandExecHandler;
|
256
343
|
}
|
257
344
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
345
|
+
var handleKeyboard$super = this.handleKeyboard;
|
346
|
+
this.handleKeyboard = function(data, hashId, key, keyCode) {
|
347
|
+
if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v')
|
348
|
+
|| (hashId === 1/*ctrl*/ && key === 'y')) return null;
|
349
|
+
var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
|
350
|
+
if (cmd.command) { return cmd; }
|
351
|
+
if (hashId == -1) {
|
352
|
+
var extendCmd = this.commands.extendSearchTerm;
|
353
|
+
if (extendCmd) { return {command: extendCmd, args: key}; }
|
263
354
|
}
|
264
|
-
command
|
265
|
-
if (!command) return undefined;
|
355
|
+
return {command: "null", passEvent: hashId == 0 || hashId == 4};
|
266
356
|
}
|
267
357
|
|
268
|
-
|
269
|
-
data.lastCommand = null;
|
358
|
+
}).call(IncrementalSearchKeyboardHandler.prototype);
|
270
359
|
|
271
|
-
if (data.count) {
|
272
|
-
var count = data.count;
|
273
|
-
data.count = 0;
|
274
|
-
if (!command || !command.handlesCount) {
|
275
|
-
return {
|
276
|
-
args: args,
|
277
|
-
command: {
|
278
|
-
exec: function(editor, args) {
|
279
|
-
for (var i = 0; i < count; i++)
|
280
|
-
command.exec(editor, args);
|
281
|
-
}
|
282
|
-
}
|
283
|
-
};
|
284
|
-
} else {
|
285
|
-
if (!args) args = {}
|
286
|
-
if (typeof args === 'object') args.count = count;
|
287
|
-
}
|
288
|
-
}
|
289
360
|
|
290
|
-
|
291
|
-
};
|
292
|
-
|
293
|
-
exports.emacsKeys = {
|
294
|
-
"Up|C-p" : {command: "goorselect", args: ["golineup","selectup"]},
|
295
|
-
"Down|C-n" : {command: "goorselect", args: ["golinedown","selectdown"]},
|
296
|
-
"Left|C-b" : {command: "goorselect", args: ["gotoleft","selectleft"]},
|
297
|
-
"Right|C-f" : {command: "goorselect", args: ["gotoright","selectright"]},
|
298
|
-
"C-Left|M-b" : {command: "goorselect", args: ["gotowordleft","selectwordleft"]},
|
299
|
-
"C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]},
|
300
|
-
"Home|C-a" : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]},
|
301
|
-
"End|C-e" : {command: "goorselect", args: ["gotolineend","selecttolineend"]},
|
302
|
-
"C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]},
|
303
|
-
"C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]},
|
304
|
-
"S-Up|S-C-p" : "selectup",
|
305
|
-
"S-Down|S-C-n" : "selectdown",
|
306
|
-
"S-Left|S-C-b" : "selectleft",
|
307
|
-
"S-Right|S-C-f" : "selectright",
|
308
|
-
"S-C-Left|S-M-b" : "selectwordleft",
|
309
|
-
"S-C-Right|S-M-f" : "selectwordright",
|
310
|
-
"S-Home|S-C-a" : "selecttolinestart",
|
311
|
-
"S-End|S-C-e" : "selecttolineend",
|
312
|
-
"S-C-Home" : "selecttostart",
|
313
|
-
"S-C-End" : "selecttoend",
|
314
|
-
|
315
|
-
"C-l" : "recenterTopBottom",
|
316
|
-
"M-s" : "centerselection",
|
317
|
-
"M-g": "gotoline",
|
318
|
-
"C-x C-p": "selectall",
|
319
|
-
"C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
|
320
|
-
"C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]},
|
321
|
-
"PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
|
322
|
-
"PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]},
|
323
|
-
"S-C-Down": "selectpagedown",
|
324
|
-
"S-C-Up": "selectpageup",
|
325
|
-
|
326
|
-
"C-s": "iSearch",
|
327
|
-
"C-r": "iSearchBackwards",
|
328
|
-
|
329
|
-
"M-C-s": "findnext",
|
330
|
-
"M-C-r": "findprevious",
|
331
|
-
"S-M-5": "replace",
|
332
|
-
"Backspace": "backspace",
|
333
|
-
"Delete|C-d": "del",
|
334
|
-
"Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
|
335
|
-
"C-o": "splitline",
|
336
|
-
|
337
|
-
"M-d|C-Delete": {command: "killWord", args: "right"},
|
338
|
-
"C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
|
339
|
-
"C-k": "killLine",
|
340
|
-
|
341
|
-
"C-y|S-Delete": "yank",
|
342
|
-
"M-y": "yankRotate",
|
343
|
-
"C-g": "keyboardQuit",
|
344
|
-
|
345
|
-
"C-w": "killRegion",
|
346
|
-
"M-w": "killRingSave",
|
347
|
-
"C-Space": "setMark",
|
348
|
-
"C-x C-x": "exchangePointAndMark",
|
349
|
-
|
350
|
-
"C-t": "transposeletters",
|
351
|
-
"M-u": "touppercase", // Doesn't work
|
352
|
-
"M-l": "tolowercase",
|
353
|
-
"M-/": "autocomplete", // Doesn't work
|
354
|
-
"C-u": "universalArgument",
|
355
|
-
|
356
|
-
"M-;": "togglecomment",
|
357
|
-
|
358
|
-
"C-/|C-x u|S-C--|C-z": "undo",
|
359
|
-
"S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
|
360
|
-
"C-x r": "selectRectangularRegion",
|
361
|
-
"M-x": {command: "focusCommandLine", args: "M-x "}
|
362
|
-
};
|
363
|
-
|
364
|
-
|
365
|
-
exports.handler.bindKeys(exports.emacsKeys);
|
366
|
-
|
367
|
-
exports.handler.addCommands({
|
368
|
-
recenterTopBottom: function(editor) {
|
369
|
-
var renderer = editor.renderer;
|
370
|
-
var pos = renderer.$cursorLayer.getPixelPosition();
|
371
|
-
var h = renderer.$size.scrollerHeight - renderer.lineHeight;
|
372
|
-
var scrollTop = renderer.scrollTop;
|
373
|
-
if (Math.abs(pos.top - scrollTop) < 2) {
|
374
|
-
scrollTop = pos.top - h;
|
375
|
-
} else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
|
376
|
-
scrollTop = pos.top;
|
377
|
-
} else {
|
378
|
-
scrollTop = pos.top - h * 0.5;
|
379
|
-
}
|
380
|
-
editor.session.setScrollTop(scrollTop);
|
381
|
-
},
|
382
|
-
selectRectangularRegion: function(editor) {
|
383
|
-
editor.multiSelect.toggleBlockSelection();
|
384
|
-
},
|
385
|
-
setMark: {
|
386
|
-
exec: function(editor, args) {
|
387
|
-
if (args && args.count) {
|
388
|
-
var mark = editor.popEmacsMark();
|
389
|
-
mark && editor.selection.moveCursorToPosition(mark);
|
390
|
-
return;
|
391
|
-
}
|
392
|
-
|
393
|
-
var mark = editor.emacsMark(),
|
394
|
-
transientMarkModeActive = true;
|
395
|
-
if (transientMarkModeActive && (mark || !editor.selection.isEmpty())) {
|
396
|
-
editor.pushEmacsMark();
|
397
|
-
editor.clearSelection();
|
398
|
-
return;
|
399
|
-
}
|
400
|
-
|
401
|
-
if (mark) {
|
402
|
-
var cp = editor.getCursorPosition();
|
403
|
-
if (editor.selection.isEmpty() &&
|
404
|
-
mark.row == cp.row && mark.column == cp.column) {
|
405
|
-
editor.pushEmacsMark();
|
406
|
-
return;
|
407
|
-
}
|
408
|
-
}
|
409
|
-
mark = editor.getCursorPosition();
|
410
|
-
editor.setEmacsMark(mark);
|
411
|
-
editor.selection.setSelectionAnchor(mark.row, mark.column);
|
412
|
-
},
|
413
|
-
readonly: true,
|
414
|
-
handlesCount: true,
|
415
|
-
multiSelectAction: "forEach"
|
416
|
-
},
|
417
|
-
exchangePointAndMark: {
|
418
|
-
exec: function(editor, args) {
|
419
|
-
var sel = editor.selection;
|
420
|
-
if (args.count) {
|
421
|
-
var pos = editor.getCursorPosition();
|
422
|
-
sel.clearSelection();
|
423
|
-
sel.moveCursorToPosition(editor.popEmacsMark());
|
424
|
-
editor.pushEmacsMark(pos);
|
425
|
-
return;
|
426
|
-
}
|
427
|
-
var lastMark = editor.getLastEmacsMark();
|
428
|
-
var range = sel.getRange();
|
429
|
-
if (range.isEmpty()) {
|
430
|
-
sel.selectToPosition(lastMark);
|
431
|
-
return;
|
432
|
-
}
|
433
|
-
sel.setSelectionRange(range, !sel.isBackwards());
|
434
|
-
},
|
435
|
-
readonly: true,
|
436
|
-
handlesCount: true,
|
437
|
-
multiSelectAction: "forEach"
|
438
|
-
},
|
439
|
-
killWord: {
|
440
|
-
exec: function(editor, dir) {
|
441
|
-
editor.clearSelection();
|
442
|
-
if (dir == "left")
|
443
|
-
editor.selection.selectWordLeft();
|
444
|
-
else
|
445
|
-
editor.selection.selectWordRight();
|
446
|
-
|
447
|
-
var range = editor.getSelectionRange();
|
448
|
-
var text = editor.session.getTextRange(range);
|
449
|
-
exports.killRing.add(text);
|
450
|
-
|
451
|
-
editor.session.remove(range);
|
452
|
-
editor.clearSelection();
|
453
|
-
},
|
454
|
-
multiSelectAction: "forEach"
|
455
|
-
},
|
456
|
-
killLine: function(editor) {
|
457
|
-
editor.pushEmacsMark(null);
|
458
|
-
var pos = editor.getCursorPosition();
|
459
|
-
if (pos.column == 0 &&
|
460
|
-
editor.session.doc.getLine(pos.row).length == 0) {
|
461
|
-
editor.selection.selectLine();
|
462
|
-
} else {
|
463
|
-
editor.clearSelection();
|
464
|
-
editor.selection.selectLineEnd();
|
465
|
-
}
|
466
|
-
var range = editor.getSelectionRange();
|
467
|
-
var text = editor.session.getTextRange(range);
|
468
|
-
exports.killRing.add(text);
|
469
|
-
|
470
|
-
editor.session.remove(range);
|
471
|
-
editor.clearSelection();
|
472
|
-
},
|
473
|
-
yank: function(editor) {
|
474
|
-
editor.onPaste(exports.killRing.get() || '');
|
475
|
-
editor.keyBinding.$data.lastCommand = "yank";
|
476
|
-
},
|
477
|
-
yankRotate: function(editor) {
|
478
|
-
if (editor.keyBinding.$data.lastCommand != "yank")
|
479
|
-
return;
|
480
|
-
editor.undo();
|
481
|
-
editor.onPaste(exports.killRing.rotate());
|
482
|
-
editor.keyBinding.$data.lastCommand = "yank";
|
483
|
-
},
|
484
|
-
killRegion: {
|
485
|
-
exec: function(editor) {
|
486
|
-
exports.killRing.add(editor.getCopyText());
|
487
|
-
editor.commands.byName.cut.exec(editor);
|
488
|
-
},
|
489
|
-
readonly: true,
|
490
|
-
multiSelectAction: "forEach"
|
491
|
-
},
|
492
|
-
killRingSave: {
|
493
|
-
exec: function(editor) {
|
494
|
-
exports.killRing.add(editor.getCopyText());
|
495
|
-
setTimeout(function() {
|
496
|
-
var sel = editor.selection,
|
497
|
-
range = sel.getRange();
|
498
|
-
editor.pushEmacsMark(sel.isBackwards() ? range.end : range.start);
|
499
|
-
sel.clearSelection();
|
500
|
-
}, 0);
|
501
|
-
},
|
502
|
-
readonly: true
|
503
|
-
},
|
504
|
-
keyboardQuit: function(editor) {
|
505
|
-
editor.selection.clearSelection();
|
506
|
-
editor.setEmacsMark(null);
|
507
|
-
},
|
508
|
-
focusCommandLine: function(editor, arg) {
|
509
|
-
if (editor.showCommandLine)
|
510
|
-
editor.showCommandLine(arg);
|
511
|
-
}
|
512
|
-
});
|
513
|
-
|
514
|
-
exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
|
515
|
-
|
516
|
-
var commands = exports.handler.commands;
|
517
|
-
commands.yank.isYank = true;
|
518
|
-
commands.yankRotate.isYank = true;
|
519
|
-
|
520
|
-
exports.killRing = {
|
521
|
-
$data: [],
|
522
|
-
add: function(str) {
|
523
|
-
str && this.$data.push(str);
|
524
|
-
if (this.$data.length > 30)
|
525
|
-
this.$data.shift();
|
526
|
-
},
|
527
|
-
get: function(n) {
|
528
|
-
n = n || 1;
|
529
|
-
return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n');
|
530
|
-
},
|
531
|
-
pop: function() {
|
532
|
-
if (this.$data.length > 1)
|
533
|
-
this.$data.pop();
|
534
|
-
return this.get();
|
535
|
-
},
|
536
|
-
rotate: function() {
|
537
|
-
this.$data.unshift(this.$data.pop());
|
538
|
-
return this.get();
|
539
|
-
}
|
540
|
-
};
|
361
|
+
exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;
|
541
362
|
|
542
363
|
});
|
543
364
|
|
544
|
-
define(
|
545
|
-
|
365
|
+
define("ace/incremental_search",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/search_highlight","ace/commands/incremental_search_commands","ace/lib/dom","ace/commands/command_manager","ace/editor","ace/config"], function(require, exports, module) {
|
366
|
+
"use strict";
|
546
367
|
|
547
368
|
var oop = require("./lib/oop");
|
548
369
|
var Range = require("./range").Range;
|
@@ -565,6 +386,7 @@ oop.inherits(IncrementalSearch, Search);
|
|
565
386
|
this.$options.needle = '';
|
566
387
|
this.$options.backwards = backwards;
|
567
388
|
ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);
|
389
|
+
this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this);
|
568
390
|
this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
|
569
391
|
this.selectionFix(ed);
|
570
392
|
this.statusMessage(true);
|
@@ -572,11 +394,13 @@ oop.inherits(IncrementalSearch, Search);
|
|
572
394
|
|
573
395
|
this.deactivate = function(reset) {
|
574
396
|
this.cancelSearch(reset);
|
575
|
-
this.$editor
|
397
|
+
var ed = this.$editor;
|
398
|
+
ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
|
576
399
|
if (this.$mousedownHandler) {
|
577
|
-
|
400
|
+
ed.removeEventListener('mousedown', this.$mousedownHandler);
|
578
401
|
delete this.$mousedownHandler;
|
579
402
|
}
|
403
|
+
ed.onPaste = this.$originalEditorOnPaste;
|
580
404
|
this.message('');
|
581
405
|
}
|
582
406
|
|
@@ -633,9 +457,9 @@ oop.inherits(IncrementalSearch, Search);
|
|
633
457
|
return found;
|
634
458
|
}
|
635
459
|
|
636
|
-
this.
|
460
|
+
this.addString = function(s) {
|
637
461
|
return this.highlightAndFindWithNeedle(false, function(needle) {
|
638
|
-
return needle +
|
462
|
+
return needle + s;
|
639
463
|
});
|
640
464
|
}
|
641
465
|
|
@@ -660,6 +484,10 @@ oop.inherits(IncrementalSearch, Search);
|
|
660
484
|
return true;
|
661
485
|
}
|
662
486
|
|
487
|
+
this.onPaste = function(text) {
|
488
|
+
this.addString(text);
|
489
|
+
}
|
490
|
+
|
663
491
|
this.statusMessage = function(found) {
|
664
492
|
var options = this.$options, msg = '';
|
665
493
|
msg += options.backwards ? 'reverse-' : '';
|
@@ -726,333 +554,520 @@ require("./config").defineOptions(Editor.prototype, "editor", {
|
|
726
554
|
|
727
555
|
});
|
728
556
|
|
729
|
-
define(
|
557
|
+
define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/incremental_search","ace/commands/incremental_search_commands","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
|
558
|
+
"use strict";
|
730
559
|
|
731
|
-
var
|
732
|
-
|
733
|
-
var
|
734
|
-
var occurStartCommand = require("./occur_commands").occurStartCommand;
|
735
|
-
exports.iSearchStartCommands = [{
|
736
|
-
name: "iSearch",
|
737
|
-
bindKey: {win: "Ctrl-F", mac: "Command-F"},
|
738
|
-
exec: function(editor, options) {
|
739
|
-
config.loadModule(["core", "ace/incremental_search"], function(e) {
|
740
|
-
var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
|
741
|
-
iSearch.activate(editor, options.backwards);
|
742
|
-
if (options.jumpToFirstMatch) iSearch.next(options);
|
743
|
-
});
|
744
|
-
},
|
745
|
-
readOnly: true
|
746
|
-
}, {
|
747
|
-
name: "iSearchBackwards",
|
748
|
-
exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },
|
749
|
-
readOnly: true
|
750
|
-
}, {
|
751
|
-
name: "iSearchAndGo",
|
752
|
-
bindKey: {win: "Ctrl-K", mac: "Command-G"},
|
753
|
-
exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },
|
754
|
-
readOnly: true
|
755
|
-
}, {
|
756
|
-
name: "iSearchBackwardsAndGo",
|
757
|
-
bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"},
|
758
|
-
exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },
|
759
|
-
readOnly: true
|
760
|
-
}];
|
761
|
-
exports.iSearchCommands = [{
|
762
|
-
name: "restartSearch",
|
763
|
-
bindKey: {win: "Ctrl-F", mac: "Command-F"},
|
764
|
-
exec: function(iSearch) {
|
765
|
-
iSearch.cancelSearch(true);
|
766
|
-
},
|
767
|
-
readOnly: true,
|
768
|
-
isIncrementalSearchCommand: true
|
769
|
-
}, {
|
770
|
-
name: "searchForward",
|
771
|
-
bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
|
772
|
-
exec: function(iSearch, options) {
|
773
|
-
options.useCurrentOrPrevSearch = true;
|
774
|
-
iSearch.next(options);
|
775
|
-
},
|
776
|
-
readOnly: true,
|
777
|
-
isIncrementalSearchCommand: true
|
778
|
-
}, {
|
779
|
-
name: "searchBackward",
|
780
|
-
bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
|
781
|
-
exec: function(iSearch, options) {
|
782
|
-
options.useCurrentOrPrevSearch = true;
|
783
|
-
options.backwards = true;
|
784
|
-
iSearch.next(options);
|
785
|
-
},
|
786
|
-
readOnly: true,
|
787
|
-
isIncrementalSearchCommand: true
|
788
|
-
}, {
|
789
|
-
name: "extendSearchTerm",
|
790
|
-
exec: function(iSearch, string) {
|
791
|
-
iSearch.addChar(string);
|
792
|
-
},
|
793
|
-
readOnly: true,
|
794
|
-
isIncrementalSearchCommand: true
|
795
|
-
}, {
|
796
|
-
name: "extendSearchTermSpace",
|
797
|
-
bindKey: "space",
|
798
|
-
exec: function(iSearch) { iSearch.addChar(' '); },
|
799
|
-
readOnly: true,
|
800
|
-
isIncrementalSearchCommand: true
|
801
|
-
}, {
|
802
|
-
name: "shrinkSearchTerm",
|
803
|
-
bindKey: "backspace",
|
804
|
-
exec: function(iSearch) {
|
805
|
-
iSearch.removeChar();
|
806
|
-
},
|
807
|
-
readOnly: true,
|
808
|
-
isIncrementalSearchCommand: true
|
809
|
-
}, {
|
810
|
-
name: 'confirmSearch',
|
811
|
-
bindKey: 'return',
|
812
|
-
exec: function(iSearch) { iSearch.deactivate(); },
|
813
|
-
readOnly: true,
|
814
|
-
isIncrementalSearchCommand: true
|
815
|
-
}, {
|
816
|
-
name: 'cancelSearch',
|
817
|
-
bindKey: 'esc|Ctrl-G',
|
818
|
-
exec: function(iSearch) { iSearch.deactivate(true); },
|
819
|
-
readOnly: true,
|
820
|
-
isIncrementalSearchCommand: true
|
821
|
-
}, {
|
822
|
-
name: 'occurisearch',
|
823
|
-
bindKey: 'Ctrl-O',
|
824
|
-
exec: function(iSearch) {
|
825
|
-
var options = oop.mixin({}, iSearch.$options);
|
826
|
-
iSearch.deactivate();
|
827
|
-
occurStartCommand.exec(iSearch.$editor, options);
|
828
|
-
},
|
829
|
-
readOnly: true,
|
830
|
-
isIncrementalSearchCommand: true
|
831
|
-
}];
|
832
|
-
|
833
|
-
function IncrementalSearchKeyboardHandler(iSearch) {
|
834
|
-
this.$iSearch = iSearch;
|
835
|
-
}
|
836
|
-
|
837
|
-
oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
|
838
|
-
|
839
|
-
;(function() {
|
560
|
+
var dom = require("../lib/dom");
|
561
|
+
require("../incremental_search");
|
562
|
+
var iSearchCommandModule = require("../commands/incremental_search_commands");
|
840
563
|
|
841
|
-
this.attach = function(editor) {
|
842
|
-
var iSearch = this.$iSearch;
|
843
|
-
HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
|
844
|
-
this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
|
845
|
-
if (!e.command.isIncrementalSearchCommand) return undefined;
|
846
|
-
e.stopPropagation();
|
847
|
-
e.preventDefault();
|
848
|
-
return e.command.exec(iSearch, e.args || {});
|
849
|
-
});
|
850
|
-
}
|
851
564
|
|
852
|
-
|
853
|
-
|
854
|
-
editor.commands.removeEventListener('exec', this.$commandExecHandler);
|
855
|
-
delete this.$commandExecHandler;
|
856
|
-
}
|
565
|
+
var screenToTextBlockCoordinates = function(x, y) {
|
566
|
+
var canvasPos = this.scroller.getBoundingClientRect();
|
857
567
|
|
858
|
-
var
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
if (extendCmd) { return {command: extendCmd, args: key}; }
|
865
|
-
}
|
866
|
-
return {command: "null", passEvent: hashId == 0 || hashId == 4};
|
867
|
-
}
|
568
|
+
var col = Math.floor(
|
569
|
+
(x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
|
570
|
+
);
|
571
|
+
var row = Math.floor(
|
572
|
+
(y + this.scrollTop - canvasPos.top) / this.lineHeight
|
573
|
+
);
|
868
574
|
|
869
|
-
|
575
|
+
return this.session.screenToDocumentPosition(row, col);
|
576
|
+
};
|
870
577
|
|
578
|
+
var HashHandler = require("./hash_handler").HashHandler;
|
579
|
+
exports.handler = new HashHandler();
|
871
580
|
|
872
|
-
exports.
|
581
|
+
exports.handler.isEmacs = true;
|
582
|
+
exports.handler.$id = "ace/keyboard/emacs";
|
873
583
|
|
874
|
-
|
584
|
+
var initialized = false;
|
585
|
+
var $formerLongWords;
|
586
|
+
var $formerLineStart;
|
875
587
|
|
876
|
-
|
588
|
+
exports.handler.attach = function(editor) {
|
589
|
+
if (!initialized) {
|
590
|
+
initialized = true;
|
591
|
+
dom.importCssString('\
|
592
|
+
.emacs-mode .ace_cursor{\
|
593
|
+
border: 2px rgba(50,250,50,0.8) solid!important;\
|
594
|
+
-moz-box-sizing: border-box!important;\
|
595
|
+
-webkit-box-sizing: border-box!important;\
|
596
|
+
box-sizing: border-box!important;\
|
597
|
+
background-color: rgba(0,250,0,0.9);\
|
598
|
+
opacity: 0.5;\
|
599
|
+
}\
|
600
|
+
.emacs-mode .ace_hidden-cursors .ace_cursor{\
|
601
|
+
opacity: 1;\
|
602
|
+
background-color: transparent;\
|
603
|
+
}\
|
604
|
+
.emacs-mode .ace_overwrite-cursors .ace_cursor {\
|
605
|
+
opacity: 1;\
|
606
|
+
background-color: transparent;\
|
607
|
+
border-width: 0 0 2px 2px !important;\
|
608
|
+
}\
|
609
|
+
.emacs-mode .ace_text-layer {\
|
610
|
+
z-index: 4\
|
611
|
+
}\
|
612
|
+
.emacs-mode .ace_cursor-layer {\
|
613
|
+
z-index: 2\
|
614
|
+
}', 'emacsMode'
|
615
|
+
);
|
616
|
+
}
|
617
|
+
$formerLongWords = editor.session.$selectLongWords;
|
618
|
+
editor.session.$selectLongWords = true;
|
619
|
+
$formerLineStart = editor.session.$useEmacsStyleLineStart;
|
620
|
+
editor.session.$useEmacsStyleLineStart = true;
|
877
621
|
|
878
|
-
|
879
|
-
|
880
|
-
var occurStartCommand = {
|
881
|
-
name: "occur",
|
882
|
-
exec: function(editor, options) {
|
883
|
-
var alreadyInOccur = !!editor.session.$occur;
|
884
|
-
var occurSessionActive = new Occur().enter(editor, options);
|
885
|
-
if (occurSessionActive && !alreadyInOccur)
|
886
|
-
OccurKeyboardHandler.installIn(editor);
|
887
|
-
},
|
888
|
-
readOnly: true
|
889
|
-
};
|
622
|
+
editor.session.$emacsMark = null; // the active mark
|
623
|
+
editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];
|
890
624
|
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
exec: function(editor) {
|
895
|
-
var occur = editor.session.$occur;
|
896
|
-
if (!occur) return;
|
897
|
-
occur.exit(editor, {});
|
898
|
-
if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
|
899
|
-
},
|
900
|
-
readOnly: true
|
901
|
-
}, {
|
902
|
-
name: "occuraccept",
|
903
|
-
bindKey: 'enter',
|
904
|
-
exec: function(editor) {
|
905
|
-
var occur = editor.session.$occur;
|
906
|
-
if (!occur) return;
|
907
|
-
occur.exit(editor, {translatePosition: true});
|
908
|
-
if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
|
909
|
-
},
|
910
|
-
readOnly: true
|
911
|
-
}];
|
625
|
+
editor.emacsMark = function() {
|
626
|
+
return this.session.$emacsMark;
|
627
|
+
};
|
912
628
|
|
913
|
-
|
914
|
-
|
629
|
+
editor.setEmacsMark = function(p) {
|
630
|
+
this.session.$emacsMark = p;
|
631
|
+
};
|
915
632
|
|
633
|
+
editor.pushEmacsMark = function(p, activate) {
|
634
|
+
var prevMark = this.session.$emacsMark;
|
635
|
+
if (prevMark)
|
636
|
+
this.session.$emacsMarkRing.push(prevMark);
|
637
|
+
if (!p || activate) this.setEmacsMark(p);
|
638
|
+
else this.session.$emacsMarkRing.push(p);
|
639
|
+
};
|
916
640
|
|
917
|
-
function
|
641
|
+
editor.popEmacsMark = function() {
|
642
|
+
var mark = this.emacsMark();
|
643
|
+
if (mark) { this.setEmacsMark(null); return mark; }
|
644
|
+
return this.session.$emacsMarkRing.pop();
|
645
|
+
};
|
918
646
|
|
919
|
-
|
647
|
+
editor.getLastEmacsMark = function(p) {
|
648
|
+
return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
|
649
|
+
};
|
920
650
|
|
921
|
-
|
651
|
+
editor.on("click", $resetMarkMode);
|
652
|
+
editor.on("changeSession", $kbSessionChange);
|
653
|
+
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
|
654
|
+
editor.setStyle("emacs-mode");
|
655
|
+
editor.commands.addCommands(commands);
|
656
|
+
exports.handler.platform = editor.commands.platform;
|
657
|
+
editor.$emacsModeHandler = this;
|
658
|
+
editor.addEventListener('copy', this.onCopy);
|
659
|
+
editor.addEventListener('paste', this.onPaste);
|
660
|
+
};
|
922
661
|
|
923
|
-
|
662
|
+
exports.handler.detach = function(editor) {
|
663
|
+
delete editor.renderer.screenToTextCoordinates;
|
664
|
+
editor.session.$selectLongWords = $formerLongWords;
|
665
|
+
editor.session.$useEmacsStyleLineStart = $formerLineStart;
|
666
|
+
editor.removeEventListener("click", $resetMarkMode);
|
667
|
+
editor.removeEventListener("changeSession", $kbSessionChange);
|
668
|
+
editor.unsetStyle("emacs-mode");
|
669
|
+
editor.commands.removeCommands(commands);
|
670
|
+
editor.removeEventListener('copy', this.onCopy);
|
671
|
+
editor.removeEventListener('paste', this.onPaste);
|
672
|
+
};
|
924
673
|
|
925
|
-
|
926
|
-
|
927
|
-
|
674
|
+
var $kbSessionChange = function(e) {
|
675
|
+
if (e.oldSession) {
|
676
|
+
e.oldSession.$selectLongWords = $formerLongWords;
|
677
|
+
e.oldSession.$useEmacsStyleLineStart = $formerLineStart;
|
928
678
|
}
|
929
679
|
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
}
|
935
|
-
|
936
|
-
}).call(OccurKeyboardHandler.prototype);
|
937
|
-
|
938
|
-
OccurKeyboardHandler.installIn = function(editor) {
|
939
|
-
var handler = new this();
|
940
|
-
editor.keyBinding.addKeyboardHandler(handler);
|
941
|
-
editor.commands.addCommands(occurCommands);
|
942
|
-
}
|
680
|
+
$formerLongWords = e.session.$selectLongWords;
|
681
|
+
e.session.$selectLongWords = true;
|
682
|
+
$formerLineStart = e.session.$useEmacsStyleLineStart;
|
683
|
+
e.session.$useEmacsStyleLineStart = true;
|
943
684
|
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
}
|
685
|
+
if (!e.session.hasOwnProperty('$emacsMark'))
|
686
|
+
e.session.$emacsMark = null;
|
687
|
+
if (!e.session.hasOwnProperty('$emacsMarkRing'))
|
688
|
+
e.session.$emacsMarkRing = [];
|
689
|
+
};
|
950
690
|
|
951
|
-
|
691
|
+
var $resetMarkMode = function(e) {
|
692
|
+
e.editor.session.$emacsMark = null;
|
693
|
+
};
|
952
694
|
|
695
|
+
var keys = require("../lib/keys").KEY_MODS;
|
696
|
+
var eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"};
|
697
|
+
var combinations = ["C-S-M-CMD",
|
698
|
+
"S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
|
699
|
+
"M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
|
700
|
+
"CMD", "M", "S", "C"];
|
701
|
+
combinations.forEach(function(c) {
|
702
|
+
var hashId = 0;
|
703
|
+
c.split("-").forEach(function(c) {
|
704
|
+
hashId = hashId | keys[eMods[c]];
|
705
|
+
});
|
706
|
+
eMods[hashId] = c.toLowerCase() + "-";
|
953
707
|
});
|
954
708
|
|
955
|
-
|
709
|
+
exports.handler.onCopy = function(e, editor) {
|
710
|
+
if (editor.$handlesEmacsOnCopy) return;
|
711
|
+
editor.$handlesEmacsOnCopy = true;
|
712
|
+
exports.handler.commands.killRingSave.exec(editor);
|
713
|
+
delete editor.$handlesEmacsOnCopy;
|
714
|
+
};
|
956
715
|
|
716
|
+
exports.handler.onPaste = function(e, editor) {
|
717
|
+
editor.pushEmacsMark(editor.getCursorPosition());
|
718
|
+
};
|
957
719
|
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
var EditSession = require("./edit_session").EditSession;
|
962
|
-
var SearchHighlight = require("./search_highlight").SearchHighlight;
|
963
|
-
function Occur() {}
|
720
|
+
exports.handler.bindKey = function(key, command) {
|
721
|
+
if (!key)
|
722
|
+
return;
|
964
723
|
|
965
|
-
|
724
|
+
var ckb = this.commandKeyBinding;
|
725
|
+
key.split("|").forEach(function(keyPart) {
|
726
|
+
keyPart = keyPart.toLowerCase();
|
727
|
+
ckb[keyPart] = command;
|
728
|
+
var keyParts = keyPart.split(" ").slice(0,-1);
|
729
|
+
keyParts.reduce(function(keyMapKeys, keyPart, i) {
|
730
|
+
var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : '';
|
731
|
+
return keyMapKeys.concat([prefix + keyPart]);
|
732
|
+
}, []).forEach(function(keyPart) {
|
733
|
+
if (!ckb[keyPart]) ckb[keyPart] = "null";
|
734
|
+
});
|
735
|
+
}, this);
|
736
|
+
};
|
966
737
|
|
967
|
-
|
968
|
-
|
969
|
-
if (!options.needle) return false;
|
970
|
-
var pos = editor.getCursorPosition();
|
971
|
-
this.displayOccurContent(editor, options);
|
972
|
-
var translatedPos = this.originalToOccurPosition(editor.session, pos);
|
973
|
-
editor.moveCursorToPosition(translatedPos);
|
974
|
-
return true;
|
975
|
-
}
|
976
|
-
this.exit = function(editor, options) {
|
977
|
-
var pos = options.translatePosition && editor.getCursorPosition();
|
978
|
-
var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
|
979
|
-
this.displayOriginalContent(editor);
|
980
|
-
if (translatedPos)
|
981
|
-
editor.moveCursorToPosition(translatedPos);
|
982
|
-
return true;
|
983
|
-
}
|
738
|
+
exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
|
739
|
+
if (keyCode === -1) return undefined;
|
984
740
|
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
741
|
+
var editor = data.editor;
|
742
|
+
if (hashId == -1) {
|
743
|
+
editor.pushEmacsMark();
|
744
|
+
if (data.count) {
|
745
|
+
var str = new Array(data.count + 1).join(key);
|
746
|
+
data.count = null;
|
747
|
+
return {command: "insertstring", args: str};
|
748
|
+
}
|
990
749
|
}
|
991
750
|
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
var
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
751
|
+
if (key == "\x00") return undefined;
|
752
|
+
|
753
|
+
var modifier = eMods[hashId];
|
754
|
+
if (modifier == "c-" || data.universalArgument) {
|
755
|
+
var prevCount = String(data.count || 0);
|
756
|
+
var count = parseInt(key[key.length - 1]);
|
757
|
+
if (typeof count === 'number' && !isNaN(count)) {
|
758
|
+
data.count = parseInt(prevCount + count);
|
759
|
+
return {command: "null"};
|
760
|
+
} else if (data.universalArgument) {
|
761
|
+
data.count = 4;
|
762
|
+
}
|
1002
763
|
}
|
764
|
+
data.universalArgument = false;
|
765
|
+
if (modifier) key = modifier + key;
|
766
|
+
if (data.keyChain) key = data.keyChain += " " + key;
|
767
|
+
var command = this.commandKeyBinding[key];
|
768
|
+
data.keyChain = command == "null" ? key : "";
|
769
|
+
if (!command) return undefined;
|
770
|
+
if (command === "null") return {command: "null"};
|
1003
771
|
|
1004
|
-
|
1005
|
-
|
772
|
+
if (command === "universalArgument") {
|
773
|
+
data.universalArgument = true;
|
774
|
+
return {command: "null"};
|
1006
775
|
}
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
if (
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
776
|
+
var args;
|
777
|
+
if (typeof command !== "string") {
|
778
|
+
args = command.args;
|
779
|
+
if (command.command) command = command.command;
|
780
|
+
if (command === "goorselect") {
|
781
|
+
command = editor.emacsMark() ? args[1] : args[0];
|
782
|
+
args = null;
|
1014
783
|
}
|
1015
|
-
return nullPos;
|
1016
784
|
}
|
1017
|
-
|
1018
|
-
|
1019
|
-
if (
|
1020
|
-
|
1021
|
-
|
785
|
+
|
786
|
+
if (typeof command === "string") {
|
787
|
+
if (command === "insertstring" ||
|
788
|
+
command === "splitline" ||
|
789
|
+
command === "togglecomment") {
|
790
|
+
editor.pushEmacsMark();
|
791
|
+
}
|
792
|
+
command = this.commands[command] || editor.commands.commands[command];
|
793
|
+
if (!command) return undefined;
|
1022
794
|
}
|
1023
795
|
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
796
|
+
if (!command.readOnly && !command.isYank)
|
797
|
+
data.lastCommand = null;
|
798
|
+
|
799
|
+
if (!command.readOnly && editor.emacsMark())
|
800
|
+
editor.setEmacsMark(null)
|
801
|
+
|
802
|
+
if (data.count) {
|
803
|
+
var count = data.count;
|
804
|
+
data.count = 0;
|
805
|
+
if (!command || !command.handlesCount) {
|
806
|
+
return {
|
807
|
+
args: args,
|
808
|
+
command: {
|
809
|
+
exec: function(editor, args) {
|
810
|
+
for (var i = 0; i < count; i++)
|
811
|
+
command.exec(editor, args);
|
812
|
+
}
|
813
|
+
}
|
814
|
+
};
|
815
|
+
} else {
|
816
|
+
if (!args) args = {};
|
817
|
+
if (typeof args === 'object') args.count = count;
|
818
|
+
}
|
1036
819
|
}
|
1037
820
|
|
1038
|
-
}
|
821
|
+
return {command: command, args: args};
|
822
|
+
};
|
1039
823
|
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
-
|
1047
|
-
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
}
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
824
|
+
exports.emacsKeys = {
|
825
|
+
"Up|C-p" : {command: "goorselect", args: ["golineup","selectup"]},
|
826
|
+
"Down|C-n" : {command: "goorselect", args: ["golinedown","selectdown"]},
|
827
|
+
"Left|C-b" : {command: "goorselect", args: ["gotoleft","selectleft"]},
|
828
|
+
"Right|C-f" : {command: "goorselect", args: ["gotoright","selectright"]},
|
829
|
+
"C-Left|M-b" : {command: "goorselect", args: ["gotowordleft","selectwordleft"]},
|
830
|
+
"C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]},
|
831
|
+
"Home|C-a" : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]},
|
832
|
+
"End|C-e" : {command: "goorselect", args: ["gotolineend","selecttolineend"]},
|
833
|
+
"C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]},
|
834
|
+
"C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]},
|
835
|
+
"S-Up|S-C-p" : "selectup",
|
836
|
+
"S-Down|S-C-n" : "selectdown",
|
837
|
+
"S-Left|S-C-b" : "selectleft",
|
838
|
+
"S-Right|S-C-f" : "selectright",
|
839
|
+
"S-C-Left|S-M-b" : "selectwordleft",
|
840
|
+
"S-C-Right|S-M-f" : "selectwordright",
|
841
|
+
"S-Home|S-C-a" : "selecttolinestart",
|
842
|
+
"S-End|S-C-e" : "selecttolineend",
|
843
|
+
"S-C-Home" : "selecttostart",
|
844
|
+
"S-C-End" : "selecttoend",
|
1055
845
|
|
1056
|
-
|
846
|
+
"C-l" : "recenterTopBottom",
|
847
|
+
"M-s" : "centerselection",
|
848
|
+
"M-g": "gotoline",
|
849
|
+
"C-x C-p": "selectall",
|
850
|
+
"C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
|
851
|
+
"C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]},
|
852
|
+
"PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
|
853
|
+
"PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]},
|
854
|
+
"S-C-Down": "selectpagedown",
|
855
|
+
"S-C-Up": "selectpageup",
|
856
|
+
|
857
|
+
"C-s": "iSearch",
|
858
|
+
"C-r": "iSearchBackwards",
|
859
|
+
|
860
|
+
"M-C-s": "findnext",
|
861
|
+
"M-C-r": "findprevious",
|
862
|
+
"S-M-5": "replace",
|
863
|
+
"Backspace": "backspace",
|
864
|
+
"Delete|C-d": "del",
|
865
|
+
"Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
|
866
|
+
"C-o": "splitline",
|
867
|
+
|
868
|
+
"M-d|C-Delete": {command: "killWord", args: "right"},
|
869
|
+
"C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
|
870
|
+
"C-k": "killLine",
|
871
|
+
|
872
|
+
"C-y|S-Delete": "yank",
|
873
|
+
"M-y": "yankRotate",
|
874
|
+
"C-g": "keyboardQuit",
|
875
|
+
|
876
|
+
"C-w|C-S-W": "killRegion",
|
877
|
+
"M-w": "killRingSave",
|
878
|
+
"C-Space": "setMark",
|
879
|
+
"C-x C-x": "exchangePointAndMark",
|
880
|
+
|
881
|
+
"C-t": "transposeletters",
|
882
|
+
"M-u": "touppercase", // Doesn't work
|
883
|
+
"M-l": "tolowercase",
|
884
|
+
"M-/": "autocomplete", // Doesn't work
|
885
|
+
"C-u": "universalArgument",
|
886
|
+
|
887
|
+
"M-;": "togglecomment",
|
888
|
+
|
889
|
+
"C-/|C-x u|S-C--|C-z": "undo",
|
890
|
+
"S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
|
891
|
+
"C-x r": "selectRectangularRegion",
|
892
|
+
"M-x": {command: "focusCommandLine", args: "M-x "}
|
893
|
+
};
|
894
|
+
|
895
|
+
|
896
|
+
exports.handler.bindKeys(exports.emacsKeys);
|
897
|
+
|
898
|
+
exports.handler.addCommands({
|
899
|
+
recenterTopBottom: function(editor) {
|
900
|
+
var renderer = editor.renderer;
|
901
|
+
var pos = renderer.$cursorLayer.getPixelPosition();
|
902
|
+
var h = renderer.$size.scrollerHeight - renderer.lineHeight;
|
903
|
+
var scrollTop = renderer.scrollTop;
|
904
|
+
if (Math.abs(pos.top - scrollTop) < 2) {
|
905
|
+
scrollTop = pos.top - h;
|
906
|
+
} else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
|
907
|
+
scrollTop = pos.top;
|
908
|
+
} else {
|
909
|
+
scrollTop = pos.top - h * 0.5;
|
910
|
+
}
|
911
|
+
editor.session.setScrollTop(scrollTop);
|
912
|
+
},
|
913
|
+
selectRectangularRegion: function(editor) {
|
914
|
+
editor.multiSelect.toggleBlockSelection();
|
915
|
+
},
|
916
|
+
setMark: {
|
917
|
+
exec: function(editor, args) {
|
918
|
+
if (args && args.count) {
|
919
|
+
var mark = editor.popEmacsMark();
|
920
|
+
mark && editor.selection.moveCursorToPosition(mark);
|
921
|
+
return;
|
922
|
+
}
|
923
|
+
|
924
|
+
var mark = editor.emacsMark(),
|
925
|
+
transientMarkModeActive = true;
|
926
|
+
if (transientMarkModeActive && (mark || !editor.selection.isEmpty())) {
|
927
|
+
editor.pushEmacsMark();
|
928
|
+
editor.clearSelection();
|
929
|
+
return;
|
930
|
+
}
|
931
|
+
|
932
|
+
if (mark) {
|
933
|
+
var cp = editor.getCursorPosition();
|
934
|
+
if (editor.selection.isEmpty() &&
|
935
|
+
mark.row == cp.row && mark.column == cp.column) {
|
936
|
+
editor.pushEmacsMark();
|
937
|
+
return;
|
938
|
+
}
|
939
|
+
}
|
940
|
+
mark = editor.getCursorPosition();
|
941
|
+
editor.setEmacsMark(mark);
|
942
|
+
editor.selection.setSelectionAnchor(mark.row, mark.column);
|
943
|
+
},
|
944
|
+
readOnly: true,
|
945
|
+
handlesCount: true,
|
946
|
+
multiSelectAction: "forEach"
|
947
|
+
},
|
948
|
+
exchangePointAndMark: {
|
949
|
+
exec: function(editor, args) {
|
950
|
+
var sel = editor.selection;
|
951
|
+
if (args.count) {
|
952
|
+
var pos = editor.getCursorPosition();
|
953
|
+
sel.clearSelection();
|
954
|
+
sel.moveCursorToPosition(editor.popEmacsMark());
|
955
|
+
editor.pushEmacsMark(pos);
|
956
|
+
return;
|
957
|
+
}
|
958
|
+
var lastMark = editor.getLastEmacsMark();
|
959
|
+
var range = sel.getRange();
|
960
|
+
if (range.isEmpty()) {
|
961
|
+
sel.selectToPosition(lastMark);
|
962
|
+
return;
|
963
|
+
}
|
964
|
+
sel.setSelectionRange(range, !sel.isBackwards());
|
965
|
+
},
|
966
|
+
readOnly: true,
|
967
|
+
handlesCount: true,
|
968
|
+
multiSelectAction: "forEach"
|
969
|
+
},
|
970
|
+
killWord: {
|
971
|
+
exec: function(editor, dir) {
|
972
|
+
editor.clearSelection();
|
973
|
+
if (dir == "left")
|
974
|
+
editor.selection.selectWordLeft();
|
975
|
+
else
|
976
|
+
editor.selection.selectWordRight();
|
977
|
+
|
978
|
+
var range = editor.getSelectionRange();
|
979
|
+
var text = editor.session.getTextRange(range);
|
980
|
+
exports.killRing.add(text);
|
981
|
+
|
982
|
+
editor.session.remove(range);
|
983
|
+
editor.clearSelection();
|
984
|
+
},
|
985
|
+
multiSelectAction: "forEach"
|
986
|
+
},
|
987
|
+
killLine: function(editor) {
|
988
|
+
editor.pushEmacsMark(null);
|
989
|
+
var pos = editor.getCursorPosition();
|
990
|
+
if (pos.column === 0 &&
|
991
|
+
editor.session.doc.getLine(pos.row).length === 0) {
|
992
|
+
editor.selection.selectLine();
|
993
|
+
} else {
|
994
|
+
editor.clearSelection();
|
995
|
+
editor.selection.selectLineEnd();
|
996
|
+
}
|
997
|
+
var range = editor.getSelectionRange();
|
998
|
+
var text = editor.session.getTextRange(range);
|
999
|
+
exports.killRing.add(text);
|
1000
|
+
|
1001
|
+
editor.session.remove(range);
|
1002
|
+
editor.clearSelection();
|
1003
|
+
},
|
1004
|
+
yank: function(editor) {
|
1005
|
+
editor.onPaste(exports.killRing.get() || '');
|
1006
|
+
editor.keyBinding.$data.lastCommand = "yank";
|
1007
|
+
},
|
1008
|
+
yankRotate: function(editor) {
|
1009
|
+
if (editor.keyBinding.$data.lastCommand != "yank")
|
1010
|
+
return;
|
1011
|
+
editor.undo();
|
1012
|
+
editor.onPaste(exports.killRing.rotate());
|
1013
|
+
editor.keyBinding.$data.lastCommand = "yank";
|
1014
|
+
},
|
1015
|
+
killRegion: {
|
1016
|
+
exec: function(editor) {
|
1017
|
+
exports.killRing.add(editor.getCopyText());
|
1018
|
+
editor.commands.byName.cut.exec(editor);
|
1019
|
+
},
|
1020
|
+
readOnly: true,
|
1021
|
+
multiSelectAction: "forEach"
|
1022
|
+
},
|
1023
|
+
killRingSave: {
|
1024
|
+
exec: function(editor) {
|
1025
|
+
exports.killRing.add(editor.getCopyText());
|
1026
|
+
setTimeout(function() {
|
1027
|
+
var sel = editor.selection,
|
1028
|
+
range = sel.getRange();
|
1029
|
+
editor.pushEmacsMark(sel.isBackwards() ? range.end : range.start);
|
1030
|
+
sel.clearSelection();
|
1031
|
+
}, 0);
|
1032
|
+
},
|
1033
|
+
readOnly: true
|
1034
|
+
},
|
1035
|
+
keyboardQuit: function(editor) {
|
1036
|
+
editor.selection.clearSelection();
|
1037
|
+
editor.setEmacsMark(null);
|
1038
|
+
},
|
1039
|
+
focusCommandLine: function(editor, arg) {
|
1040
|
+
if (editor.showCommandLine)
|
1041
|
+
editor.showCommandLine(arg);
|
1042
|
+
}
|
1043
|
+
});
|
1044
|
+
|
1045
|
+
exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
|
1046
|
+
|
1047
|
+
var commands = exports.handler.commands;
|
1048
|
+
commands.yank.isYank = true;
|
1049
|
+
commands.yankRotate.isYank = true;
|
1050
|
+
|
1051
|
+
exports.killRing = {
|
1052
|
+
$data: [],
|
1053
|
+
add: function(str) {
|
1054
|
+
str && this.$data.push(str);
|
1055
|
+
if (this.$data.length > 30)
|
1056
|
+
this.$data.shift();
|
1057
|
+
},
|
1058
|
+
get: function(n) {
|
1059
|
+
n = n || 1;
|
1060
|
+
return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n');
|
1061
|
+
},
|
1062
|
+
pop: function() {
|
1063
|
+
if (this.$data.length > 1)
|
1064
|
+
this.$data.pop();
|
1065
|
+
return this.get();
|
1066
|
+
},
|
1067
|
+
rotate: function() {
|
1068
|
+
this.$data.unshift(this.$data.pop());
|
1069
|
+
return this.get();
|
1070
|
+
}
|
1071
|
+
};
|
1057
1072
|
|
1058
1073
|
});
|