ace-rails-ap 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace.js +15680 -1
- data/vendor/assets/javascripts/keybinding-emacs.js +367 -1
- data/vendor/assets/javascripts/keybinding-vim.js +1635 -1
- data/vendor/assets/javascripts/mode-c9search.js +275 -0
- data/vendor/assets/javascripts/mode-c_cpp.js +744 -1
- data/vendor/assets/javascripts/mode-clojure.js +364 -1
- data/vendor/assets/javascripts/mode-coffee.js +527 -1
- data/vendor/assets/javascripts/mode-coldfusion.js +1966 -1
- data/vendor/assets/javascripts/mode-csharp.js +633 -1
- data/vendor/assets/javascripts/mode-css.js +499 -1
- data/vendor/assets/javascripts/mode-diff.js +250 -0
- data/vendor/assets/javascripts/{mode-c_cpp-uncompressed.js → mode-glsl.js} +147 -244
- data/vendor/assets/javascripts/mode-golang.js +681 -1
- data/vendor/assets/javascripts/mode-groovy.js +1240 -1
- data/vendor/assets/javascripts/mode-haxe.js +633 -1
- data/vendor/assets/javascripts/mode-html.js +2064 -1
- data/vendor/assets/javascripts/mode-java.js +1202 -1
- data/vendor/assets/javascripts/mode-javascript.js +1069 -1
- data/vendor/assets/javascripts/mode-json.js +588 -1
- data/vendor/assets/javascripts/{mode-haxe-uncompressed.js → mode-jsx.js} +189 -312
- data/vendor/assets/javascripts/mode-latex.js +95 -1
- data/vendor/assets/javascripts/mode-less.js +512 -1
- data/vendor/assets/javascripts/mode-liquid.js +1125 -1
- data/vendor/assets/javascripts/mode-lua.js +551 -1
- data/vendor/assets/javascripts/{mode-html-uncompressed.js → mode-luahtml.js} +544 -604
- data/vendor/assets/javascripts/{mode-coldfusion-uncompressed.js → mode-luapage.js} +2326 -2180
- data/vendor/assets/javascripts/mode-markdown.js +2369 -1
- data/vendor/assets/javascripts/mode-ocaml.js +464 -1
- data/vendor/assets/javascripts/mode-perl.js +432 -1
- data/vendor/assets/javascripts/mode-pgsql.js +970 -1
- data/vendor/assets/javascripts/mode-php.js +1718 -1
- data/vendor/assets/javascripts/mode-powershell.js +610 -1
- data/vendor/assets/javascripts/mode-python.js +397 -1
- data/vendor/assets/javascripts/mode-ruby.js +318 -1
- data/vendor/assets/javascripts/mode-scad.js +732 -1
- data/vendor/assets/javascripts/mode-scala.js +1237 -1
- data/vendor/assets/javascripts/mode-scss.js +537 -1
- data/vendor/assets/javascripts/mode-sh.js +250 -1
- data/vendor/assets/javascripts/mode-sql.js +140 -1
- data/vendor/assets/javascripts/mode-svg.js +1681 -1
- data/vendor/assets/javascripts/mode-tcl.js +320 -0
- data/vendor/assets/javascripts/mode-textile.js +182 -1
- data/vendor/assets/javascripts/mode-xml.js +829 -1
- data/vendor/assets/javascripts/mode-xquery.js +605 -1
- data/vendor/assets/javascripts/mode-yaml.js +189 -0
- data/vendor/assets/javascripts/theme-chrome.js +213 -1
- data/vendor/assets/javascripts/theme-clouds.js +167 -1
- data/vendor/assets/javascripts/theme-clouds_midnight.js +168 -1
- data/vendor/assets/javascripts/theme-cobalt.js +194 -1
- data/vendor/assets/javascripts/theme-crimson_editor.js +200 -1
- data/vendor/assets/javascripts/theme-dawn.js +198 -1
- data/vendor/assets/javascripts/theme-dreamweaver.js +230 -1
- data/vendor/assets/javascripts/theme-eclipse.js +157 -1
- data/vendor/assets/javascripts/theme-github.js +182 -0
- data/vendor/assets/javascripts/theme-idle_fingers.js +186 -1
- data/vendor/assets/javascripts/theme-kr_theme.js +189 -1
- data/vendor/assets/javascripts/theme-merbivore.js +189 -1
- data/vendor/assets/javascripts/theme-merbivore_soft.js +195 -1
- data/vendor/assets/javascripts/theme-mono_industrial.js +197 -1
- data/vendor/assets/javascripts/theme-monokai.js +194 -1
- data/vendor/assets/javascripts/theme-pastel_on_dark.js +199 -1
- data/vendor/assets/javascripts/theme-solarized_dark.js +180 -1
- data/vendor/assets/javascripts/theme-solarized_light.js +179 -1
- data/vendor/assets/javascripts/theme-textmate.js +216 -0
- data/vendor/assets/javascripts/theme-tomorrow.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_blue.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_bright.js +213 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties.js +209 -1
- data/vendor/assets/javascripts/theme-twilight.js +211 -1
- data/vendor/assets/javascripts/theme-vibrant_ink.js +190 -1
- data/vendor/assets/javascripts/worker-coffee.js +83 -893
- data/vendor/assets/javascripts/worker-css.js +88 -1402
- data/vendor/assets/javascripts/worker-javascript.js +97 -812
- data/vendor/assets/javascripts/worker-json.js +84 -761
- data/vendor/assets/javascripts/worker-xquery.js +66464 -0
- metadata +12 -195
- data/vendor/assets/javascripts/ace-compat-noconflict.js +0 -1
- data/vendor/assets/javascripts/ace-compat-uncompressed-noconflict.js +0 -480
- data/vendor/assets/javascripts/ace-compat-uncompressed.js +0 -480
- data/vendor/assets/javascripts/ace-compat.js +0 -1
- data/vendor/assets/javascripts/ace-noconflict.js +0 -10
- data/vendor/assets/javascripts/ace-uncompressed-noconflict.js +0 -19976
- data/vendor/assets/javascripts/ace-uncompressed.js +0 -19976
- data/vendor/assets/javascripts/keybinding-emacs-noconflict.js +0 -1
- data/vendor/assets/javascripts/keybinding-emacs-uncompressed-noconflict.js +0 -150
- data/vendor/assets/javascripts/keybinding-emacs-uncompressed.js +0 -150
- data/vendor/assets/javascripts/keybinding-vim-noconflict.js +0 -1
- data/vendor/assets/javascripts/keybinding-vim-uncompressed-noconflict.js +0 -138
- data/vendor/assets/javascripts/keybinding-vim-uncompressed.js +0 -138
- data/vendor/assets/javascripts/mode-c_cpp-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-c_cpp-uncompressed-noconflict.js +0 -919
- data/vendor/assets/javascripts/mode-clojure-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-clojure-uncompressed-noconflict.js +0 -422
- data/vendor/assets/javascripts/mode-clojure-uncompressed.js +0 -422
- data/vendor/assets/javascripts/mode-coffee-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-coffee-uncompressed-noconflict.js +0 -607
- data/vendor/assets/javascripts/mode-coffee-uncompressed.js +0 -607
- data/vendor/assets/javascripts/mode-coldfusion-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-coldfusion-uncompressed-noconflict.js +0 -2458
- data/vendor/assets/javascripts/mode-csharp-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-csharp-uncompressed-noconflict.js +0 -769
- data/vendor/assets/javascripts/mode-csharp-uncompressed.js +0 -769
- data/vendor/assets/javascripts/mode-css-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-css-uncompressed-noconflict.js +0 -641
- data/vendor/assets/javascripts/mode-css-uncompressed.js +0 -641
- data/vendor/assets/javascripts/mode-golang-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-golang-uncompressed-noconflict.js +0 -378
- data/vendor/assets/javascripts/mode-golang-uncompressed.js +0 -378
- data/vendor/assets/javascripts/mode-groovy-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-groovy-uncompressed-noconflict.js +0 -1393
- data/vendor/assets/javascripts/mode-groovy-uncompressed.js +0 -1393
- data/vendor/assets/javascripts/mode-haxe-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-haxe-uncompressed-noconflict.js +0 -769
- data/vendor/assets/javascripts/mode-html-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-html-uncompressed-noconflict.js +0 -2475
- data/vendor/assets/javascripts/mode-java-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-java-uncompressed-noconflict.js +0 -1395
- data/vendor/assets/javascripts/mode-java-uncompressed.js +0 -1395
- data/vendor/assets/javascripts/mode-javascript-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-javascript-uncompressed-noconflict.js +0 -1226
- data/vendor/assets/javascripts/mode-javascript-uncompressed.js +0 -1226
- data/vendor/assets/javascripts/mode-json-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-json-uncompressed-noconflict.js +0 -701
- data/vendor/assets/javascripts/mode-json-uncompressed.js +0 -701
- data/vendor/assets/javascripts/mode-latex-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-latex-uncompressed-noconflict.js +0 -95
- data/vendor/assets/javascripts/mode-latex-uncompressed.js +0 -95
- data/vendor/assets/javascripts/mode-less-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-less-uncompressed-noconflict.js +0 -655
- data/vendor/assets/javascripts/mode-less-uncompressed.js +0 -655
- data/vendor/assets/javascripts/mode-liquid-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-liquid-uncompressed-noconflict.js +0 -1353
- data/vendor/assets/javascripts/mode-liquid-uncompressed.js +0 -1353
- data/vendor/assets/javascripts/mode-lua-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-lua-uncompressed-noconflict.js +0 -523
- data/vendor/assets/javascripts/mode-lua-uncompressed.js +0 -523
- data/vendor/assets/javascripts/mode-markdown-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-markdown-uncompressed-noconflict.js +0 -2925
- data/vendor/assets/javascripts/mode-markdown-uncompressed.js +0 -2925
- data/vendor/assets/javascripts/mode-ocaml-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-ocaml-uncompressed-noconflict.js +0 -539
- data/vendor/assets/javascripts/mode-ocaml-uncompressed.js +0 -539
- data/vendor/assets/javascripts/mode-perl-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-perl-uncompressed-noconflict.js +0 -574
- data/vendor/assets/javascripts/mode-perl-uncompressed.js +0 -574
- data/vendor/assets/javascripts/mode-pgsql-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-pgsql-uncompressed-noconflict.js +0 -1104
- data/vendor/assets/javascripts/mode-pgsql-uncompressed.js +0 -1104
- data/vendor/assets/javascripts/mode-php-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-php-uncompressed-noconflict.js +0 -1885
- data/vendor/assets/javascripts/mode-php-uncompressed.js +0 -1885
- data/vendor/assets/javascripts/mode-powershell-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-powershell-uncompressed-noconflict.js +0 -710
- data/vendor/assets/javascripts/mode-powershell-uncompressed.js +0 -710
- data/vendor/assets/javascripts/mode-python-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-python-uncompressed-noconflict.js +0 -507
- data/vendor/assets/javascripts/mode-python-uncompressed.js +0 -507
- data/vendor/assets/javascripts/mode-ruby-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-ruby-uncompressed-noconflict.js +0 -391
- data/vendor/assets/javascripts/mode-ruby-uncompressed.js +0 -391
- data/vendor/assets/javascripts/mode-scad-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-scad-uncompressed-noconflict.js +0 -907
- data/vendor/assets/javascripts/mode-scad-uncompressed.js +0 -907
- data/vendor/assets/javascripts/mode-scala-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-scala-uncompressed-noconflict.js +0 -1395
- data/vendor/assets/javascripts/mode-scala-uncompressed.js +0 -1395
- data/vendor/assets/javascripts/mode-scss-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-scss-uncompressed-noconflict.js +0 -679
- data/vendor/assets/javascripts/mode-scss-uncompressed.js +0 -679
- data/vendor/assets/javascripts/mode-sh-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-sh-uncompressed-noconflict.js +0 -289
- data/vendor/assets/javascripts/mode-sh-uncompressed.js +0 -289
- data/vendor/assets/javascripts/mode-sql-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-sql-uncompressed-noconflict.js +0 -159
- data/vendor/assets/javascripts/mode-sql-uncompressed.js +0 -159
- data/vendor/assets/javascripts/mode-svg-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-svg-uncompressed-noconflict.js +0 -2137
- data/vendor/assets/javascripts/mode-svg-uncompressed.js +0 -2137
- data/vendor/assets/javascripts/mode-text-noconflict.js +0 -0
- data/vendor/assets/javascripts/mode-text-uncompressed-noconflict.js +0 -0
- data/vendor/assets/javascripts/mode-text-uncompressed.js +0 -0
- data/vendor/assets/javascripts/mode-textile-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-textile-uncompressed-noconflict.js +0 -254
- data/vendor/assets/javascripts/mode-textile-uncompressed.js +0 -254
- data/vendor/assets/javascripts/mode-xml-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-xml-uncompressed-noconflict.js +0 -1012
- data/vendor/assets/javascripts/mode-xml-uncompressed.js +0 -1012
- data/vendor/assets/javascripts/mode-xquery-noconflict.js +0 -1
- data/vendor/assets/javascripts/mode-xquery-uncompressed-noconflict.js +0 -540
- data/vendor/assets/javascripts/mode-xquery-uncompressed.js +0 -540
- data/vendor/assets/javascripts/theme-chrome-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-chrome-uncompressed-noconflict.js +0 -207
- data/vendor/assets/javascripts/theme-chrome-uncompressed.js +0 -207
- data/vendor/assets/javascripts/theme-clouds-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-clouds-uncompressed-noconflict.js +0 -160
- data/vendor/assets/javascripts/theme-clouds-uncompressed.js +0 -160
- data/vendor/assets/javascripts/theme-clouds_midnight-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed-noconflict.js +0 -161
- data/vendor/assets/javascripts/theme-clouds_midnight-uncompressed.js +0 -161
- data/vendor/assets/javascripts/theme-cobalt-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-cobalt-uncompressed-noconflict.js +0 -187
- data/vendor/assets/javascripts/theme-cobalt-uncompressed.js +0 -187
- data/vendor/assets/javascripts/theme-crimson_editor-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-crimson_editor-uncompressed-noconflict.js +0 -198
- data/vendor/assets/javascripts/theme-crimson_editor-uncompressed.js +0 -198
- data/vendor/assets/javascripts/theme-dawn-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-dawn-uncompressed-noconflict.js +0 -191
- data/vendor/assets/javascripts/theme-dawn-uncompressed.js +0 -191
- data/vendor/assets/javascripts/theme-dreamweaver-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-dreamweaver-uncompressed-noconflict.js +0 -227
- data/vendor/assets/javascripts/theme-dreamweaver-uncompressed.js +0 -227
- data/vendor/assets/javascripts/theme-eclipse-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-eclipse-uncompressed-noconflict.js +0 -147
- data/vendor/assets/javascripts/theme-eclipse-uncompressed.js +0 -147
- data/vendor/assets/javascripts/theme-idle_fingers-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-idle_fingers-uncompressed-noconflict.js +0 -179
- data/vendor/assets/javascripts/theme-idle_fingers-uncompressed.js +0 -179
- data/vendor/assets/javascripts/theme-kr_theme-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-kr_theme-uncompressed-noconflict.js +0 -182
- data/vendor/assets/javascripts/theme-kr_theme-uncompressed.js +0 -182
- data/vendor/assets/javascripts/theme-merbivore-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-merbivore-uncompressed-noconflict.js +0 -182
- data/vendor/assets/javascripts/theme-merbivore-uncompressed.js +0 -182
- data/vendor/assets/javascripts/theme-merbivore_soft-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed-noconflict.js +0 -188
- data/vendor/assets/javascripts/theme-merbivore_soft-uncompressed.js +0 -188
- data/vendor/assets/javascripts/theme-mono_industrial-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-mono_industrial-uncompressed-noconflict.js +0 -190
- data/vendor/assets/javascripts/theme-mono_industrial-uncompressed.js +0 -190
- data/vendor/assets/javascripts/theme-monokai-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-monokai-uncompressed-noconflict.js +0 -191
- data/vendor/assets/javascripts/theme-monokai-uncompressed.js +0 -191
- data/vendor/assets/javascripts/theme-pastel_on_dark-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed-noconflict.js +0 -192
- data/vendor/assets/javascripts/theme-pastel_on_dark-uncompressed.js +0 -192
- data/vendor/assets/javascripts/theme-solarized_dark-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-solarized_dark-uncompressed-noconflict.js +0 -176
- data/vendor/assets/javascripts/theme-solarized_dark-uncompressed.js +0 -176
- data/vendor/assets/javascripts/theme-solarized_light-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-solarized_light-uncompressed-noconflict.js +0 -172
- data/vendor/assets/javascripts/theme-solarized_light-uncompressed.js +0 -172
- data/vendor/assets/javascripts/theme-textmate-noconflict.js +0 -0
- data/vendor/assets/javascripts/theme-textmate-uncompressed-noconflict.js +0 -0
- data/vendor/assets/javascripts/theme-textmate-uncompressed.js +0 -0
- data/vendor/assets/javascripts/theme-tomorrow-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow-uncompressed-noconflict.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow-uncompressed.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed-noconflict.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night-uncompressed.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night_blue-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed-noconflict.js +0 -209
- data/vendor/assets/javascripts/theme-tomorrow_night_blue-uncompressed.js +0 -209
- data/vendor/assets/javascripts/theme-tomorrow_night_bright-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed-noconflict.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night_bright-uncompressed.js +0 -206
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed-noconflict.js +0 -202
- data/vendor/assets/javascripts/theme-tomorrow_night_eighties-uncompressed.js +0 -202
- data/vendor/assets/javascripts/theme-twilight-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-twilight-uncompressed-noconflict.js +0 -204
- data/vendor/assets/javascripts/theme-twilight-uncompressed.js +0 -204
- data/vendor/assets/javascripts/theme-vibrant_ink-noconflict.js +0 -1
- data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed-noconflict.js +0 -183
- data/vendor/assets/javascripts/theme-vibrant_ink-uncompressed.js +0 -183
@@ -1 +1,367 @@
|
|
1
|
-
|
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
|
+
* Harutyun Amirjanyan (harutyun@c9.io)
|
24
|
+
*
|
25
|
+
* Alternatively, the contents of this file may be used under the terms of
|
26
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
27
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
28
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
29
|
+
* of those above. If you wish to allow use of your version of this file only
|
30
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
31
|
+
* use your version of this file under the terms of the MPL, indicate your
|
32
|
+
* decision by deleting the provisions above and replace them with the notice
|
33
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
34
|
+
* the provisions above, a recipient may use your version of this file under
|
35
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
36
|
+
*
|
37
|
+
* ***** END LICENSE BLOCK ***** */
|
38
|
+
|
39
|
+
define('ace/keyboard/emacs', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
40
|
+
|
41
|
+
|
42
|
+
var dom = require("../lib/dom");
|
43
|
+
|
44
|
+
var screenToTextBlockCoordinates = function(pageX, pageY) {
|
45
|
+
var canvasPos = this.scroller.getBoundingClientRect();
|
46
|
+
|
47
|
+
var col = Math.floor(
|
48
|
+
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth
|
49
|
+
);
|
50
|
+
var row = Math.floor(
|
51
|
+
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight
|
52
|
+
);
|
53
|
+
|
54
|
+
return this.session.screenToDocumentPosition(row, col);
|
55
|
+
};
|
56
|
+
|
57
|
+
var HashHandler = require("./hash_handler").HashHandler;
|
58
|
+
exports.handler = new HashHandler();
|
59
|
+
|
60
|
+
var initialized = false;
|
61
|
+
exports.handler.attach = function(editor) {
|
62
|
+
if (!initialized) {
|
63
|
+
initialized = true;
|
64
|
+
dom.importCssString('\
|
65
|
+
.emacs-mode .ace_cursor{\
|
66
|
+
border: 2px rgba(50,250,50,0.8) solid!important;\
|
67
|
+
-moz-box-sizing: border-box!important;\
|
68
|
+
box-sizing: border-box!important;\
|
69
|
+
background-color: rgba(0,250,0,0.9);\
|
70
|
+
opacity: 0.5;\
|
71
|
+
}\
|
72
|
+
.emacs-mode .ace_cursor.ace_hidden{\
|
73
|
+
opacity: 1;\
|
74
|
+
background-color: transparent;\
|
75
|
+
}\
|
76
|
+
.emacs-mode .ace_cursor.ace_overwrite {\
|
77
|
+
opacity: 1;\
|
78
|
+
background-color: transparent;\
|
79
|
+
border-width: 0 0 2px 2px !important;\
|
80
|
+
}\
|
81
|
+
.emacs-mode .ace_text-layer {\
|
82
|
+
z-index: 4\
|
83
|
+
}\
|
84
|
+
.emacs-mode .ace_cursor-layer {\
|
85
|
+
z-index: 2\
|
86
|
+
}', 'emacsMode'
|
87
|
+
);
|
88
|
+
}
|
89
|
+
|
90
|
+
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
|
91
|
+
editor.setStyle("emacs-mode");
|
92
|
+
};
|
93
|
+
|
94
|
+
exports.handler.detach = function(editor) {
|
95
|
+
delete editor.renderer.screenToTextCoordinates;
|
96
|
+
editor.unsetStyle("emacs-mode");
|
97
|
+
};
|
98
|
+
|
99
|
+
|
100
|
+
var keys = require("../lib/keys").KEY_MODS;
|
101
|
+
var eMods = {
|
102
|
+
C: "ctrl", S: "shift", M: "alt"
|
103
|
+
};
|
104
|
+
["S-C-M", "S-C", "S-M", "C-M", "S", "C", "M"].forEach(function(c) {
|
105
|
+
var hashId = 0;
|
106
|
+
c.split("-").forEach(function(c){
|
107
|
+
hashId = hashId | keys[eMods[c]];
|
108
|
+
});
|
109
|
+
eMods[hashId] = c.toLowerCase() + "-";
|
110
|
+
});
|
111
|
+
|
112
|
+
exports.handler.bindKey = function(key, command) {
|
113
|
+
if (!key)
|
114
|
+
return;
|
115
|
+
|
116
|
+
var ckb = this.commmandKeyBinding;
|
117
|
+
key.split("|").forEach(function(keyPart) {
|
118
|
+
keyPart = keyPart.toLowerCase();
|
119
|
+
ckb[keyPart] = command;
|
120
|
+
keyPart = keyPart.split(" ")[0];
|
121
|
+
if (!ckb[keyPart])
|
122
|
+
ckb[keyPart] = "null";
|
123
|
+
}, this);
|
124
|
+
};
|
125
|
+
|
126
|
+
|
127
|
+
exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
|
128
|
+
if (hashId == -1) {
|
129
|
+
if (data.count) {
|
130
|
+
var str = Array(data.count + 1).join(key);
|
131
|
+
data.count = null;
|
132
|
+
return {command: "insertstring", args: str};
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
if (key == "\x00")
|
137
|
+
return;
|
138
|
+
|
139
|
+
var modifier = eMods[hashId];
|
140
|
+
if (modifier == "c-" || data.universalArgument) {
|
141
|
+
var count = parseInt(key[key.length - 1]);
|
142
|
+
if (count) {
|
143
|
+
data.count = count;
|
144
|
+
return {command: "null"};
|
145
|
+
}
|
146
|
+
}
|
147
|
+
data.universalArgument = false;
|
148
|
+
|
149
|
+
if (modifier)
|
150
|
+
key = modifier + key;
|
151
|
+
|
152
|
+
if (data.keyChain)
|
153
|
+
key = data.keyChain += " " + key;
|
154
|
+
|
155
|
+
var command = this.commmandKeyBinding[key];
|
156
|
+
data.keyChain = command == "null" ? key : "";
|
157
|
+
|
158
|
+
if (!command)
|
159
|
+
return;
|
160
|
+
|
161
|
+
if (command == "null")
|
162
|
+
return {command: "null"};
|
163
|
+
|
164
|
+
if (command == "universalArgument") {
|
165
|
+
data.universalArgument = true;
|
166
|
+
return {command: "null"};
|
167
|
+
}
|
168
|
+
|
169
|
+
if (typeof command != "string") {
|
170
|
+
var args = command.args;
|
171
|
+
command = command.command;
|
172
|
+
}
|
173
|
+
|
174
|
+
if (typeof command == "string") {
|
175
|
+
command = this.commands[command] || data.editor.commands.commands[command];
|
176
|
+
}
|
177
|
+
|
178
|
+
if (!command.readonly && !command.isYank)
|
179
|
+
data.lastCommand = null;
|
180
|
+
|
181
|
+
if (data.count) {
|
182
|
+
var count = data.count;
|
183
|
+
data.count = 0;
|
184
|
+
return {
|
185
|
+
args: args,
|
186
|
+
command: {
|
187
|
+
exec: function(editor, args) {
|
188
|
+
for (var i = 0; i < count; i++)
|
189
|
+
command.exec(editor, args);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
};
|
193
|
+
}
|
194
|
+
|
195
|
+
return {command: command, args: args};
|
196
|
+
};
|
197
|
+
|
198
|
+
exports.emacsKeys = {
|
199
|
+
// movement
|
200
|
+
"Up|C-p" : "golineup",
|
201
|
+
"Down|C-n" : "golinedown",
|
202
|
+
"Left|C-b" : "gotoleft",
|
203
|
+
"Right|C-f" : "gotoright",
|
204
|
+
"C-Left|M-b" : "gotowordleft",
|
205
|
+
"C-Right|M-f" : "gotowordright",
|
206
|
+
"Home|C-a" : "gotolinestart",
|
207
|
+
"End|C-e" : "gotolineend",
|
208
|
+
"C-Home|S-M-,": "gotostart",
|
209
|
+
"C-End|S-M-." : "gotoend",
|
210
|
+
|
211
|
+
// selection
|
212
|
+
"S-Up|S-C-p" : "selectup",
|
213
|
+
"S-Down|S-C-n" : "selectdown",
|
214
|
+
"S-Left|S-C-b" : "selectleft",
|
215
|
+
"S-Right|S-C-f" : "selectright",
|
216
|
+
"S-C-Left|S-M-b" : "selectwordleft",
|
217
|
+
"S-C-Right|S-M-f" : "selectwordright",
|
218
|
+
"S-Home|S-C-a" : "selecttolinestart",
|
219
|
+
"S-End|S-C-e" : "selecttolineend",
|
220
|
+
"S-C-Home" : "selecttostart",
|
221
|
+
"S-C-End" : "selecttoend",
|
222
|
+
|
223
|
+
"C-l|M-s" : "centerselection",
|
224
|
+
"M-g": "gotoline",
|
225
|
+
"C-x C-p": "selectall",
|
226
|
+
|
227
|
+
// todo fix these
|
228
|
+
"C-Down": "gotopagedown",
|
229
|
+
"C-Up": "gotopageup",
|
230
|
+
"PageDown|C-v": "gotopagedown",
|
231
|
+
"PageUp|M-v": "gotopageup",
|
232
|
+
"S-C-Down": "selectpagedown",
|
233
|
+
"S-C-Up": "selectpageup",
|
234
|
+
"C-s": "findnext",
|
235
|
+
"C-r": "findprevious",
|
236
|
+
"M-C-s": "findnext",
|
237
|
+
"M-C-r": "findprevious",
|
238
|
+
"S-M-5": "replace",
|
239
|
+
|
240
|
+
// basic editing
|
241
|
+
"Backspace": "backspace",
|
242
|
+
"Delete|C-d": "del",
|
243
|
+
"Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
|
244
|
+
"C-o": "splitline",
|
245
|
+
|
246
|
+
"M-d|C-Delete": {command: "killWord", args: "right"},
|
247
|
+
"C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
|
248
|
+
"C-k": "killLine",
|
249
|
+
|
250
|
+
"C-y|S-Delete": "yank",
|
251
|
+
"M-y": "yankRotate",
|
252
|
+
"C-g": "keyboardQuit",
|
253
|
+
|
254
|
+
"C-w": "killRegion",
|
255
|
+
"M-w": "killRingSave",
|
256
|
+
|
257
|
+
"C-Space": "setMark",
|
258
|
+
"C-x C-x": "exchangePointAndMark",
|
259
|
+
|
260
|
+
"C-t": "transposeletters",
|
261
|
+
|
262
|
+
"M-u": "touppercase",
|
263
|
+
"M-l": "tolowercase",
|
264
|
+
"M-/": "autocomplete",
|
265
|
+
"C-u": "universalArgument",
|
266
|
+
"M-;": "togglecomment",
|
267
|
+
|
268
|
+
"C-/|C-x u|S-C--|C-z": "undo",
|
269
|
+
"S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
|
270
|
+
// vertical editing
|
271
|
+
"C-x r": "selectRectangularRegion"
|
272
|
+
|
273
|
+
// todo
|
274
|
+
// "M-x" "C-x C-t" "M-t" "M-c" "F11" "C-M- "M-q"
|
275
|
+
};
|
276
|
+
|
277
|
+
|
278
|
+
exports.handler.bindKeys(exports.emacsKeys);
|
279
|
+
|
280
|
+
exports.handler.addCommands({
|
281
|
+
selectRectangularRegion: function(editor) {
|
282
|
+
editor.multiSelect.toggleBlockSelection();
|
283
|
+
},
|
284
|
+
setMark: function() {
|
285
|
+
},
|
286
|
+
exchangePointAndMark: {
|
287
|
+
exec: function(editor) {
|
288
|
+
var range = editor.selection.getRange();
|
289
|
+
editor.selection.setSelectionRange(range, !editor.selection.isBackwards());
|
290
|
+
},
|
291
|
+
readonly: true,
|
292
|
+
multiselectAction: "forEach"
|
293
|
+
},
|
294
|
+
killWord: {
|
295
|
+
exec: function(editor, dir) {
|
296
|
+
editor.clearSelection();
|
297
|
+
if (dir == "left")
|
298
|
+
editor.selection.selectWordLeft();
|
299
|
+
else
|
300
|
+
editor.selection.selectWordRight();
|
301
|
+
|
302
|
+
var range = editor.getSelectionRange();
|
303
|
+
var text = editor.session.getTextRange(range);
|
304
|
+
exports.killRing.add(text);
|
305
|
+
|
306
|
+
editor.session.remove(range);
|
307
|
+
editor.clearSelection();
|
308
|
+
},
|
309
|
+
multiselectAction: "forEach"
|
310
|
+
},
|
311
|
+
killLine: function(editor) {
|
312
|
+
editor.selection.selectLine();
|
313
|
+
var range = editor.getSelectionRange();
|
314
|
+
var text = editor.session.getTextRange(range);
|
315
|
+
exports.killRing.add(text);
|
316
|
+
|
317
|
+
editor.session.remove(range);
|
318
|
+
editor.clearSelection();
|
319
|
+
},
|
320
|
+
yank: function(editor) {
|
321
|
+
editor.onPaste(exports.killRing.get());
|
322
|
+
editor.keyBinding.$data.lastCommand = "yank";
|
323
|
+
},
|
324
|
+
yankRotate: function(editor) {
|
325
|
+
if (editor.keyBinding.$data.lastCommand != "yank")
|
326
|
+
return;
|
327
|
+
|
328
|
+
editor.undo();
|
329
|
+
editor.onPaste(exports.killRing.rotate());
|
330
|
+
editor.keyBinding.$data.lastCommand = "yank";
|
331
|
+
},
|
332
|
+
killRegion: function(editor) {
|
333
|
+
exports.killRing.add(editor.getCopyText());
|
334
|
+
editor.cut();
|
335
|
+
},
|
336
|
+
killRingSave: function(editor) {
|
337
|
+
exports.killRing.add(editor.getCopyText());
|
338
|
+
}
|
339
|
+
});
|
340
|
+
|
341
|
+
var commands = exports.handler.commands;
|
342
|
+
commands.yank.isYank = true;
|
343
|
+
commands.yankRotate.isYank = true;
|
344
|
+
|
345
|
+
exports.killRing = {
|
346
|
+
$data: [],
|
347
|
+
add: function(str) {
|
348
|
+
str && this.$data.push(str);
|
349
|
+
if (this.$data.length > 30)
|
350
|
+
this.$data.shift();
|
351
|
+
},
|
352
|
+
get: function() {
|
353
|
+
return this.$data[this.$data.length - 1] || "";
|
354
|
+
},
|
355
|
+
pop: function() {
|
356
|
+
if (this.$data.length > 1)
|
357
|
+
this.$data.pop();
|
358
|
+
return this.get();
|
359
|
+
},
|
360
|
+
rotate: function() {
|
361
|
+
this.$data.unshift(this.$data.pop());
|
362
|
+
return this.get();
|
363
|
+
}
|
364
|
+
};
|
365
|
+
|
366
|
+
|
367
|
+
});
|
@@ -1 +1,1635 @@
|
|
1
|
-
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Ajax.org Code Editor (ACE).
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Ajax.org B.V.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2010
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Sergi Mansilla <sergi AT c9 DOT io>
|
23
|
+
* Harutyun Amirjanyan <harutyun AT c9 DOT io>
|
24
|
+
*
|
25
|
+
* Alternatively, the contents of this file may be used under the terms of
|
26
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
27
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
28
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
29
|
+
* of those above. If you wish to allow use of your version of this file only
|
30
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
31
|
+
* use your version of this file under the terms of the MPL, indicate your
|
32
|
+
* decision by deleting the provisions above and replace them with the notice
|
33
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
34
|
+
* the provisions above, a recipient may use your version of this file under
|
35
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
36
|
+
*
|
37
|
+
* ***** END LICENSE BLOCK ***** */
|
38
|
+
|
39
|
+
define('ace/keyboard/vim', ['require', 'exports', 'module' , 'ace/keyboard/vim/commands', 'ace/keyboard/vim/maps/util', 'ace/lib/useragent'], function(require, exports, module) {
|
40
|
+
|
41
|
+
|
42
|
+
var cmds = require("./vim/commands");
|
43
|
+
var coreCommands = cmds.coreCommands;
|
44
|
+
var util = require("./vim/maps/util");
|
45
|
+
var useragent = require("../lib/useragent");
|
46
|
+
|
47
|
+
var startCommands = {
|
48
|
+
"i": {
|
49
|
+
command: coreCommands.start
|
50
|
+
},
|
51
|
+
"I": {
|
52
|
+
command: coreCommands.startBeginning
|
53
|
+
},
|
54
|
+
"a": {
|
55
|
+
command: coreCommands.append
|
56
|
+
},
|
57
|
+
"A": {
|
58
|
+
command: coreCommands.appendEnd
|
59
|
+
},
|
60
|
+
"ctrl-f": {
|
61
|
+
command: "gotopagedown"
|
62
|
+
},
|
63
|
+
"ctrl-b": {
|
64
|
+
command: "gotopageup"
|
65
|
+
}
|
66
|
+
};
|
67
|
+
|
68
|
+
exports.handler = {
|
69
|
+
// workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true`
|
70
|
+
handleMacRepeat: function(data, hashId, key) {
|
71
|
+
if (hashId == -1) {
|
72
|
+
// record key
|
73
|
+
data.inputChar = key;
|
74
|
+
data.lastEvent = "input";
|
75
|
+
} else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
|
76
|
+
// check for repeated keypress
|
77
|
+
if (data.lastEvent == "input") {
|
78
|
+
data.lastEvent = "input1";
|
79
|
+
} else if (data.lastEvent == "input1") {
|
80
|
+
// simulate textinput
|
81
|
+
return true;
|
82
|
+
}
|
83
|
+
} else {
|
84
|
+
// reset
|
85
|
+
data.$lastHash = hashId;
|
86
|
+
data.$lastKey = key;
|
87
|
+
data.lastEvent = "keypress";
|
88
|
+
}
|
89
|
+
},
|
90
|
+
|
91
|
+
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
92
|
+
// ignore command keys (shift, ctrl etc.)
|
93
|
+
if (hashId != 0 && (key == "" || key == "\x00"))
|
94
|
+
return null;
|
95
|
+
|
96
|
+
if (hashId == 1)
|
97
|
+
key = "ctrl-" + key;
|
98
|
+
|
99
|
+
if (data.state == "start") {
|
100
|
+
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
101
|
+
hashId = -1;
|
102
|
+
key = data.inputChar;
|
103
|
+
}
|
104
|
+
|
105
|
+
if (hashId == -1 || hashId == 1) {
|
106
|
+
if (cmds.inputBuffer.idle && startCommands[key])
|
107
|
+
return startCommands[key];
|
108
|
+
return {
|
109
|
+
command: {
|
110
|
+
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
|
111
|
+
}
|
112
|
+
};
|
113
|
+
} // if no modifier || shift: wait for input.
|
114
|
+
else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
|
115
|
+
return {command: "null", passEvent: true};
|
116
|
+
} else if (key == "esc" && hashId == 0) {
|
117
|
+
return {command: coreCommands.stop};
|
118
|
+
}
|
119
|
+
} else {
|
120
|
+
if (key == "esc" || key == "ctrl-[") {
|
121
|
+
data.state = "start";
|
122
|
+
return {command: coreCommands.stop};
|
123
|
+
} else if (key == "ctrl-w") {
|
124
|
+
return {command: "removewordleft"};
|
125
|
+
}
|
126
|
+
}
|
127
|
+
},
|
128
|
+
|
129
|
+
attach: function(editor) {
|
130
|
+
editor.on("click", exports.onCursorMove);
|
131
|
+
if (util.currentMode !== "insert")
|
132
|
+
cmds.coreCommands.stop.exec(editor);
|
133
|
+
editor.$vimModeHandler = this;
|
134
|
+
},
|
135
|
+
|
136
|
+
detach: function(editor) {
|
137
|
+
editor.removeListener("click", exports.onCursorMove);
|
138
|
+
util.noMode(editor);
|
139
|
+
util.currentMode = "normal";
|
140
|
+
},
|
141
|
+
|
142
|
+
actions: cmds.actions,
|
143
|
+
getStatusText: function() {
|
144
|
+
if (util.currentMode == "insert")
|
145
|
+
return "INSERT";
|
146
|
+
if (util.onVisualMode)
|
147
|
+
return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
|
148
|
+
return cmds.inputBuffer.status;
|
149
|
+
}
|
150
|
+
};
|
151
|
+
|
152
|
+
|
153
|
+
exports.onCursorMove = function(e) {
|
154
|
+
cmds.onCursorMove(e.editor, e);
|
155
|
+
exports.onCursorMove.scheduled = false;
|
156
|
+
};
|
157
|
+
|
158
|
+
});
|
159
|
+
|
160
|
+
define('ace/keyboard/vim/commands', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/maps/motions', 'ace/keyboard/vim/maps/operators', 'ace/keyboard/vim/maps/aliases', 'ace/keyboard/vim/registers'], function(require, exports, module) {
|
161
|
+
|
162
|
+
"never use strict";
|
163
|
+
|
164
|
+
var util = require("./maps/util");
|
165
|
+
var motions = require("./maps/motions");
|
166
|
+
var operators = require("./maps/operators");
|
167
|
+
var alias = require("./maps/aliases");
|
168
|
+
var registers = require("./registers");
|
169
|
+
|
170
|
+
var NUMBER = 1;
|
171
|
+
var OPERATOR = 2;
|
172
|
+
var MOTION = 3;
|
173
|
+
var ACTION = 4;
|
174
|
+
var HMARGIN = 8; // Minimum amount of line separation between margins;
|
175
|
+
|
176
|
+
var repeat = function repeat(fn, count, args) {
|
177
|
+
while (0 < count--)
|
178
|
+
fn.apply(this, args);
|
179
|
+
};
|
180
|
+
|
181
|
+
var ensureScrollMargin = function(editor) {
|
182
|
+
var renderer = editor.renderer;
|
183
|
+
var pos = renderer.$cursorLayer.getPixelPosition();
|
184
|
+
|
185
|
+
var top = pos.top;
|
186
|
+
|
187
|
+
var margin = HMARGIN * renderer.layerConfig.lineHeight;
|
188
|
+
if (2 * margin > renderer.$size.scrollerHeight)
|
189
|
+
margin = renderer.$size.scrollerHeight / 2;
|
190
|
+
|
191
|
+
if (renderer.scrollTop > top - margin) {
|
192
|
+
renderer.session.setScrollTop(top - margin);
|
193
|
+
}
|
194
|
+
|
195
|
+
if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) {
|
196
|
+
renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight);
|
197
|
+
}
|
198
|
+
};
|
199
|
+
|
200
|
+
var actions = exports.actions = {
|
201
|
+
"z": {
|
202
|
+
param: true,
|
203
|
+
fn: function(editor, range, count, param) {
|
204
|
+
switch (param) {
|
205
|
+
case "z":
|
206
|
+
editor.alignCursor(null, 0.5);
|
207
|
+
break;
|
208
|
+
case "t":
|
209
|
+
editor.alignCursor(null, 0);
|
210
|
+
break;
|
211
|
+
case "b":
|
212
|
+
editor.alignCursor(null, 1);
|
213
|
+
break;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
},
|
217
|
+
"r": {
|
218
|
+
param: true,
|
219
|
+
fn: function(editor, range, count, param) {
|
220
|
+
if (param && param.length) {
|
221
|
+
repeat(function() { editor.insert(param); }, count || 1);
|
222
|
+
editor.navigateLeft();
|
223
|
+
}
|
224
|
+
}
|
225
|
+
},
|
226
|
+
"R": {
|
227
|
+
fn: function(editor, range, count, param) {
|
228
|
+
util.insertMode(editor);
|
229
|
+
editor.setOverwrite(true);
|
230
|
+
}
|
231
|
+
},
|
232
|
+
"~": {
|
233
|
+
fn: function(editor, range, count) {
|
234
|
+
repeat(function() {
|
235
|
+
var range = editor.selection.getRange();
|
236
|
+
if (range.isEmpty())
|
237
|
+
range.end.column++;
|
238
|
+
var text = editor.session.getTextRange(range);
|
239
|
+
var toggled = text.toUpperCase();
|
240
|
+
if (toggled == text)
|
241
|
+
editor.navigateRight();
|
242
|
+
else
|
243
|
+
editor.session.replace(range, toggled);
|
244
|
+
}, count || 1);
|
245
|
+
}
|
246
|
+
},
|
247
|
+
"*": {
|
248
|
+
fn: function(editor, range, count, param) {
|
249
|
+
editor.selection.selectWord();
|
250
|
+
editor.findNext();
|
251
|
+
ensureScrollMargin(editor);
|
252
|
+
var r = editor.selection.getRange();
|
253
|
+
editor.selection.setSelectionRange(r, true);
|
254
|
+
}
|
255
|
+
},
|
256
|
+
"#": {
|
257
|
+
fn: function(editor, range, count, param) {
|
258
|
+
editor.selection.selectWord();
|
259
|
+
editor.findPrevious();
|
260
|
+
ensureScrollMargin(editor);
|
261
|
+
var r = editor.selection.getRange();
|
262
|
+
editor.selection.setSelectionRange(r, true);
|
263
|
+
}
|
264
|
+
},
|
265
|
+
"n": {
|
266
|
+
fn: function(editor, range, count, param) {
|
267
|
+
var options = editor.getLastSearchOptions();
|
268
|
+
options.backwards = false;
|
269
|
+
|
270
|
+
editor.selection.moveCursorRight();
|
271
|
+
editor.selection.clearSelection();
|
272
|
+
editor.findNext(options);
|
273
|
+
|
274
|
+
ensureScrollMargin(editor);
|
275
|
+
var r = editor.selection.getRange();
|
276
|
+
r.end.row = r.start.row;
|
277
|
+
r.end.column = r.start.column;
|
278
|
+
editor.selection.setSelectionRange(r, true);
|
279
|
+
}
|
280
|
+
},
|
281
|
+
"N": {
|
282
|
+
fn: function(editor, range, count, param) {
|
283
|
+
var options = editor.getLastSearchOptions();
|
284
|
+
options.backwards = true;
|
285
|
+
|
286
|
+
editor.findPrevious(options);
|
287
|
+
ensureScrollMargin(editor);
|
288
|
+
var r = editor.selection.getRange();
|
289
|
+
r.end.row = r.start.row;
|
290
|
+
r.end.column = r.start.column;
|
291
|
+
editor.selection.setSelectionRange(r, true);
|
292
|
+
}
|
293
|
+
},
|
294
|
+
"v": {
|
295
|
+
fn: function(editor, range, count, param) {
|
296
|
+
editor.selection.selectRight();
|
297
|
+
util.visualMode(editor, false);
|
298
|
+
},
|
299
|
+
acceptsMotion: true
|
300
|
+
},
|
301
|
+
"V": {
|
302
|
+
fn: function(editor, range, count, param) {
|
303
|
+
//editor.selection.selectLine();
|
304
|
+
//editor.selection.selectLeft();
|
305
|
+
var row = editor.getCursorPosition().row;
|
306
|
+
editor.selection.clearSelection();
|
307
|
+
editor.selection.moveCursorTo(row, 0);
|
308
|
+
editor.selection.selectLineEnd();
|
309
|
+
editor.selection.visualLineStart = row;
|
310
|
+
|
311
|
+
util.visualMode(editor, true);
|
312
|
+
},
|
313
|
+
acceptsMotion: true
|
314
|
+
},
|
315
|
+
"Y": {
|
316
|
+
fn: function(editor, range, count, param) {
|
317
|
+
util.copyLine(editor);
|
318
|
+
}
|
319
|
+
},
|
320
|
+
"p": {
|
321
|
+
fn: function(editor, range, count, param) {
|
322
|
+
var defaultReg = registers._default;
|
323
|
+
|
324
|
+
editor.setOverwrite(false);
|
325
|
+
if (defaultReg.isLine) {
|
326
|
+
var pos = editor.getCursorPosition();
|
327
|
+
var lines = defaultReg.text.split("\n");
|
328
|
+
editor.session.getDocument().insertLines(pos.row + 1, lines);
|
329
|
+
editor.moveCursorTo(pos.row + 1, 0);
|
330
|
+
}
|
331
|
+
else {
|
332
|
+
editor.navigateRight();
|
333
|
+
editor.insert(defaultReg.text);
|
334
|
+
editor.navigateLeft();
|
335
|
+
}
|
336
|
+
editor.setOverwrite(true);
|
337
|
+
editor.selection.clearSelection();
|
338
|
+
}
|
339
|
+
},
|
340
|
+
"P": {
|
341
|
+
fn: function(editor, range, count, param) {
|
342
|
+
var defaultReg = registers._default;
|
343
|
+
editor.setOverwrite(false);
|
344
|
+
|
345
|
+
if (defaultReg.isLine) {
|
346
|
+
var pos = editor.getCursorPosition();
|
347
|
+
var lines = defaultReg.text.split("\n");
|
348
|
+
editor.session.getDocument().insertLines(pos.row, lines);
|
349
|
+
editor.moveCursorTo(pos.row, 0);
|
350
|
+
}
|
351
|
+
else {
|
352
|
+
editor.insert(defaultReg.text);
|
353
|
+
}
|
354
|
+
editor.setOverwrite(true);
|
355
|
+
editor.selection.clearSelection();
|
356
|
+
}
|
357
|
+
},
|
358
|
+
"J": {
|
359
|
+
fn: function(editor, range, count, param) {
|
360
|
+
var session = editor.session;
|
361
|
+
range = editor.getSelectionRange();
|
362
|
+
var pos = {row: range.start.row, column: range.start.column};
|
363
|
+
count = count || range.end.row - range.start.row;
|
364
|
+
var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1);
|
365
|
+
|
366
|
+
range.start.column = session.getLine(pos.row).length;
|
367
|
+
range.end.column = session.getLine(maxRow).length;
|
368
|
+
range.end.row = maxRow;
|
369
|
+
|
370
|
+
var text = "";
|
371
|
+
for (var i = pos.row; i < maxRow; i++) {
|
372
|
+
var nextLine = session.getLine(i + 1);
|
373
|
+
text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
|
374
|
+
}
|
375
|
+
|
376
|
+
session.replace(range, text);
|
377
|
+
editor.moveCursorTo(pos.row, pos.column);
|
378
|
+
}
|
379
|
+
},
|
380
|
+
"u": {
|
381
|
+
fn: function(editor, range, count, param) {
|
382
|
+
count = parseInt(count || 1, 10);
|
383
|
+
for (var i = 0; i < count; i++) {
|
384
|
+
editor.undo();
|
385
|
+
}
|
386
|
+
editor.selection.clearSelection();
|
387
|
+
}
|
388
|
+
},
|
389
|
+
"ctrl-r": {
|
390
|
+
fn: function(editor, range, count, param) {
|
391
|
+
count = parseInt(count || 1, 10);
|
392
|
+
for (var i = 0; i < count; i++) {
|
393
|
+
editor.redo();
|
394
|
+
}
|
395
|
+
editor.selection.clearSelection();
|
396
|
+
}
|
397
|
+
},
|
398
|
+
":": {
|
399
|
+
fn: function(editor, range, count, param) {
|
400
|
+
// not implemented
|
401
|
+
}
|
402
|
+
},
|
403
|
+
"/": {
|
404
|
+
fn: function(editor, range, count, param) {
|
405
|
+
// not implemented
|
406
|
+
}
|
407
|
+
},
|
408
|
+
"?": {
|
409
|
+
fn: function(editor, range, count, param) {
|
410
|
+
// not implemented
|
411
|
+
}
|
412
|
+
},
|
413
|
+
".": {
|
414
|
+
fn: function(editor, range, count, param) {
|
415
|
+
util.onInsertReplaySequence = inputBuffer.lastInsertCommands;
|
416
|
+
var previous = inputBuffer.previous;
|
417
|
+
if (previous) // If there is a previous action
|
418
|
+
inputBuffer.exec(editor, previous.action, previous.param);
|
419
|
+
}
|
420
|
+
}
|
421
|
+
};
|
422
|
+
|
423
|
+
var inputBuffer = exports.inputBuffer = {
|
424
|
+
accepting: [NUMBER, OPERATOR, MOTION, ACTION],
|
425
|
+
currentCmd: null,
|
426
|
+
//currentMode: 0,
|
427
|
+
currentCount: "",
|
428
|
+
status: "",
|
429
|
+
|
430
|
+
// Types
|
431
|
+
operator: null,
|
432
|
+
motion: null,
|
433
|
+
|
434
|
+
lastInsertCommands: [],
|
435
|
+
|
436
|
+
push: function(editor, char, keyId) {
|
437
|
+
this.idle = false;
|
438
|
+
var wObj = this.waitingForParam;
|
439
|
+
if (wObj) {
|
440
|
+
this.exec(editor, wObj, char);
|
441
|
+
}
|
442
|
+
// If input is a number (that doesn't start with 0)
|
443
|
+
else if (!(char === "0" && !this.currentCount.length) &&
|
444
|
+
(char.match(/^\d+$/) && this.isAccepting(NUMBER))) {
|
445
|
+
// Assuming that char is always of type String, and not Number
|
446
|
+
this.currentCount += char;
|
447
|
+
this.currentCmd = NUMBER;
|
448
|
+
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
449
|
+
}
|
450
|
+
else if (!this.operator && this.isAccepting(OPERATOR) && operators[char]) {
|
451
|
+
this.operator = {
|
452
|
+
char: char,
|
453
|
+
count: this.getCount()
|
454
|
+
};
|
455
|
+
this.currentCmd = OPERATOR;
|
456
|
+
this.accepting = [NUMBER, MOTION, ACTION];
|
457
|
+
this.exec(editor, { operator: this.operator });
|
458
|
+
}
|
459
|
+
else if (motions[char] && this.isAccepting(MOTION)) {
|
460
|
+
this.currentCmd = MOTION;
|
461
|
+
|
462
|
+
var ctx = {
|
463
|
+
operator: this.operator,
|
464
|
+
motion: {
|
465
|
+
char: char,
|
466
|
+
count: this.getCount()
|
467
|
+
}
|
468
|
+
};
|
469
|
+
|
470
|
+
if (motions[char].param)
|
471
|
+
this.waitForParam(ctx);
|
472
|
+
else
|
473
|
+
this.exec(editor, ctx);
|
474
|
+
}
|
475
|
+
else if (alias[char] && this.isAccepting(MOTION)) {
|
476
|
+
alias[char].operator.count = this.getCount();
|
477
|
+
this.exec(editor, alias[char]);
|
478
|
+
}
|
479
|
+
else if (actions[char] && this.isAccepting(ACTION)) {
|
480
|
+
var actionObj = {
|
481
|
+
action: {
|
482
|
+
fn: actions[char].fn,
|
483
|
+
count: this.getCount()
|
484
|
+
}
|
485
|
+
};
|
486
|
+
|
487
|
+
if (actions[char].param) {
|
488
|
+
this.waitForParam(actionObj);
|
489
|
+
}
|
490
|
+
else {
|
491
|
+
this.exec(editor, actionObj);
|
492
|
+
}
|
493
|
+
|
494
|
+
if (actions[char].acceptsMotion)
|
495
|
+
this.idle = false;
|
496
|
+
}
|
497
|
+
else if (this.operator) {
|
498
|
+
this.exec(editor, { operator: this.operator }, char);
|
499
|
+
}
|
500
|
+
else {
|
501
|
+
this.reset();
|
502
|
+
}
|
503
|
+
|
504
|
+
if (this.waitingForParam || this.motion || this.operator) {
|
505
|
+
this.status += char;
|
506
|
+
} else if (this.currentCount) {
|
507
|
+
this.status = this.currentCount;
|
508
|
+
} else if (this.status) {
|
509
|
+
this.status = "";
|
510
|
+
} else {
|
511
|
+
return;
|
512
|
+
}
|
513
|
+
editor._emit("changeStatus");
|
514
|
+
},
|
515
|
+
|
516
|
+
waitForParam: function(cmd) {
|
517
|
+
this.waitingForParam = cmd;
|
518
|
+
},
|
519
|
+
|
520
|
+
getCount: function() {
|
521
|
+
var count = this.currentCount;
|
522
|
+
this.currentCount = "";
|
523
|
+
return count && parseInt(count, 10);
|
524
|
+
},
|
525
|
+
|
526
|
+
exec: function(editor, action, param) {
|
527
|
+
var m = action.motion;
|
528
|
+
var o = action.operator;
|
529
|
+
var a = action.action;
|
530
|
+
|
531
|
+
if (!param)
|
532
|
+
param = action.param;
|
533
|
+
|
534
|
+
if (o) {
|
535
|
+
this.previous = {
|
536
|
+
action: action,
|
537
|
+
param: param
|
538
|
+
};
|
539
|
+
}
|
540
|
+
|
541
|
+
if (o && !editor.selection.isEmpty()) {
|
542
|
+
if (operators[o.char].selFn) {
|
543
|
+
operators[o.char].selFn(editor, editor.getSelectionRange(), o.count, param);
|
544
|
+
this.reset();
|
545
|
+
}
|
546
|
+
return;
|
547
|
+
}
|
548
|
+
|
549
|
+
// There is an operator, but no motion or action. We try to pass the
|
550
|
+
// current char to the operator to see if it responds to it (an example
|
551
|
+
// of this is the 'dd' operator).
|
552
|
+
else if (!m && !a && o && param) {
|
553
|
+
operators[o.char].fn(editor, null, o.count, param);
|
554
|
+
this.reset();
|
555
|
+
}
|
556
|
+
else if (m) {
|
557
|
+
var run = function(fn) {
|
558
|
+
if (fn && typeof fn === "function") { // There should always be a motion
|
559
|
+
if (m.count && !motionObj.handlesCount)
|
560
|
+
repeat(fn, m.count, [editor, null, m.count, param]);
|
561
|
+
else
|
562
|
+
fn(editor, null, m.count, param);
|
563
|
+
}
|
564
|
+
};
|
565
|
+
|
566
|
+
var motionObj = motions[m.char];
|
567
|
+
var selectable = motionObj.sel;
|
568
|
+
|
569
|
+
if (!o) {
|
570
|
+
if ((util.onVisualMode || util.onVisualLineMode) && selectable)
|
571
|
+
run(motionObj.sel);
|
572
|
+
else
|
573
|
+
run(motionObj.nav);
|
574
|
+
}
|
575
|
+
else if (selectable) {
|
576
|
+
repeat(function() {
|
577
|
+
run(motionObj.sel);
|
578
|
+
operators[o.char].fn(editor, editor.getSelectionRange(), o.count, param);
|
579
|
+
}, o.count || 1);
|
580
|
+
}
|
581
|
+
this.reset();
|
582
|
+
}
|
583
|
+
else if (a) {
|
584
|
+
a.fn(editor, editor.getSelectionRange(), a.count, param);
|
585
|
+
this.reset();
|
586
|
+
}
|
587
|
+
handleCursorMove(editor);
|
588
|
+
},
|
589
|
+
|
590
|
+
isAccepting: function(type) {
|
591
|
+
return this.accepting.indexOf(type) !== -1;
|
592
|
+
},
|
593
|
+
|
594
|
+
reset: function() {
|
595
|
+
this.operator = null;
|
596
|
+
this.motion = null;
|
597
|
+
this.currentCount = "";
|
598
|
+
this.status = "";
|
599
|
+
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
600
|
+
this.idle = true;
|
601
|
+
this.waitingForParam = null;
|
602
|
+
}
|
603
|
+
};
|
604
|
+
|
605
|
+
function setPreviousCommand(fn) {
|
606
|
+
inputBuffer.previous = { action: { action: { fn: fn } } };
|
607
|
+
}
|
608
|
+
|
609
|
+
exports.coreCommands = {
|
610
|
+
start: {
|
611
|
+
exec: function start(editor) {
|
612
|
+
util.insertMode(editor);
|
613
|
+
setPreviousCommand(start);
|
614
|
+
}
|
615
|
+
},
|
616
|
+
startBeginning: {
|
617
|
+
exec: function startBeginning(editor) {
|
618
|
+
editor.navigateLineStart();
|
619
|
+
util.insertMode(editor);
|
620
|
+
setPreviousCommand(startBeginning);
|
621
|
+
}
|
622
|
+
},
|
623
|
+
// Stop Insert mode as soon as possible. Works like typing <Esc> in
|
624
|
+
// insert mode.
|
625
|
+
stop: {
|
626
|
+
exec: function stop(editor) {
|
627
|
+
inputBuffer.reset();
|
628
|
+
util.onVisualMode = false;
|
629
|
+
util.onVisualLineMode = false;
|
630
|
+
inputBuffer.lastInsertCommands = util.normalMode(editor);
|
631
|
+
}
|
632
|
+
},
|
633
|
+
append: {
|
634
|
+
exec: function append(editor) {
|
635
|
+
var pos = editor.getCursorPosition();
|
636
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
637
|
+
if (lineLen)
|
638
|
+
editor.navigateRight();
|
639
|
+
util.insertMode(editor);
|
640
|
+
setPreviousCommand(append);
|
641
|
+
}
|
642
|
+
},
|
643
|
+
appendEnd: {
|
644
|
+
exec: function appendEnd(editor) {
|
645
|
+
editor.navigateLineEnd();
|
646
|
+
util.insertMode(editor);
|
647
|
+
setPreviousCommand(appendEnd);
|
648
|
+
}
|
649
|
+
}
|
650
|
+
};
|
651
|
+
|
652
|
+
var handleCursorMove = exports.onCursorMove = function(editor, e) {
|
653
|
+
if (util.currentMode === 'insert' || handleCursorMove.running)
|
654
|
+
return;
|
655
|
+
else if(!editor.selection.isEmpty()) {
|
656
|
+
handleCursorMove.running = true;
|
657
|
+
if (util.onVisualLineMode) {
|
658
|
+
var originRow = editor.selection.visualLineStart;
|
659
|
+
var cursorRow = editor.getCursorPosition().row;
|
660
|
+
if(originRow <= cursorRow) {
|
661
|
+
var endLine = editor.session.getLine(cursorRow);
|
662
|
+
editor.selection.clearSelection();
|
663
|
+
editor.selection.moveCursorTo(originRow, 0);
|
664
|
+
editor.selection.selectTo(cursorRow, endLine.length);
|
665
|
+
} else {
|
666
|
+
var endLine = editor.session.getLine(originRow);
|
667
|
+
editor.selection.clearSelection();
|
668
|
+
editor.selection.moveCursorTo(originRow, endLine.length);
|
669
|
+
editor.selection.selectTo(cursorRow, 0);
|
670
|
+
}
|
671
|
+
}
|
672
|
+
handleCursorMove.running = false;
|
673
|
+
return;
|
674
|
+
}
|
675
|
+
else {
|
676
|
+
if (e && (util.onVisualLineMode || util.onVisualMode)) {
|
677
|
+
editor.selection.clearSelection();
|
678
|
+
util.normalMode(editor);
|
679
|
+
}
|
680
|
+
|
681
|
+
handleCursorMove.running = true;
|
682
|
+
var pos = editor.getCursorPosition();
|
683
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
684
|
+
|
685
|
+
if (lineLen && pos.column === lineLen)
|
686
|
+
editor.navigateLeft();
|
687
|
+
handleCursorMove.running = false;
|
688
|
+
}
|
689
|
+
};
|
690
|
+
});
|
691
|
+
define('ace/keyboard/vim/maps/util', ['require', 'exports', 'module' , 'ace/keyboard/vim/registers', 'ace/lib/dom'], function(require, exports, module) {
|
692
|
+
var registers = require("../registers");
|
693
|
+
|
694
|
+
var dom = require("../../../lib/dom");
|
695
|
+
dom.importCssString('.insert-mode. ace_cursor{\
|
696
|
+
border-left: 2px solid #333333;\
|
697
|
+
}\
|
698
|
+
.ace_dark.insert-mode .ace_cursor{\
|
699
|
+
border-left: 2px solid #eeeeee;\
|
700
|
+
}\
|
701
|
+
.normal-mode .ace_cursor{\
|
702
|
+
border: 0!important;\
|
703
|
+
background-color: red;\
|
704
|
+
opacity: 0.5;\
|
705
|
+
}', 'vimMode');
|
706
|
+
|
707
|
+
module.exports = {
|
708
|
+
onVisualMode: false,
|
709
|
+
onVisualLineMode: false,
|
710
|
+
currentMode: 'normal',
|
711
|
+
noMode: function(editor) {
|
712
|
+
editor.unsetStyle('insert-mode');
|
713
|
+
editor.unsetStyle('normal-mode');
|
714
|
+
if (editor.commands.recording)
|
715
|
+
editor.commands.toggleRecording(editor);
|
716
|
+
editor.setOverwrite(false);
|
717
|
+
},
|
718
|
+
insertMode: function(editor) {
|
719
|
+
this.currentMode = 'insert';
|
720
|
+
// Switch editor to insert mode
|
721
|
+
editor.setStyle('insert-mode');
|
722
|
+
editor.unsetStyle('normal-mode');
|
723
|
+
|
724
|
+
editor.setOverwrite(false);
|
725
|
+
editor.keyBinding.$data.buffer = "";
|
726
|
+
editor.keyBinding.$data.state = "insertMode";
|
727
|
+
this.onVisualMode = false;
|
728
|
+
this.onVisualLineMode = false;
|
729
|
+
if(this.onInsertReplaySequence) {
|
730
|
+
// Ok, we're apparently replaying ("."), so let's do it
|
731
|
+
editor.commands.macro = this.onInsertReplaySequence;
|
732
|
+
editor.commands.replay(editor);
|
733
|
+
this.onInsertReplaySequence = null;
|
734
|
+
this.normalMode(editor);
|
735
|
+
} else {
|
736
|
+
editor._emit("changeStatus");
|
737
|
+
// Record any movements, insertions in insert mode
|
738
|
+
if(!editor.commands.recording)
|
739
|
+
editor.commands.toggleRecording(editor);
|
740
|
+
}
|
741
|
+
},
|
742
|
+
normalMode: function(editor) {
|
743
|
+
// Switch editor to normal mode
|
744
|
+
this.currentMode = 'normal';
|
745
|
+
|
746
|
+
editor.unsetStyle('insert-mode');
|
747
|
+
editor.setStyle('normal-mode');
|
748
|
+
editor.clearSelection();
|
749
|
+
|
750
|
+
var pos;
|
751
|
+
if (!editor.getOverwrite()) {
|
752
|
+
pos = editor.getCursorPosition();
|
753
|
+
if (pos.column > 0)
|
754
|
+
editor.navigateLeft();
|
755
|
+
}
|
756
|
+
|
757
|
+
editor.setOverwrite(true);
|
758
|
+
editor.keyBinding.$data.buffer = "";
|
759
|
+
editor.keyBinding.$data.state = "start";
|
760
|
+
this.onVisualMode = false;
|
761
|
+
this.onVisualLineMode = false;
|
762
|
+
editor._emit("changeStatus");
|
763
|
+
// Save recorded keystrokes
|
764
|
+
if (editor.commands.recording) {
|
765
|
+
editor.commands.toggleRecording(editor);
|
766
|
+
return editor.commands.macro;
|
767
|
+
}
|
768
|
+
else {
|
769
|
+
return [];
|
770
|
+
}
|
771
|
+
},
|
772
|
+
visualMode: function(editor, lineMode) {
|
773
|
+
if (
|
774
|
+
(this.onVisualLineMode && lineMode)
|
775
|
+
|| (this.onVisualMode && !lineMode)
|
776
|
+
) {
|
777
|
+
this.normalMode(editor);
|
778
|
+
return;
|
779
|
+
}
|
780
|
+
|
781
|
+
editor.setStyle('insert-mode');
|
782
|
+
editor.unsetStyle('normal-mode');
|
783
|
+
|
784
|
+
editor._emit("changeStatus");
|
785
|
+
if (lineMode) {
|
786
|
+
this.onVisualLineMode = true;
|
787
|
+
} else {
|
788
|
+
this.onVisualMode = true;
|
789
|
+
this.onVisualLineMode = false;
|
790
|
+
}
|
791
|
+
},
|
792
|
+
getRightNthChar: function(editor, cursor, char, n) {
|
793
|
+
var line = editor.getSession().getLine(cursor.row);
|
794
|
+
var matches = line.substr(cursor.column + 1).split(char);
|
795
|
+
|
796
|
+
return n < matches.length ? matches.slice(0, n).join(char).length : null;
|
797
|
+
},
|
798
|
+
getLeftNthChar: function(editor, cursor, char, n) {
|
799
|
+
var line = editor.getSession().getLine(cursor.row);
|
800
|
+
var matches = line.substr(0, cursor.column).split(char);
|
801
|
+
|
802
|
+
return n < matches.length ? matches.slice(-1 * n).join(char).length : null;
|
803
|
+
},
|
804
|
+
toRealChar: function(char) {
|
805
|
+
if (char.length === 1)
|
806
|
+
return char;
|
807
|
+
|
808
|
+
if (/^shift-./.test(char))
|
809
|
+
return char[char.length - 1].toUpperCase();
|
810
|
+
else
|
811
|
+
return "";
|
812
|
+
},
|
813
|
+
copyLine: function(editor) {
|
814
|
+
var pos = editor.getCursorPosition();
|
815
|
+
editor.selection.clearSelection();
|
816
|
+
editor.moveCursorTo(pos.row, pos.column);
|
817
|
+
editor.selection.selectLine();
|
818
|
+
registers._default.isLine = true;
|
819
|
+
registers._default.text = editor.getCopyText().replace(/\n$/, "");
|
820
|
+
editor.selection.clearSelection();
|
821
|
+
editor.moveCursorTo(pos.row, pos.column);
|
822
|
+
}
|
823
|
+
};
|
824
|
+
});
|
825
|
+
|
826
|
+
define('ace/keyboard/vim/registers', ['require', 'exports', 'module' ], function(require, exports, module) {
|
827
|
+
|
828
|
+
"never use strict";
|
829
|
+
|
830
|
+
module.exports = {
|
831
|
+
_default: {
|
832
|
+
text: "",
|
833
|
+
isLine: false
|
834
|
+
}
|
835
|
+
};
|
836
|
+
|
837
|
+
});
|
838
|
+
|
839
|
+
"use strict"
|
840
|
+
|
841
|
+
define('ace/keyboard/vim/maps/motions', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/search', 'ace/range'], function(require, exports, module) {
|
842
|
+
|
843
|
+
var util = require("./util");
|
844
|
+
|
845
|
+
var keepScrollPosition = function(editor, fn) {
|
846
|
+
var scrollTopRow = editor.renderer.getScrollTopRow();
|
847
|
+
var initialRow = editor.getCursorPosition().row;
|
848
|
+
var diff = initialRow - scrollTopRow;
|
849
|
+
fn && fn.call(editor);
|
850
|
+
editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
|
851
|
+
};
|
852
|
+
|
853
|
+
function Motion(getRange, type){
|
854
|
+
if (type == 'extend')
|
855
|
+
var extend = true;
|
856
|
+
else
|
857
|
+
var reverse = type;
|
858
|
+
|
859
|
+
this.nav = function(editor) {
|
860
|
+
var r = getRange(editor);
|
861
|
+
if (!r)
|
862
|
+
return;
|
863
|
+
if (!r.end)
|
864
|
+
var a = r;
|
865
|
+
else if (reverse)
|
866
|
+
var a = r.start;
|
867
|
+
else
|
868
|
+
var a = r.end;
|
869
|
+
|
870
|
+
editor.clearSelection();
|
871
|
+
editor.moveCursorTo(a.row, a.column);
|
872
|
+
}
|
873
|
+
this.sel = function(editor){
|
874
|
+
var r = getRange(editor);
|
875
|
+
if (!r)
|
876
|
+
return;
|
877
|
+
if (extend)
|
878
|
+
return editor.selection.setSelectionRange(r);
|
879
|
+
|
880
|
+
if (!r.end)
|
881
|
+
var a = r;
|
882
|
+
else if (reverse)
|
883
|
+
var a = r.start;
|
884
|
+
else
|
885
|
+
var a = r.end;
|
886
|
+
|
887
|
+
editor.selection.selectTo(a.row, a.column);
|
888
|
+
}
|
889
|
+
}
|
890
|
+
|
891
|
+
var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
892
|
+
var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
893
|
+
var whiteRe = /\s/;
|
894
|
+
var StringStream = function(editor, cursor) {
|
895
|
+
var sel = editor.selection;
|
896
|
+
this.range = sel.getRange();
|
897
|
+
cursor = cursor || sel.selectionLead;
|
898
|
+
this.row = cursor.row;
|
899
|
+
this.col = cursor.column;
|
900
|
+
var line = editor.session.getLine(this.row);
|
901
|
+
var maxRow = editor.session.getLength()
|
902
|
+
this.ch = line[this.col] || '\n'
|
903
|
+
this.skippedLines = 0;
|
904
|
+
|
905
|
+
this.next = function() {
|
906
|
+
this.ch = line[++this.col] || this.handleNewLine(1);
|
907
|
+
//this.debug()
|
908
|
+
return this.ch;
|
909
|
+
}
|
910
|
+
this.prev = function() {
|
911
|
+
this.ch = line[--this.col] || this.handleNewLine(-1);
|
912
|
+
//this.debug()
|
913
|
+
return this.ch;
|
914
|
+
}
|
915
|
+
this.peek = function(dir) {
|
916
|
+
var ch = line[this.col + dir];
|
917
|
+
if (ch)
|
918
|
+
return ch;
|
919
|
+
if (dir == -1)
|
920
|
+
return '\n';
|
921
|
+
if (this.col == line.length - 1)
|
922
|
+
return '\n';
|
923
|
+
return editor.session.getLine(this.row + 1)[0] || '\n';
|
924
|
+
}
|
925
|
+
|
926
|
+
this.handleNewLine = function(dir) {
|
927
|
+
if (dir == 1){
|
928
|
+
if (this.col == line.length)
|
929
|
+
return '\n';
|
930
|
+
if (this.row == maxRow - 1)
|
931
|
+
return '';
|
932
|
+
this.col = 0;
|
933
|
+
this.row ++;
|
934
|
+
line = editor.session.getLine(this.row);
|
935
|
+
this.skippedLines++;
|
936
|
+
return line[0] || '\n';
|
937
|
+
}
|
938
|
+
if (dir == -1) {
|
939
|
+
if (this.row == 0)
|
940
|
+
return '';
|
941
|
+
this.row --;
|
942
|
+
line = editor.session.getLine(this.row);
|
943
|
+
this.col = line.length;
|
944
|
+
this.skippedLines--;
|
945
|
+
return '\n';
|
946
|
+
}
|
947
|
+
}
|
948
|
+
this.debug = function() {
|
949
|
+
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
|
950
|
+
}
|
951
|
+
}
|
952
|
+
|
953
|
+
var Search = require("ace/search").Search;
|
954
|
+
var search = new Search();
|
955
|
+
|
956
|
+
function find(editor, needle, dir) {
|
957
|
+
search.$options.needle = needle;
|
958
|
+
search.$options.backwards = dir == -1;
|
959
|
+
return search.find(editor.session);
|
960
|
+
}
|
961
|
+
|
962
|
+
var Range = require("ace/range").Range;
|
963
|
+
|
964
|
+
module.exports = {
|
965
|
+
"w": new Motion(function(editor) {
|
966
|
+
var str = new StringStream(editor);
|
967
|
+
|
968
|
+
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
969
|
+
while (str.ch && wordSeparatorRe.test(str.ch))
|
970
|
+
str.next();
|
971
|
+
} else {
|
972
|
+
while (str.ch && !nonWordRe.test(str.ch))
|
973
|
+
str.next();
|
974
|
+
}
|
975
|
+
while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
|
976
|
+
str.next();
|
977
|
+
|
978
|
+
str.skippedLines == 2 && str.prev();
|
979
|
+
return {column: str.col, row: str.row};
|
980
|
+
}),
|
981
|
+
"W": new Motion(function(editor) {
|
982
|
+
var str = new StringStream(editor);
|
983
|
+
while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
|
984
|
+
str.next();
|
985
|
+
if (str.skippedLines == 2)
|
986
|
+
str.prev();
|
987
|
+
else
|
988
|
+
str.next();
|
989
|
+
|
990
|
+
return {column: str.col, row: str.row}
|
991
|
+
}),
|
992
|
+
"b": new Motion(function(editor) {
|
993
|
+
var str = new StringStream(editor);
|
994
|
+
|
995
|
+
str.prev();
|
996
|
+
while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
|
997
|
+
str.prev();
|
998
|
+
|
999
|
+
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
1000
|
+
while (str.ch && wordSeparatorRe.test(str.ch))
|
1001
|
+
str.prev();
|
1002
|
+
} else {
|
1003
|
+
while (str.ch && !nonWordRe.test(str.ch))
|
1004
|
+
str.prev();
|
1005
|
+
}
|
1006
|
+
str.ch && str.next();
|
1007
|
+
return {column: str.col, row: str.row};
|
1008
|
+
}),
|
1009
|
+
"B": new Motion(function(editor) {
|
1010
|
+
var str = new StringStream(editor)
|
1011
|
+
str.prev();
|
1012
|
+
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
|
1013
|
+
str.prev();
|
1014
|
+
|
1015
|
+
if (str.skippedLines == -2)
|
1016
|
+
str.next();
|
1017
|
+
|
1018
|
+
return {column: str.col, row: str.row};
|
1019
|
+
}, true),
|
1020
|
+
"e": new Motion(function(editor) {
|
1021
|
+
var str = new StringStream(editor);
|
1022
|
+
|
1023
|
+
str.next();
|
1024
|
+
while (str.ch && whiteRe.test(str.ch))
|
1025
|
+
str.next();
|
1026
|
+
|
1027
|
+
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
1028
|
+
while (str.ch && wordSeparatorRe.test(str.ch))
|
1029
|
+
str.next();
|
1030
|
+
} else {
|
1031
|
+
while (str.ch && !nonWordRe.test(str.ch))
|
1032
|
+
str.next();
|
1033
|
+
}
|
1034
|
+
str.ch && str.prev();
|
1035
|
+
return {column: str.col, row: str.row};
|
1036
|
+
}),
|
1037
|
+
"E": new Motion(function(editor) {
|
1038
|
+
var str = new StringStream(editor);
|
1039
|
+
str.next();
|
1040
|
+
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
|
1041
|
+
str.next();
|
1042
|
+
|
1043
|
+
return {column: str.col, row: str.row};
|
1044
|
+
}),
|
1045
|
+
|
1046
|
+
"l": {
|
1047
|
+
nav: function(editor) {
|
1048
|
+
editor.navigateRight();
|
1049
|
+
},
|
1050
|
+
sel: function(editor) {
|
1051
|
+
var pos = editor.getCursorPosition();
|
1052
|
+
var col = pos.column;
|
1053
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
1054
|
+
|
1055
|
+
// Solving the behavior at the end of the line due to the
|
1056
|
+
// different 0 index-based colum positions in ACE.
|
1057
|
+
if (lineLen && col !== lineLen) //In selection mode you can select the newline
|
1058
|
+
editor.selection.selectRight();
|
1059
|
+
}
|
1060
|
+
},
|
1061
|
+
"h": {
|
1062
|
+
nav: function(editor) {
|
1063
|
+
var pos = editor.getCursorPosition();
|
1064
|
+
if (pos.column > 0)
|
1065
|
+
editor.navigateLeft();
|
1066
|
+
},
|
1067
|
+
sel: function(editor) {
|
1068
|
+
var pos = editor.getCursorPosition();
|
1069
|
+
if (pos.column > 0)
|
1070
|
+
editor.selection.selectLeft();
|
1071
|
+
}
|
1072
|
+
},
|
1073
|
+
"k": {
|
1074
|
+
nav: function(editor) {
|
1075
|
+
editor.navigateUp();
|
1076
|
+
},
|
1077
|
+
sel: function(editor) {
|
1078
|
+
editor.selection.selectUp();
|
1079
|
+
}
|
1080
|
+
},
|
1081
|
+
"j": {
|
1082
|
+
nav: function(editor) {
|
1083
|
+
editor.navigateDown();
|
1084
|
+
},
|
1085
|
+
sel: function(editor) {
|
1086
|
+
editor.selection.selectDown();
|
1087
|
+
}
|
1088
|
+
},
|
1089
|
+
|
1090
|
+
"i": {
|
1091
|
+
param: true,
|
1092
|
+
sel: function(editor, range, count, param) {
|
1093
|
+
switch (param) {
|
1094
|
+
case "w":
|
1095
|
+
editor.selection.selectWord();
|
1096
|
+
break;
|
1097
|
+
case "W":
|
1098
|
+
editor.selection.selectAWord();
|
1099
|
+
break;
|
1100
|
+
case "(":
|
1101
|
+
case "{":
|
1102
|
+
case "[":
|
1103
|
+
var cursor = editor.getCursorPosition();
|
1104
|
+
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
|
1105
|
+
if (!end)
|
1106
|
+
return;
|
1107
|
+
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
|
1108
|
+
if (!start)
|
1109
|
+
return;
|
1110
|
+
start.column ++;
|
1111
|
+
editor.selection.setSelectionRange(Range.fromPoints(start, end));
|
1112
|
+
break;
|
1113
|
+
case "'":
|
1114
|
+
case '"':
|
1115
|
+
case "/":
|
1116
|
+
var end = find(editor, param, 1);
|
1117
|
+
if (!end)
|
1118
|
+
return;
|
1119
|
+
var start = find(editor, param, -1);
|
1120
|
+
if (!start)
|
1121
|
+
return;
|
1122
|
+
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
|
1123
|
+
break;
|
1124
|
+
}
|
1125
|
+
}
|
1126
|
+
},
|
1127
|
+
"a": {
|
1128
|
+
param: true,
|
1129
|
+
sel: function(editor, range, count, param) {
|
1130
|
+
switch (param) {
|
1131
|
+
case "w":
|
1132
|
+
editor.selection.selectAWord();
|
1133
|
+
break;
|
1134
|
+
case "W":
|
1135
|
+
editor.selection.selectAWord();
|
1136
|
+
break;
|
1137
|
+
case "(":
|
1138
|
+
case "{":
|
1139
|
+
case "[":
|
1140
|
+
var cursor = editor.getCursorPosition();
|
1141
|
+
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
|
1142
|
+
if (!end)
|
1143
|
+
return;
|
1144
|
+
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
|
1145
|
+
if (!start)
|
1146
|
+
return;
|
1147
|
+
end.column ++;
|
1148
|
+
editor.selection.setSelectionRange(Range.fromPoints(start, end));
|
1149
|
+
break;
|
1150
|
+
case "'":
|
1151
|
+
case "\"":
|
1152
|
+
case "/":
|
1153
|
+
var end = find(editor, param, 1);
|
1154
|
+
if (!end)
|
1155
|
+
return;
|
1156
|
+
var start = find(editor, param, -1);
|
1157
|
+
if (!start)
|
1158
|
+
return;
|
1159
|
+
end.column ++;
|
1160
|
+
editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
|
1161
|
+
break;
|
1162
|
+
}
|
1163
|
+
}
|
1164
|
+
},
|
1165
|
+
|
1166
|
+
"f": {
|
1167
|
+
param: true,
|
1168
|
+
handlesCount: true,
|
1169
|
+
nav: function(editor, range, count, param) {
|
1170
|
+
var ed = editor;
|
1171
|
+
var cursor = ed.getCursorPosition();
|
1172
|
+
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
1173
|
+
|
1174
|
+
if (typeof column === "number") {
|
1175
|
+
ed.selection.clearSelection(); // Why does it select in the first place?
|
1176
|
+
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
|
1177
|
+
}
|
1178
|
+
},
|
1179
|
+
sel: function(editor, range, count, param) {
|
1180
|
+
var ed = editor;
|
1181
|
+
var cursor = ed.getCursorPosition();
|
1182
|
+
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
1183
|
+
|
1184
|
+
if (typeof column === "number") {
|
1185
|
+
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
|
1186
|
+
}
|
1187
|
+
}
|
1188
|
+
},
|
1189
|
+
"F": {
|
1190
|
+
param: true,
|
1191
|
+
handlesCount: true,
|
1192
|
+
nav: function(editor, range, count, param) {
|
1193
|
+
var ed = editor;
|
1194
|
+
var cursor = ed.getCursorPosition();
|
1195
|
+
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
1196
|
+
|
1197
|
+
if (typeof column === "number") {
|
1198
|
+
ed.selection.clearSelection(); // Why does it select in the first place?
|
1199
|
+
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
|
1200
|
+
}
|
1201
|
+
},
|
1202
|
+
sel: function(editor, range, count, param) {
|
1203
|
+
var ed = editor;
|
1204
|
+
var cursor = ed.getCursorPosition();
|
1205
|
+
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
1206
|
+
|
1207
|
+
if (typeof column === "number") {
|
1208
|
+
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
},
|
1212
|
+
"t": {
|
1213
|
+
param: true,
|
1214
|
+
handlesCount: true,
|
1215
|
+
nav: function(editor, range, count, param) {
|
1216
|
+
var ed = editor;
|
1217
|
+
var cursor = ed.getCursorPosition();
|
1218
|
+
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
1219
|
+
|
1220
|
+
if (typeof column === "number") {
|
1221
|
+
ed.selection.clearSelection(); // Why does it select in the first place?
|
1222
|
+
ed.moveCursorTo(cursor.row, column + cursor.column);
|
1223
|
+
}
|
1224
|
+
},
|
1225
|
+
sel: function(editor, range, count, param) {
|
1226
|
+
var ed = editor;
|
1227
|
+
var cursor = ed.getCursorPosition();
|
1228
|
+
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
1229
|
+
|
1230
|
+
if (typeof column === "number") {
|
1231
|
+
ed.moveCursorTo(cursor.row, column + cursor.column);
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
},
|
1235
|
+
"T": {
|
1236
|
+
param: true,
|
1237
|
+
handlesCount: true,
|
1238
|
+
nav: function(editor, range, count, param) {
|
1239
|
+
var ed = editor;
|
1240
|
+
var cursor = ed.getCursorPosition();
|
1241
|
+
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
1242
|
+
|
1243
|
+
if (typeof column === "number") {
|
1244
|
+
ed.selection.clearSelection(); // Why does it select in the first place?
|
1245
|
+
ed.moveCursorTo(cursor.row, -column + cursor.column);
|
1246
|
+
}
|
1247
|
+
},
|
1248
|
+
sel: function(editor, range, count, param) {
|
1249
|
+
var ed = editor;
|
1250
|
+
var cursor = ed.getCursorPosition();
|
1251
|
+
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
1252
|
+
|
1253
|
+
if (typeof column === "number") {
|
1254
|
+
ed.moveCursorTo(cursor.row, -column + cursor.column);
|
1255
|
+
}
|
1256
|
+
}
|
1257
|
+
},
|
1258
|
+
|
1259
|
+
"^": {
|
1260
|
+
nav: function(editor) {
|
1261
|
+
editor.navigateLineStart();
|
1262
|
+
},
|
1263
|
+
sel: function(editor) {
|
1264
|
+
editor.selection.selectLineStart();
|
1265
|
+
}
|
1266
|
+
},
|
1267
|
+
"$": {
|
1268
|
+
nav: function(editor) {
|
1269
|
+
editor.navigateLineEnd();
|
1270
|
+
},
|
1271
|
+
sel: function(editor) {
|
1272
|
+
editor.selection.selectLineEnd();
|
1273
|
+
}
|
1274
|
+
},
|
1275
|
+
"0": new Motion(function(ed) {
|
1276
|
+
return {row: ed.selection.lead.row, column: 0};
|
1277
|
+
}),
|
1278
|
+
"G": {
|
1279
|
+
nav: function(editor, range, count, param) {
|
1280
|
+
if (!count && count !== 0) { // Stupid JS
|
1281
|
+
count = editor.session.getLength();
|
1282
|
+
}
|
1283
|
+
editor.gotoLine(count);
|
1284
|
+
},
|
1285
|
+
sel: function(editor, range, count, param) {
|
1286
|
+
if (!count && count !== 0) { // Stupid JS
|
1287
|
+
count = editor.session.getLength();
|
1288
|
+
}
|
1289
|
+
editor.selection.selectTo(count, 0);
|
1290
|
+
}
|
1291
|
+
},
|
1292
|
+
"g": {
|
1293
|
+
param: true,
|
1294
|
+
nav: function(editor, range, count, param) {
|
1295
|
+
switch(param) {
|
1296
|
+
case "m":
|
1297
|
+
console.log("Middle line");
|
1298
|
+
break;
|
1299
|
+
case "e":
|
1300
|
+
console.log("End of prev word");
|
1301
|
+
break;
|
1302
|
+
case "g":
|
1303
|
+
editor.gotoLine(count || 0);
|
1304
|
+
case "u":
|
1305
|
+
editor.gotoLine(count || 0);
|
1306
|
+
case "U":
|
1307
|
+
editor.gotoLine(count || 0);
|
1308
|
+
}
|
1309
|
+
},
|
1310
|
+
sel: function(editor, range, count, param) {
|
1311
|
+
switch(param) {
|
1312
|
+
case "m":
|
1313
|
+
console.log("Middle line");
|
1314
|
+
break;
|
1315
|
+
case "e":
|
1316
|
+
console.log("End of prev word");
|
1317
|
+
break;
|
1318
|
+
case "g":
|
1319
|
+
editor.selection.selectTo(count || 0, 0);
|
1320
|
+
}
|
1321
|
+
}
|
1322
|
+
},
|
1323
|
+
"o": {
|
1324
|
+
nav: function(editor, range, count, param) {
|
1325
|
+
count = count || 1;
|
1326
|
+
var content = "";
|
1327
|
+
while (0 < count--)
|
1328
|
+
content += "\n";
|
1329
|
+
|
1330
|
+
if (content.length) {
|
1331
|
+
editor.navigateLineEnd()
|
1332
|
+
editor.insert(content);
|
1333
|
+
util.insertMode(editor);
|
1334
|
+
}
|
1335
|
+
}
|
1336
|
+
},
|
1337
|
+
"O": {
|
1338
|
+
nav: function(editor, range, count, param) {
|
1339
|
+
var row = editor.getCursorPosition().row;
|
1340
|
+
count = count || 1;
|
1341
|
+
var content = "";
|
1342
|
+
while (0 < count--)
|
1343
|
+
content += "\n";
|
1344
|
+
|
1345
|
+
if (content.length) {
|
1346
|
+
if(row > 0) {
|
1347
|
+
editor.navigateUp();
|
1348
|
+
editor.navigateLineEnd()
|
1349
|
+
editor.insert(content);
|
1350
|
+
} else {
|
1351
|
+
editor.session.insert({row: 0, column: 0}, content);
|
1352
|
+
editor.navigateUp();
|
1353
|
+
}
|
1354
|
+
util.insertMode(editor);
|
1355
|
+
}
|
1356
|
+
}
|
1357
|
+
},
|
1358
|
+
"%": new Motion(function(editor){
|
1359
|
+
var brRe = /[\[\]{}()]/g;
|
1360
|
+
var cursor = editor.getCursorPosition();
|
1361
|
+
var ch = editor.session.getLine(cursor.row)[cursor.column];
|
1362
|
+
if (!brRe.test(ch)) {
|
1363
|
+
var range = find(editor, brRe);
|
1364
|
+
if (!range)
|
1365
|
+
return;
|
1366
|
+
cursor = range.start;
|
1367
|
+
}
|
1368
|
+
var match = editor.session.findMatchingBracket({
|
1369
|
+
row: cursor.row,
|
1370
|
+
column: cursor.column + 1
|
1371
|
+
});
|
1372
|
+
|
1373
|
+
return match;
|
1374
|
+
}),
|
1375
|
+
"ctrl-d": {
|
1376
|
+
nav: function(editor, range, count, param) {
|
1377
|
+
editor.selection.clearSelection();
|
1378
|
+
keepScrollPosition(editor, editor.gotoPageDown);
|
1379
|
+
},
|
1380
|
+
sel: function(editor, range, count, param) {
|
1381
|
+
keepScrollPosition(editor, editor.selectPageDown);
|
1382
|
+
}
|
1383
|
+
},
|
1384
|
+
"ctrl-u": {
|
1385
|
+
nav: function(editor, range, count, param) {
|
1386
|
+
editor.selection.clearSelection();
|
1387
|
+
keepScrollPosition(editor, editor.gotoPageUp);
|
1388
|
+
|
1389
|
+
},
|
1390
|
+
sel: function(editor, range, count, param) {
|
1391
|
+
keepScrollPosition(editor, editor.selectPageUp);
|
1392
|
+
}
|
1393
|
+
},
|
1394
|
+
};
|
1395
|
+
|
1396
|
+
module.exports.backspace = module.exports.left = module.exports.h;
|
1397
|
+
module.exports.right = module.exports.l;
|
1398
|
+
module.exports.up = module.exports.k;
|
1399
|
+
module.exports.down = module.exports.j;
|
1400
|
+
module.exports.pagedown = module.exports["ctrl-d"];
|
1401
|
+
module.exports.pageup = module.exports["ctrl-u"];
|
1402
|
+
|
1403
|
+
});
|
1404
|
+
|
1405
|
+
define('ace/keyboard/vim/maps/operators', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/registers'], function(require, exports, module) {
|
1406
|
+
|
1407
|
+
"never use strict";
|
1408
|
+
|
1409
|
+
var util = require("./util");
|
1410
|
+
var registers = require("../registers");
|
1411
|
+
|
1412
|
+
module.exports = {
|
1413
|
+
"d": {
|
1414
|
+
selFn: function(editor, range, count, param) {
|
1415
|
+
registers._default.text = editor.getCopyText();
|
1416
|
+
registers._default.isLine = util.onVisualLineMode;
|
1417
|
+
if(util.onVisualLineMode)
|
1418
|
+
editor.removeLines();
|
1419
|
+
else
|
1420
|
+
editor.session.remove(range);
|
1421
|
+
util.normalMode(editor);
|
1422
|
+
},
|
1423
|
+
fn: function(editor, range, count, param) {
|
1424
|
+
count = count || 1;
|
1425
|
+
switch (param) {
|
1426
|
+
case "d":
|
1427
|
+
registers._default.text = "";
|
1428
|
+
registers._default.isLine = true;
|
1429
|
+
for (var i = 0; i < count; i++) {
|
1430
|
+
editor.selection.selectLine();
|
1431
|
+
registers._default.text += editor.getCopyText();
|
1432
|
+
var selRange = editor.getSelectionRange();
|
1433
|
+
// check if end of the document was reached
|
1434
|
+
if (!selRange.isMultiLine()) {
|
1435
|
+
lastLineReached = true
|
1436
|
+
var row = selRange.start.row - 1;
|
1437
|
+
var col = editor.session.getLine(row).length
|
1438
|
+
selRange.setStart(row, col);
|
1439
|
+
editor.session.remove(selRange);
|
1440
|
+
editor.selection.clearSelection();
|
1441
|
+
break;
|
1442
|
+
}
|
1443
|
+
editor.session.remove(selRange);
|
1444
|
+
editor.selection.clearSelection();
|
1445
|
+
}
|
1446
|
+
registers._default.text = registers._default.text.replace(/\n$/, "");
|
1447
|
+
break;
|
1448
|
+
default:
|
1449
|
+
if (range) {
|
1450
|
+
editor.selection.setSelectionRange(range);
|
1451
|
+
registers._default.text = editor.getCopyText();
|
1452
|
+
registers._default.isLine = false;
|
1453
|
+
editor.session.remove(range);
|
1454
|
+
editor.selection.clearSelection();
|
1455
|
+
}
|
1456
|
+
}
|
1457
|
+
}
|
1458
|
+
},
|
1459
|
+
"c": {
|
1460
|
+
selFn: function(editor, range, count, param) {
|
1461
|
+
editor.session.remove(range);
|
1462
|
+
util.insertMode(editor);
|
1463
|
+
},
|
1464
|
+
fn: function(editor, range, count, param) {
|
1465
|
+
count = count || 1;
|
1466
|
+
switch (param) {
|
1467
|
+
case "c":
|
1468
|
+
for (var i = 0; i < count; i++) {
|
1469
|
+
editor.removeLines();
|
1470
|
+
util.insertMode(editor);
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
break;
|
1474
|
+
default:
|
1475
|
+
if (range) {
|
1476
|
+
|
1477
|
+
// range.end.column ++;
|
1478
|
+
editor.session.remove(range);
|
1479
|
+
util.insertMode(editor);
|
1480
|
+
}
|
1481
|
+
}
|
1482
|
+
}
|
1483
|
+
},
|
1484
|
+
"y": {
|
1485
|
+
selFn: function(editor, range, count, param) {
|
1486
|
+
registers._default.text = editor.getCopyText();
|
1487
|
+
registers._default.isLine = util.onVisualLineMode;
|
1488
|
+
editor.selection.clearSelection();
|
1489
|
+
util.normalMode(editor);
|
1490
|
+
},
|
1491
|
+
fn: function(editor, range, count, param) {
|
1492
|
+
count = count || 1;
|
1493
|
+
switch (param) {
|
1494
|
+
case "y":
|
1495
|
+
var pos = editor.getCursorPosition();
|
1496
|
+
editor.selection.selectLine();
|
1497
|
+
for (var i = 0; i < count - 1; i++) {
|
1498
|
+
editor.selection.moveCursorDown();
|
1499
|
+
}
|
1500
|
+
registers._default.text = editor.getCopyText().replace(/\n$/, "");
|
1501
|
+
editor.selection.clearSelection();
|
1502
|
+
registers._default.isLine = true;
|
1503
|
+
editor.moveCursorToPosition(pos);
|
1504
|
+
break;
|
1505
|
+
default:
|
1506
|
+
if (range) {
|
1507
|
+
var pos = editor.getCursorPosition();
|
1508
|
+
editor.selection.setSelectionRange(range);
|
1509
|
+
registers._default.text = editor.getCopyText();
|
1510
|
+
registers._default.isLine = false;
|
1511
|
+
editor.selection.clearSelection();
|
1512
|
+
editor.moveCursorTo(pos.row, pos.column);
|
1513
|
+
}
|
1514
|
+
}
|
1515
|
+
}
|
1516
|
+
},
|
1517
|
+
">": {
|
1518
|
+
selFn: function(editor, range, count, param) {
|
1519
|
+
count = count || 1;
|
1520
|
+
for (var i = 0; i < count; i++) {
|
1521
|
+
editor.indent();
|
1522
|
+
}
|
1523
|
+
util.normalMode(editor);
|
1524
|
+
},
|
1525
|
+
fn: function(editor, range, count, param) {
|
1526
|
+
count = parseInt(count || 1, 10);
|
1527
|
+
switch (param) {
|
1528
|
+
case ">":
|
1529
|
+
var pos = editor.getCursorPosition();
|
1530
|
+
editor.selection.selectLine();
|
1531
|
+
for (var i = 0; i < count - 1; i++) {
|
1532
|
+
editor.selection.moveCursorDown();
|
1533
|
+
}
|
1534
|
+
editor.indent();
|
1535
|
+
editor.selection.clearSelection();
|
1536
|
+
editor.moveCursorToPosition(pos);
|
1537
|
+
editor.navigateLineEnd();
|
1538
|
+
editor.navigateLineStart();
|
1539
|
+
break;
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
},
|
1543
|
+
"<": {
|
1544
|
+
selFn: function(editor, range, count, param) {
|
1545
|
+
count = count || 1;
|
1546
|
+
for (var i = 0; i < count; i++) {
|
1547
|
+
editor.blockOutdent();
|
1548
|
+
}
|
1549
|
+
util.normalMode(editor);
|
1550
|
+
},
|
1551
|
+
fn: function(editor, range, count, param) {
|
1552
|
+
count = count || 1;
|
1553
|
+
switch (param) {
|
1554
|
+
case "<":
|
1555
|
+
var pos = editor.getCursorPosition();
|
1556
|
+
editor.selection.selectLine();
|
1557
|
+
for (var i = 0; i < count - 1; i++) {
|
1558
|
+
editor.selection.moveCursorDown();
|
1559
|
+
}
|
1560
|
+
editor.blockOutdent();
|
1561
|
+
editor.selection.clearSelection();
|
1562
|
+
editor.moveCursorToPosition(pos);
|
1563
|
+
editor.navigateLineEnd();
|
1564
|
+
editor.navigateLineStart();
|
1565
|
+
break;
|
1566
|
+
}
|
1567
|
+
}
|
1568
|
+
}
|
1569
|
+
};
|
1570
|
+
});
|
1571
|
+
|
1572
|
+
"use strict"
|
1573
|
+
|
1574
|
+
define('ace/keyboard/vim/maps/aliases', ['require', 'exports', 'module' ], function(require, exports, module) {
|
1575
|
+
module.exports = {
|
1576
|
+
"x": {
|
1577
|
+
operator: {
|
1578
|
+
char: "d",
|
1579
|
+
count: 1
|
1580
|
+
},
|
1581
|
+
motion: {
|
1582
|
+
char: "l",
|
1583
|
+
count: 1
|
1584
|
+
}
|
1585
|
+
},
|
1586
|
+
"X": {
|
1587
|
+
operator: {
|
1588
|
+
char: "d",
|
1589
|
+
count: 1
|
1590
|
+
},
|
1591
|
+
motion: {
|
1592
|
+
char: "h",
|
1593
|
+
count: 1
|
1594
|
+
}
|
1595
|
+
},
|
1596
|
+
"D": {
|
1597
|
+
operator: {
|
1598
|
+
char: "d",
|
1599
|
+
count: 1
|
1600
|
+
},
|
1601
|
+
motion: {
|
1602
|
+
char: "$",
|
1603
|
+
count: 1
|
1604
|
+
}
|
1605
|
+
},
|
1606
|
+
"C": {
|
1607
|
+
operator: {
|
1608
|
+
char: "c",
|
1609
|
+
count: 1
|
1610
|
+
},
|
1611
|
+
motion: {
|
1612
|
+
char: "$",
|
1613
|
+
count: 1
|
1614
|
+
}
|
1615
|
+
},
|
1616
|
+
"s": {
|
1617
|
+
operator: {
|
1618
|
+
char: "c",
|
1619
|
+
count: 1
|
1620
|
+
},
|
1621
|
+
motion: {
|
1622
|
+
char: "l",
|
1623
|
+
count: 1
|
1624
|
+
}
|
1625
|
+
},
|
1626
|
+
"S": {
|
1627
|
+
operator: {
|
1628
|
+
char: "c",
|
1629
|
+
count: 1
|
1630
|
+
},
|
1631
|
+
param: "c"
|
1632
|
+
}
|
1633
|
+
};
|
1634
|
+
});
|
1635
|
+
|