ace-rails-ap 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -1
  3. data/lib/ace/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/ace/ace.js +6911 -5290
  5. data/vendor/assets/javascripts/ace/ext-chromevox.js +537 -0
  6. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +301 -0
  7. data/vendor/assets/javascripts/ace/ext-emmet.js +1109 -0
  8. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +207 -0
  9. data/vendor/assets/javascripts/ace/ext-language_tools.js +1665 -0
  10. data/vendor/assets/javascripts/ace/ext-modelist.js +168 -0
  11. data/vendor/assets/javascripts/ace/ext-old_ie.js +500 -0
  12. data/vendor/assets/javascripts/ace/ext-options.js +252 -0
  13. data/vendor/assets/javascripts/ace/ext-searchbox.js +421 -0
  14. data/vendor/assets/javascripts/ace/ext-settings_menu.js +632 -0
  15. data/vendor/assets/javascripts/ace/ext-spellcheck.js +68 -0
  16. data/vendor/assets/javascripts/ace/ext-split.js +271 -0
  17. data/vendor/assets/javascripts/ace/ext-static_highlight.js +178 -0
  18. data/vendor/assets/javascripts/ace/ext-statusbar.js +47 -0
  19. data/vendor/assets/javascripts/ace/ext-textarea.js +478 -0
  20. data/vendor/assets/javascripts/ace/ext-themelist.js +86 -0
  21. data/vendor/assets/javascripts/ace/ext-whitespace.js +206 -0
  22. data/vendor/assets/javascripts/ace/keybinding-emacs.js +822 -131
  23. data/vendor/assets/javascripts/ace/keybinding-vim.js +382 -258
  24. data/vendor/assets/javascripts/ace/mode-abap.js +261 -0
  25. data/vendor/assets/javascripts/ace/mode-actionscript.js +257 -0
  26. data/vendor/assets/javascripts/ace/mode-ada.js +118 -0
  27. data/vendor/assets/javascripts/ace/mode-asciidoc.js +373 -0
  28. data/vendor/assets/javascripts/ace/mode-assembly_x86.js +217 -0
  29. data/vendor/assets/javascripts/ace/mode-autohotkey.js +225 -0
  30. data/vendor/assets/javascripts/ace/mode-batchfile.js +213 -0
  31. data/vendor/assets/javascripts/ace/mode-c9search.js +144 -124
  32. data/vendor/assets/javascripts/ace/mode-c_cpp.js +296 -254
  33. data/vendor/assets/javascripts/ace/mode-clojure.js +113 -177
  34. data/vendor/assets/javascripts/ace/mode-cobol.js +125 -0
  35. data/vendor/assets/javascripts/ace/mode-coffee.js +152 -235
  36. data/vendor/assets/javascripts/ace/mode-coldfusion.js +823 -835
  37. data/vendor/assets/javascripts/ace/mode-csharp.js +325 -187
  38. data/vendor/assets/javascripts/ace/mode-css.js +583 -297
  39. data/vendor/assets/javascripts/ace/mode-curly.js +2423 -0
  40. data/vendor/assets/javascripts/ace/mode-d.js +492 -0
  41. data/vendor/assets/javascripts/ace/mode-dart.js +993 -0
  42. data/vendor/assets/javascripts/ace/mode-diff.js +124 -204
  43. data/vendor/assets/javascripts/ace/mode-django.js +2448 -0
  44. data/vendor/assets/javascripts/ace/mode-dot.js +361 -0
  45. data/vendor/assets/javascripts/ace/mode-ejs.js +2817 -0
  46. data/vendor/assets/javascripts/ace/mode-erlang.js +987 -0
  47. data/vendor/assets/javascripts/ace/mode-forth.js +280 -0
  48. data/vendor/assets/javascripts/ace/mode-ftl.js +1061 -0
  49. data/vendor/assets/javascripts/ace/mode-glsl.js +313 -275
  50. data/vendor/assets/javascripts/ace/mode-golang.js +268 -275
  51. data/vendor/assets/javascripts/ace/mode-groovy.js +347 -492
  52. data/vendor/assets/javascripts/ace/mode-haml.js +498 -0
  53. data/vendor/assets/javascripts/ace/mode-handlebars.js +2433 -0
  54. data/vendor/assets/javascripts/ace/mode-haskell.js +362 -0
  55. data/vendor/assets/javascripts/ace/mode-haxe.js +226 -202
  56. data/vendor/assets/javascripts/ace/mode-html.js +1099 -802
  57. data/vendor/assets/javascripts/ace/mode-html_completions.js +309 -0
  58. data/vendor/assets/javascripts/ace/mode-html_ruby.js +2822 -0
  59. data/vendor/assets/javascripts/ace/mode-ini.js +185 -0
  60. data/vendor/assets/javascripts/ace/mode-jack.js +653 -0
  61. data/vendor/assets/javascripts/ace/mode-jade.js +2081 -0
  62. data/vendor/assets/javascripts/ace/mode-java.js +339 -488
  63. data/vendor/assets/javascripts/ace/mode-javascript.js +342 -478
  64. data/vendor/assets/javascripts/ace/mode-json.js +215 -178
  65. data/vendor/assets/javascripts/ace/mode-jsoniq.js +2761 -0
  66. data/vendor/assets/javascripts/ace/mode-jsp.js +1553 -0
  67. data/vendor/assets/javascripts/ace/mode-jsx.js +325 -289
  68. data/vendor/assets/javascripts/ace/mode-julia.js +286 -0
  69. data/vendor/assets/javascripts/ace/mode-latex.js +141 -46
  70. data/vendor/assets/javascripts/ace/mode-less.js +493 -151
  71. data/vendor/assets/javascripts/ace/mode-liquid.js +594 -656
  72. data/vendor/assets/javascripts/ace/mode-lisp.js +137 -0
  73. data/vendor/assets/javascripts/ace/mode-livescript.js +288 -0
  74. data/vendor/assets/javascripts/ace/mode-logiql.js +669 -0
  75. data/vendor/assets/javascripts/ace/mode-lsl.js +890 -0
  76. data/vendor/assets/javascripts/ace/mode-lua.js +274 -368
  77. data/vendor/assets/javascripts/ace/mode-luapage.js +1331 -1107
  78. data/vendor/assets/javascripts/ace/mode-lucene.js +64 -0
  79. data/vendor/assets/javascripts/ace/mode-makefile.js +332 -0
  80. data/vendor/assets/javascripts/ace/mode-markdown.js +1303 -948
  81. data/vendor/assets/javascripts/ace/mode-matlab.js +230 -0
  82. data/vendor/assets/javascripts/ace/mode-mushcode.js +705 -0
  83. data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +569 -0
  84. data/vendor/assets/javascripts/ace/mode-mysql.js +185 -0
  85. data/vendor/assets/javascripts/ace/mode-nix.js +935 -0
  86. data/vendor/assets/javascripts/ace/mode-objectivec.js +699 -0
  87. data/vendor/assets/javascripts/ace/mode-ocaml.js +44 -63
  88. data/vendor/assets/javascripts/ace/mode-pascal.js +233 -0
  89. data/vendor/assets/javascripts/ace/mode-perl.js +116 -189
  90. data/vendor/assets/javascripts/ace/mode-pgsql.js +886 -500
  91. data/vendor/assets/javascripts/ace/mode-php.js +1158 -380
  92. data/vendor/assets/javascripts/ace/mode-plain_text.js +56 -0
  93. data/vendor/assets/javascripts/ace/mode-powershell.js +222 -167
  94. data/vendor/assets/javascripts/ace/mode-prolog.js +354 -0
  95. data/vendor/assets/javascripts/ace/mode-properties.js +100 -0
  96. data/vendor/assets/javascripts/ace/mode-protobuf.js +885 -0
  97. data/vendor/assets/javascripts/ace/mode-python.js +99 -201
  98. data/vendor/assets/javascripts/ace/mode-r.js +337 -0
  99. data/vendor/assets/javascripts/ace/mode-rdoc.js +210 -0
  100. data/vendor/assets/javascripts/ace/mode-rhtml.js +2663 -0
  101. data/vendor/assets/javascripts/ace/mode-ruby.js +262 -136
  102. data/vendor/assets/javascripts/ace/mode-rust.js +245 -0
  103. data/vendor/assets/javascripts/ace/mode-sass.js +443 -0
  104. data/vendor/assets/javascripts/ace/mode-scad.js +225 -240
  105. data/vendor/assets/javascripts/ace/mode-scala.js +340 -494
  106. data/vendor/assets/javascripts/ace/mode-scheme.js +143 -0
  107. data/vendor/assets/javascripts/ace/mode-scss.js +499 -157
  108. data/vendor/assets/javascripts/ace/mode-sh.js +180 -110
  109. data/vendor/assets/javascripts/ace/mode-sjs.js +1154 -0
  110. data/vendor/assets/javascripts/ace/mode-snippets.js +198 -0
  111. data/vendor/assets/javascripts/ace/mode-soy_template.js +2707 -0
  112. data/vendor/assets/javascripts/ace/mode-space.js +160 -0
  113. data/vendor/assets/javascripts/ace/mode-sql.js +48 -69
  114. data/vendor/assets/javascripts/ace/mode-stylus.js +447 -0
  115. data/vendor/assets/javascripts/ace/mode-svg.js +552 -605
  116. data/vendor/assets/javascripts/ace/mode-tcl.js +139 -98
  117. data/vendor/assets/javascripts/ace/mode-tex.js +187 -0
  118. data/vendor/assets/javascripts/ace/mode-textile.js +29 -40
  119. data/vendor/assets/javascripts/ace/mode-tmsnippet.js +200 -0
  120. data/vendor/assets/javascripts/ace/mode-toml.js +177 -0
  121. data/vendor/assets/javascripts/ace/mode-twig.js +2228 -0
  122. data/vendor/assets/javascripts/ace/mode-typescript.js +1018 -0
  123. data/vendor/assets/javascripts/ace/mode-vbscript.js +250 -0
  124. data/vendor/assets/javascripts/ace/mode-velocity.js +1621 -0
  125. data/vendor/assets/javascripts/ace/mode-verilog.js +127 -0
  126. data/vendor/assets/javascripts/ace/mode-vhdl.js +139 -0
  127. data/vendor/assets/javascripts/ace/mode-xml.js +350 -242
  128. data/vendor/assets/javascripts/ace/mode-xquery.js +2490 -300
  129. data/vendor/assets/javascripts/ace/mode-yaml.js +146 -45
  130. data/vendor/assets/javascripts/ace/theme-ambiance.js +202 -0
  131. data/vendor/assets/javascripts/ace/theme-chaos.js +179 -0
  132. data/vendor/assets/javascripts/ace/theme-chrome.js +97 -153
  133. data/vendor/assets/javascripts/ace/theme-clouds.js +78 -119
  134. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +79 -120
  135. data/vendor/assets/javascripts/ace/theme-cobalt.js +89 -140
  136. data/vendor/assets/javascripts/ace/theme-crimson_editor.js +93 -145
  137. data/vendor/assets/javascripts/ace/theme-dawn.js +84 -143
  138. data/vendor/assets/javascripts/ace/theme-dreamweaver.js +99 -162
  139. data/vendor/assets/javascripts/ace/theme-eclipse.js +78 -111
  140. data/vendor/assets/javascripts/ace/theme-github.js +70 -121
  141. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +75 -134
  142. data/vendor/assets/javascripts/ace/theme-kr.js +135 -0
  143. data/vendor/assets/javascripts/ace/theme-merbivore.js +80 -143
  144. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +81 -149
  145. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +87 -146
  146. data/vendor/assets/javascripts/ace/theme-monokai.js +88 -146
  147. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +82 -142
  148. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +83 -144
  149. data/vendor/assets/javascripts/ace/theme-solarized_light.js +76 -133
  150. data/vendor/assets/javascripts/ace/theme-terminal.js +145 -0
  151. data/vendor/assets/javascripts/ace/theme-textmate.js +101 -158
  152. data/vendor/assets/javascripts/ace/theme-tomorrow.js +89 -163
  153. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +89 -163
  154. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +89 -165
  155. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +101 -162
  156. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +90 -160
  157. data/vendor/assets/javascripts/ace/theme-twilight.js +87 -158
  158. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +75 -140
  159. data/vendor/assets/javascripts/ace/theme-xcode.js +120 -0
  160. data/vendor/assets/javascripts/ace/worker-coffee.js +3049 -2665
  161. data/vendor/assets/javascripts/ace/worker-css.js +1779 -4376
  162. data/vendor/assets/javascripts/ace/worker-javascript.js +8701 -9008
  163. data/vendor/assets/javascripts/ace/worker-json.js +709 -1340
  164. data/vendor/assets/javascripts/ace/worker-lua.js +3525 -0
  165. data/vendor/assets/javascripts/ace/worker-php.js +6893 -0
  166. data/vendor/assets/javascripts/ace/worker-xquery.js +19924 -64507
  167. metadata +100 -17
@@ -1,38 +1,30 @@
1
1
  /* ***** BEGIN LICENSE BLOCK *****
2
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
2
+ * Distributed under the BSD license:
3
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.
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.
36
28
  *
37
29
  * ***** END LICENSE BLOCK ***** */
38
30
 
@@ -66,50 +58,88 @@ var startCommands = {
66
58
  };
67
59
 
68
60
  exports.handler = {
69
- // workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true`
61
+ $id: "ace/keyboard/vim",
70
62
  handleMacRepeat: function(data, hashId, key) {
71
63
  if (hashId == -1) {
72
- // record key
73
64
  data.inputChar = key;
74
65
  data.lastEvent = "input";
75
66
  } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
76
- // check for repeated keypress
77
67
  if (data.lastEvent == "input") {
78
68
  data.lastEvent = "input1";
79
69
  } else if (data.lastEvent == "input1") {
80
- // simulate textinput
81
70
  return true;
82
71
  }
83
72
  } else {
84
- // reset
85
73
  data.$lastHash = hashId;
86
74
  data.$lastKey = key;
87
75
  data.lastEvent = "keypress";
88
76
  }
89
77
  },
78
+ updateMacCompositionHandlers: function(editor, enable) {
79
+ var onCompositionUpdateOverride = function(text) {
80
+ if (util.currentMode !== "insert") {
81
+ var el = this.textInput.getElement();
82
+ el.blur();
83
+ el.focus();
84
+ el.value = text;
85
+ } else {
86
+ this.onCompositionUpdateOrig(text);
87
+ }
88
+ };
89
+ var onCompositionStartOverride = function(text) {
90
+ if (util.currentMode === "insert") {
91
+ this.onCompositionStartOrig(text);
92
+ }
93
+ }
94
+ if (enable) {
95
+ if (!editor.onCompositionUpdateOrig) {
96
+ editor.onCompositionUpdateOrig = editor.onCompositionUpdate;
97
+ editor.onCompositionUpdate = onCompositionUpdateOverride;
98
+ editor.onCompositionStartOrig = editor.onCompositionStart;
99
+ editor.onCompositionStart = onCompositionStartOverride;
100
+ }
101
+ } else {
102
+ if (editor.onCompositionUpdateOrig) {
103
+ editor.onCompositionUpdate = editor.onCompositionUpdateOrig;
104
+ editor.onCompositionUpdateOrig = null;
105
+ editor.onCompositionStart = editor.onCompositionStartOrig;
106
+ editor.onCompositionStartOrig = null;
107
+ }
108
+ }
109
+ },
90
110
 
91
111
  handleKeyboard: function(data, hashId, key, keyCode, e) {
92
- // ignore command keys (shift, ctrl etc.)
93
112
  if (hashId != 0 && (key == "" || key == "\x00"))
94
113
  return null;
95
-
114
+
115
+ var editor = data.editor;
116
+
96
117
  if (hashId == 1)
97
118
  key = "ctrl-" + key;
98
-
99
- if (data.state == "start") {
119
+ if (key == "ctrl-c") {
120
+ if (!useragent.isMac && editor.getCopyText()) {
121
+ editor.once("copy", function() {
122
+ if (data.state == "start")
123
+ coreCommands.stop.exec(editor);
124
+ else
125
+ editor.selection.clearSelection();
126
+ });
127
+ return {command: "null", passEvent: true};
128
+ }
129
+ return {command: coreCommands.stop};
130
+ } else if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
131
+ return {command: coreCommands.stop};
132
+ } else if (data.state == "start") {
100
133
  if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
101
134
  hashId = -1;
102
135
  key = data.inputChar;
103
136
  }
104
137
 
105
- if (hashId == -1 || hashId == 1) {
138
+ if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) {
106
139
  if (cmds.inputBuffer.idle && startCommands[key])
107
140
  return startCommands[key];
108
- return {
109
- command: {
110
- exec: function(editor) {cmds.inputBuffer.push(editor, key);}
111
- }
112
- };
141
+ cmds.inputBuffer.push(editor, key);
142
+ return {command: "null", passEvent: false};
113
143
  } // if no modifier || shift: wait for input.
114
144
  else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
115
145
  return {command: "null", passEvent: true};
@@ -117,10 +147,7 @@ exports.handler = {
117
147
  return {command: coreCommands.stop};
118
148
  }
119
149
  } else {
120
- if (key == "esc" || key == "ctrl-[") {
121
- data.state = "start";
122
- return {command: coreCommands.stop};
123
- } else if (key == "ctrl-w") {
150
+ if (key == "ctrl-w") {
124
151
  return {command: "removewordleft"};
125
152
  }
126
153
  }
@@ -131,12 +158,15 @@ exports.handler = {
131
158
  if (util.currentMode !== "insert")
132
159
  cmds.coreCommands.stop.exec(editor);
133
160
  editor.$vimModeHandler = this;
161
+
162
+ this.updateMacCompositionHandlers(editor, true);
134
163
  },
135
164
 
136
165
  detach: function(editor) {
137
166
  editor.removeListener("click", exports.onCursorMove);
138
167
  util.noMode(editor);
139
168
  util.currentMode = "normal";
169
+ this.updateMacCompositionHandlers(editor, false);
140
170
  },
141
171
 
142
172
  actions: cmds.actions,
@@ -157,10 +187,11 @@ exports.onCursorMove = function(e) {
157
187
 
158
188
  });
159
189
 
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) {
190
+ define('ace/keyboard/vim/commands', ['require', 'exports', 'module' , 'ace/lib/lang', '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
191
 
162
192
  "never use strict";
163
193
 
194
+ var lang = require("../../lib/lang");
164
195
  var util = require("./maps/util");
165
196
  var motions = require("./maps/motions");
166
197
  var operators = require("./maps/operators");
@@ -203,13 +234,25 @@ var actions = exports.actions = {
203
234
  fn: function(editor, range, count, param) {
204
235
  switch (param) {
205
236
  case "z":
206
- editor.alignCursor(null, 0.5);
237
+ editor.renderer.alignCursor(null, 0.5);
207
238
  break;
208
239
  case "t":
209
- editor.alignCursor(null, 0);
240
+ editor.renderer.alignCursor(null, 0);
210
241
  break;
211
242
  case "b":
212
- editor.alignCursor(null, 1);
243
+ editor.renderer.alignCursor(null, 1);
244
+ break;
245
+ case "c":
246
+ editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}});
247
+ break;
248
+ case "o":
249
+ editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}});
250
+ break;
251
+ case "C":
252
+ editor.session.foldAll();
253
+ break;
254
+ case "O":
255
+ editor.session.unfold();
213
256
  break;
214
257
  }
215
258
  }
@@ -218,6 +261,8 @@ var actions = exports.actions = {
218
261
  param: true,
219
262
  fn: function(editor, range, count, param) {
220
263
  if (param && param.length) {
264
+ if (param.length > 1)
265
+ param = param == "return" ? "\n" : param == "tab" ? "\t" : param;
221
266
  repeat(function() { editor.insert(param); }, count || 1);
222
267
  editor.navigateLeft();
223
268
  }
@@ -262,6 +307,18 @@ var actions = exports.actions = {
262
307
  editor.selection.setSelectionRange(r, true);
263
308
  }
264
309
  },
310
+ "m": {
311
+ param: true,
312
+ fn: function(editor, range, count, param) {
313
+ var s = editor.session;
314
+ var markers = s.vimMarkers || (s.vimMarkers = {});
315
+ var c = editor.getCursorPosition();
316
+ if (!markers[param]) {
317
+ markers[param] = editor.session.doc.createAnchor(c);
318
+ }
319
+ markers[param].setPosition(c.row, c.column, true);
320
+ }
321
+ },
265
322
  "n": {
266
323
  fn: function(editor, range, count, param) {
267
324
  var options = editor.getLastSearchOptions();
@@ -300,8 +357,6 @@ var actions = exports.actions = {
300
357
  },
301
358
  "V": {
302
359
  fn: function(editor, range, count, param) {
303
- //editor.selection.selectLine();
304
- //editor.selection.selectLeft();
305
360
  var row = editor.getCursorPosition().row;
306
361
  editor.selection.clearSelection();
307
362
  editor.selection.moveCursorTo(row, 0);
@@ -324,13 +379,14 @@ var actions = exports.actions = {
324
379
  editor.setOverwrite(false);
325
380
  if (defaultReg.isLine) {
326
381
  var pos = editor.getCursorPosition();
327
- var lines = defaultReg.text.split("\n");
328
- editor.session.getDocument().insertLines(pos.row + 1, lines);
382
+ pos.column = editor.session.getLine(pos.row).length;
383
+ var text = lang.stringRepeat("\n" + defaultReg.text, count || 1);
384
+ editor.session.insert(pos, text);
329
385
  editor.moveCursorTo(pos.row + 1, 0);
330
386
  }
331
387
  else {
332
388
  editor.navigateRight();
333
- editor.insert(defaultReg.text);
389
+ editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
334
390
  editor.navigateLeft();
335
391
  }
336
392
  editor.setOverwrite(true);
@@ -344,12 +400,13 @@ var actions = exports.actions = {
344
400
 
345
401
  if (defaultReg.isLine) {
346
402
  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);
403
+ pos.column = 0;
404
+ var text = lang.stringRepeat(defaultReg.text + "\n", count || 1);
405
+ editor.session.insert(pos, text);
406
+ editor.moveCursorToPosition(pos);
350
407
  }
351
408
  else {
352
- editor.insert(defaultReg.text);
409
+ editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
353
410
  }
354
411
  editor.setOverwrite(true);
355
412
  editor.selection.clearSelection();
@@ -397,17 +454,23 @@ var actions = exports.actions = {
397
454
  },
398
455
  ":": {
399
456
  fn: function(editor, range, count, param) {
400
- // not implemented
457
+ var val = ":";
458
+ if (count > 1)
459
+ val = ".,.+" + count + val;
460
+ if (editor.showCommandLine)
461
+ editor.showCommandLine(val);
401
462
  }
402
463
  },
403
464
  "/": {
404
465
  fn: function(editor, range, count, param) {
405
- // not implemented
466
+ if (editor.showCommandLine)
467
+ editor.showCommandLine("/");
406
468
  }
407
469
  },
408
470
  "?": {
409
471
  fn: function(editor, range, count, param) {
410
- // not implemented
472
+ if (editor.showCommandLine)
473
+ editor.showCommandLine("?");
411
474
  }
412
475
  },
413
476
  ".": {
@@ -417,100 +480,112 @@ var actions = exports.actions = {
417
480
  if (previous) // If there is a previous action
418
481
  inputBuffer.exec(editor, previous.action, previous.param);
419
482
  }
483
+ },
484
+ "ctrl-x": {
485
+ fn: function(editor, range, count, param) {
486
+ editor.modifyNumber(-(count || 1));
487
+ }
488
+ },
489
+ "ctrl-a": {
490
+ fn: function(editor, range, count, param) {
491
+ editor.modifyNumber(count || 1);
492
+ }
420
493
  }
421
494
  };
422
495
 
423
496
  var inputBuffer = exports.inputBuffer = {
424
497
  accepting: [NUMBER, OPERATOR, MOTION, ACTION],
425
498
  currentCmd: null,
426
- //currentMode: 0,
427
499
  currentCount: "",
428
500
  status: "",
429
-
430
- // Types
431
501
  operator: null,
432
502
  motion: null,
433
503
 
434
504
  lastInsertCommands: [],
435
505
 
436
- push: function(editor, char, keyId) {
506
+ push: function(editor, ch, keyId) {
507
+ var status = this.status;
508
+ var isKeyHandled = true;
437
509
  this.idle = false;
438
510
  var wObj = this.waitingForParam;
511
+ if (/^numpad\d+$/i.test(ch))
512
+ ch = ch.substr(6);
513
+
439
514
  if (wObj) {
440
- this.exec(editor, wObj, char);
515
+ this.exec(editor, wObj, ch);
441
516
  }
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;
517
+ else if (!(ch === "0" && !this.currentCount.length) &&
518
+ (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) {
519
+ this.currentCount += ch;
447
520
  this.currentCmd = NUMBER;
448
521
  this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
449
522
  }
450
- else if (!this.operator && this.isAccepting(OPERATOR) && operators[char]) {
523
+ else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
451
524
  this.operator = {
452
- char: char,
525
+ ch: ch,
453
526
  count: this.getCount()
454
527
  };
455
528
  this.currentCmd = OPERATOR;
456
529
  this.accepting = [NUMBER, MOTION, ACTION];
457
530
  this.exec(editor, { operator: this.operator });
458
531
  }
459
- else if (motions[char] && this.isAccepting(MOTION)) {
532
+ else if (motions[ch] && this.isAccepting(MOTION)) {
460
533
  this.currentCmd = MOTION;
461
534
 
462
535
  var ctx = {
463
536
  operator: this.operator,
464
537
  motion: {
465
- char: char,
538
+ ch: ch,
466
539
  count: this.getCount()
467
540
  }
468
541
  };
469
542
 
470
- if (motions[char].param)
543
+ if (motions[ch].param)
471
544
  this.waitForParam(ctx);
472
545
  else
473
546
  this.exec(editor, ctx);
474
547
  }
475
- else if (alias[char] && this.isAccepting(MOTION)) {
476
- alias[char].operator.count = this.getCount();
477
- this.exec(editor, alias[char]);
548
+ else if (alias[ch] && this.isAccepting(MOTION)) {
549
+ alias[ch].operator.count = this.getCount();
550
+ this.exec(editor, alias[ch]);
478
551
  }
479
- else if (actions[char] && this.isAccepting(ACTION)) {
552
+ else if (actions[ch] && this.isAccepting(ACTION)) {
480
553
  var actionObj = {
481
554
  action: {
482
- fn: actions[char].fn,
555
+ fn: actions[ch].fn,
483
556
  count: this.getCount()
484
557
  }
485
558
  };
486
559
 
487
- if (actions[char].param) {
560
+ if (actions[ch].param) {
488
561
  this.waitForParam(actionObj);
489
562
  }
490
563
  else {
491
564
  this.exec(editor, actionObj);
492
565
  }
493
566
 
494
- if (actions[char].acceptsMotion)
567
+ if (actions[ch].acceptsMotion)
495
568
  this.idle = false;
496
569
  }
497
570
  else if (this.operator) {
498
- this.exec(editor, { operator: this.operator }, char);
571
+ this.operator.count = this.getCount();
572
+ this.exec(editor, { operator: this.operator }, ch);
499
573
  }
500
574
  else {
575
+ isKeyHandled = ch.length == 1;
501
576
  this.reset();
502
577
  }
503
578
 
504
579
  if (this.waitingForParam || this.motion || this.operator) {
505
- this.status += char;
580
+ this.status += ch;
506
581
  } else if (this.currentCount) {
507
582
  this.status = this.currentCount;
508
583
  } else if (this.status) {
509
584
  this.status = "";
510
- } else {
511
- return;
512
585
  }
513
- editor._emit("changeStatus");
586
+ if (this.status != status)
587
+ editor._emit("changeStatus");
588
+ return isKeyHandled;
514
589
  },
515
590
 
516
591
  waitForParam: function(cmd) {
@@ -539,18 +614,14 @@ var inputBuffer = exports.inputBuffer = {
539
614
  }
540
615
 
541
616
  if (o && !editor.selection.isEmpty()) {
542
- if (operators[o.char].selFn) {
543
- operators[o.char].selFn(editor, editor.getSelectionRange(), o.count, param);
617
+ if (operators[o.ch].selFn) {
618
+ operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
544
619
  this.reset();
545
620
  }
546
621
  return;
547
622
  }
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
623
  else if (!m && !a && o && param) {
553
- operators[o.char].fn(editor, null, o.count, param);
624
+ operators[o.ch].fn(editor, null, o.count, param);
554
625
  this.reset();
555
626
  }
556
627
  else if (m) {
@@ -563,7 +634,7 @@ var inputBuffer = exports.inputBuffer = {
563
634
  }
564
635
  };
565
636
 
566
- var motionObj = motions[m.char];
637
+ var motionObj = motions[m.ch];
567
638
  var selectable = motionObj.sel;
568
639
 
569
640
  if (!o) {
@@ -575,7 +646,7 @@ var inputBuffer = exports.inputBuffer = {
575
646
  else if (selectable) {
576
647
  repeat(function() {
577
648
  run(motionObj.sel);
578
- operators[o.char].fn(editor, editor.getSelectionRange(), o.count, param);
649
+ operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
579
650
  }, o.count || 1);
580
651
  }
581
652
  this.reset();
@@ -620,8 +691,6 @@ exports.coreCommands = {
620
691
  setPreviousCommand(startBeginning);
621
692
  }
622
693
  },
623
- // Stop Insert mode as soon as possible. Works like typing <Esc> in
624
- // insert mode.
625
694
  stop: {
626
695
  exec: function stop(editor) {
627
696
  inputBuffer.reset();
@@ -692,7 +761,7 @@ define('ace/keyboard/vim/maps/util', ['require', 'exports', 'module' , 'ace/keyb
692
761
  var registers = require("../registers");
693
762
 
694
763
  var dom = require("../../../lib/dom");
695
- dom.importCssString('.insert-mode. ace_cursor{\
764
+ dom.importCssString('.insert-mode .ace_cursor{\
696
765
  border-left: 2px solid #333333;\
697
766
  }\
698
767
  .ace_dark.insert-mode .ace_cursor{\
@@ -717,7 +786,6 @@ module.exports = {
717
786
  },
718
787
  insertMode: function(editor) {
719
788
  this.currentMode = 'insert';
720
- // Switch editor to insert mode
721
789
  editor.setStyle('insert-mode');
722
790
  editor.unsetStyle('normal-mode');
723
791
 
@@ -727,20 +795,17 @@ module.exports = {
727
795
  this.onVisualMode = false;
728
796
  this.onVisualLineMode = false;
729
797
  if(this.onInsertReplaySequence) {
730
- // Ok, we're apparently replaying ("."), so let's do it
731
798
  editor.commands.macro = this.onInsertReplaySequence;
732
799
  editor.commands.replay(editor);
733
800
  this.onInsertReplaySequence = null;
734
801
  this.normalMode(editor);
735
802
  } else {
736
803
  editor._emit("changeStatus");
737
- // Record any movements, insertions in insert mode
738
804
  if(!editor.commands.recording)
739
805
  editor.commands.toggleRecording(editor);
740
806
  }
741
807
  },
742
808
  normalMode: function(editor) {
743
- // Switch editor to normal mode
744
809
  this.currentMode = 'normal';
745
810
 
746
811
  editor.unsetStyle('insert-mode');
@@ -760,7 +825,6 @@ module.exports = {
760
825
  this.onVisualMode = false;
761
826
  this.onVisualLineMode = false;
762
827
  editor._emit("changeStatus");
763
- // Save recorded keystrokes
764
828
  if (editor.commands.recording) {
765
829
  editor.commands.toggleRecording(editor);
766
830
  return editor.commands.macro;
@@ -789,24 +853,24 @@ module.exports = {
789
853
  this.onVisualLineMode = false;
790
854
  }
791
855
  },
792
- getRightNthChar: function(editor, cursor, char, n) {
856
+ getRightNthChar: function(editor, cursor, ch, n) {
793
857
  var line = editor.getSession().getLine(cursor.row);
794
- var matches = line.substr(cursor.column + 1).split(char);
858
+ var matches = line.substr(cursor.column + 1).split(ch);
795
859
 
796
- return n < matches.length ? matches.slice(0, n).join(char).length : null;
860
+ return n < matches.length ? matches.slice(0, n).join(ch).length : null;
797
861
  },
798
- getLeftNthChar: function(editor, cursor, char, n) {
862
+ getLeftNthChar: function(editor, cursor, ch, n) {
799
863
  var line = editor.getSession().getLine(cursor.row);
800
- var matches = line.substr(0, cursor.column).split(char);
864
+ var matches = line.substr(0, cursor.column).split(ch);
801
865
 
802
- return n < matches.length ? matches.slice(-1 * n).join(char).length : null;
866
+ return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
803
867
  },
804
- toRealChar: function(char) {
805
- if (char.length === 1)
806
- return char;
868
+ toRealChar: function(ch) {
869
+ if (ch.length === 1)
870
+ return ch;
807
871
 
808
- if (/^shift-./.test(char))
809
- return char[char.length - 1].toUpperCase();
872
+ if (/^shift-./.test(ch))
873
+ return ch[ch.length - 1].toUpperCase();
810
874
  else
811
875
  return "";
812
876
  },
@@ -835,11 +899,11 @@ module.exports = {
835
899
  };
836
900
 
837
901
  });
838
-
839
- "use strict"
902
+
840
903
 
841
904
  define('ace/keyboard/vim/maps/motions', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/search', 'ace/range'], function(require, exports, module) {
842
905
 
906
+
843
907
  var util = require("./util");
844
908
 
845
909
  var keepScrollPosition = function(editor, fn) {
@@ -850,42 +914,27 @@ var keepScrollPosition = function(editor, fn) {
850
914
  editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
851
915
  };
852
916
 
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)
917
+ function Motion(m) {
918
+ if (typeof m == "function") {
919
+ var getPos = m;
920
+ m = this;
921
+ } else {
922
+ var getPos = m.getPos;
923
+ }
924
+ m.nav = function(editor, range, count, param) {
925
+ var a = getPos(editor, range, count, param, false);
926
+ if (!a)
862
927
  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
928
  editor.clearSelection();
871
929
  editor.moveCursorTo(a.row, a.column);
872
- }
873
- this.sel = function(editor){
874
- var r = getRange(editor);
875
- if (!r)
930
+ };
931
+ m.sel = function(editor, range, count, param) {
932
+ var a = getPos(editor, range, count, param, true);
933
+ if (!a)
876
934
  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
935
  editor.selection.selectTo(a.row, a.column);
888
- }
936
+ };
937
+ return m;
889
938
  }
890
939
 
891
940
  var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
@@ -898,20 +947,18 @@ var StringStream = function(editor, cursor) {
898
947
  this.row = cursor.row;
899
948
  this.col = cursor.column;
900
949
  var line = editor.session.getLine(this.row);
901
- var maxRow = editor.session.getLength()
902
- this.ch = line[this.col] || '\n'
950
+ var maxRow = editor.session.getLength();
951
+ this.ch = line[this.col] || '\n';
903
952
  this.skippedLines = 0;
904
953
 
905
954
  this.next = function() {
906
955
  this.ch = line[++this.col] || this.handleNewLine(1);
907
- //this.debug()
908
956
  return this.ch;
909
- }
957
+ };
910
958
  this.prev = function() {
911
959
  this.ch = line[--this.col] || this.handleNewLine(-1);
912
- //this.debug()
913
960
  return this.ch;
914
- }
961
+ };
915
962
  this.peek = function(dir) {
916
963
  var ch = line[this.col + dir];
917
964
  if (ch)
@@ -921,7 +968,7 @@ var StringStream = function(editor, cursor) {
921
968
  if (this.col == line.length - 1)
922
969
  return '\n';
923
970
  return editor.session.getLine(this.row + 1)[0] || '\n';
924
- }
971
+ };
925
972
 
926
973
  this.handleNewLine = function(dir) {
927
974
  if (dir == 1){
@@ -936,7 +983,7 @@ var StringStream = function(editor, cursor) {
936
983
  return line[0] || '\n';
937
984
  }
938
985
  if (dir == -1) {
939
- if (this.row == 0)
986
+ if (this.row === 0)
940
987
  return '';
941
988
  this.row --;
942
989
  line = editor.session.getLine(this.row);
@@ -944,13 +991,13 @@ var StringStream = function(editor, cursor) {
944
991
  this.skippedLines--;
945
992
  return '\n';
946
993
  }
947
- }
994
+ };
948
995
  this.debug = function() {
949
996
  console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
950
- }
951
- }
997
+ };
998
+ };
952
999
 
953
- var Search = require("ace/search").Search;
1000
+ var Search = require("../../../search").Search;
954
1001
  var search = new Search();
955
1002
 
956
1003
  function find(editor, needle, dir) {
@@ -959,7 +1006,9 @@ function find(editor, needle, dir) {
959
1006
  return search.find(editor.session);
960
1007
  }
961
1008
 
962
- var Range = require("ace/range").Range;
1009
+ var Range = require("../../../range").Range;
1010
+
1011
+ var LAST_SEARCH_MOTION = {};
963
1012
 
964
1013
  module.exports = {
965
1014
  "w": new Motion(function(editor) {
@@ -987,7 +1036,7 @@ module.exports = {
987
1036
  else
988
1037
  str.next();
989
1038
 
990
- return {column: str.col, row: str.row}
1039
+ return {column: str.col, row: str.row};
991
1040
  }),
992
1041
  "b": new Motion(function(editor) {
993
1042
  var str = new StringStream(editor);
@@ -1007,7 +1056,7 @@ module.exports = {
1007
1056
  return {column: str.col, row: str.row};
1008
1057
  }),
1009
1058
  "B": new Motion(function(editor) {
1010
- var str = new StringStream(editor)
1059
+ var str = new StringStream(editor);
1011
1060
  str.prev();
1012
1061
  while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
1013
1062
  str.prev();
@@ -1016,7 +1065,7 @@ module.exports = {
1016
1065
  str.next();
1017
1066
 
1018
1067
  return {column: str.col, row: str.row};
1019
- }, true),
1068
+ }),
1020
1069
  "e": new Motion(function(editor) {
1021
1070
  var str = new StringStream(editor);
1022
1071
 
@@ -1045,15 +1094,16 @@ module.exports = {
1045
1094
 
1046
1095
  "l": {
1047
1096
  nav: function(editor) {
1048
- editor.navigateRight();
1097
+ var pos = editor.getCursorPosition();
1098
+ var col = pos.column;
1099
+ var lineLen = editor.session.getLine(pos.row).length;
1100
+ if (lineLen && col !== lineLen)
1101
+ editor.navigateRight();
1049
1102
  },
1050
1103
  sel: function(editor) {
1051
1104
  var pos = editor.getCursorPosition();
1052
1105
  var col = pos.column;
1053
1106
  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
1107
  if (lineLen && col !== lineLen) //In selection mode you can select the newline
1058
1108
  editor.selection.selectRight();
1059
1109
  }
@@ -1070,6 +1120,40 @@ module.exports = {
1070
1120
  editor.selection.selectLeft();
1071
1121
  }
1072
1122
  },
1123
+ "H": {
1124
+ nav: function(editor) {
1125
+ var row = editor.renderer.getScrollTopRow();
1126
+ editor.moveCursorTo(row);
1127
+ },
1128
+ sel: function(editor) {
1129
+ var row = editor.renderer.getScrollTopRow();
1130
+ editor.selection.selectTo(row);
1131
+ }
1132
+ },
1133
+ "M": {
1134
+ nav: function(editor) {
1135
+ var topRow = editor.renderer.getScrollTopRow();
1136
+ var bottomRow = editor.renderer.getScrollBottomRow();
1137
+ var row = topRow + ((bottomRow - topRow) / 2);
1138
+ editor.moveCursorTo(row);
1139
+ },
1140
+ sel: function(editor) {
1141
+ var topRow = editor.renderer.getScrollTopRow();
1142
+ var bottomRow = editor.renderer.getScrollBottomRow();
1143
+ var row = topRow + ((bottomRow - topRow) / 2);
1144
+ editor.selection.selectTo(row);
1145
+ }
1146
+ },
1147
+ "L": {
1148
+ nav: function(editor) {
1149
+ var row = editor.renderer.getScrollBottomRow();
1150
+ editor.moveCursorTo(row);
1151
+ },
1152
+ sel: function(editor) {
1153
+ var row = editor.renderer.getScrollBottomRow();
1154
+ editor.selection.selectTo(row);
1155
+ }
1156
+ },
1073
1157
  "k": {
1074
1158
  nav: function(editor) {
1075
1159
  editor.navigateUp();
@@ -1163,98 +1247,97 @@ module.exports = {
1163
1247
  }
1164
1248
  },
1165
1249
 
1166
- "f": {
1250
+ "f": new Motion({
1167
1251
  param: true,
1168
1252
  handlesCount: true,
1169
- nav: function(editor, range, count, param) {
1170
- var ed = editor;
1171
- var cursor = ed.getCursorPosition();
1253
+ getPos: function(editor, range, count, param, isSel, isRepeat) {
1254
+ if (!isRepeat)
1255
+ LAST_SEARCH_MOTION = {ch: "f", param: param};
1256
+ var cursor = editor.getCursorPosition();
1172
1257
  var column = util.getRightNthChar(editor, cursor, param, count || 1);
1173
1258
 
1174
1259
  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);
1260
+ cursor.column += column + (isSel ? 2 : 1);
1261
+ return cursor;
1186
1262
  }
1187
1263
  }
1188
- },
1189
- "F": {
1264
+ }),
1265
+ "F": new Motion({
1190
1266
  param: true,
1191
1267
  handlesCount: true,
1192
- nav: function(editor, range, count, param) {
1193
- var ed = editor;
1194
- var cursor = ed.getCursorPosition();
1268
+ getPos: function(editor, range, count, param, isSel, isRepeat) {
1269
+ if (!isRepeat)
1270
+ LAST_SEARCH_MOTION = {ch: "F", param: param};
1271
+ var cursor = editor.getCursorPosition();
1195
1272
  var column = util.getLeftNthChar(editor, cursor, param, count || 1);
1196
1273
 
1197
1274
  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);
1275
+ cursor.column -= column + 1;
1276
+ return cursor;
1209
1277
  }
1210
1278
  }
1211
- },
1212
- "t": {
1279
+ }),
1280
+ "t": new Motion({
1213
1281
  param: true,
1214
1282
  handlesCount: true,
1215
- nav: function(editor, range, count, param) {
1216
- var ed = editor;
1217
- var cursor = ed.getCursorPosition();
1283
+ getPos: function(editor, range, count, param, isSel, isRepeat) {
1284
+ if (!isRepeat)
1285
+ LAST_SEARCH_MOTION = {ch: "t", param: param};
1286
+ var cursor = editor.getCursorPosition();
1218
1287
  var column = util.getRightNthChar(editor, cursor, param, count || 1);
1219
1288
 
1289
+ if (isRepeat && column == 0 && !(count > 1))
1290
+ var column = util.getRightNthChar(editor, cursor, param, 2);
1291
+
1220
1292
  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);
1293
+ cursor.column += column + (isSel ? 1 : 0);
1294
+ return cursor;
1232
1295
  }
1233
1296
  }
1234
- },
1235
- "T": {
1297
+ }),
1298
+ "T": new Motion({
1236
1299
  param: true,
1237
1300
  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();
1301
+ getPos: function(editor, range, count, param, isSel, isRepeat) {
1302
+ if (!isRepeat)
1303
+ LAST_SEARCH_MOTION = {ch: "T", param: param};
1304
+ var cursor = editor.getCursorPosition();
1251
1305
  var column = util.getLeftNthChar(editor, cursor, param, count || 1);
1252
1306
 
1307
+ if (isRepeat && column == 0 && !(count > 1))
1308
+ var column = util.getLeftNthChar(editor, cursor, param, 2);
1309
+
1253
1310
  if (typeof column === "number") {
1254
- ed.moveCursorTo(cursor.row, -column + cursor.column);
1311
+ cursor.column -= column;
1312
+ return cursor;
1255
1313
  }
1256
1314
  }
1257
- },
1315
+ }),
1316
+ ";": new Motion({
1317
+ handlesCount: true,
1318
+ getPos: function(editor, range, count, param, isSel) {
1319
+ var ch = LAST_SEARCH_MOTION.ch;
1320
+ if (!ch)
1321
+ return;
1322
+ return module.exports[ch].getPos(
1323
+ editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
1324
+ );
1325
+ }
1326
+ }),
1327
+ ",": new Motion({
1328
+ handlesCount: true,
1329
+ getPos: function(editor, range, count, param, isSel) {
1330
+ var ch = LAST_SEARCH_MOTION.ch;
1331
+ if (!ch)
1332
+ return;
1333
+ var up = ch.toUpperCase();
1334
+ ch = ch === up ? ch.toLowerCase() : up;
1335
+
1336
+ return module.exports[ch].getPos(
1337
+ editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
1338
+ );
1339
+ }
1340
+ }),
1258
1341
 
1259
1342
  "^": {
1260
1343
  nav: function(editor) {
@@ -1372,6 +1455,25 @@ module.exports = {
1372
1455
 
1373
1456
  return match;
1374
1457
  }),
1458
+ "{": new Motion(function(ed) {
1459
+ var session = ed.session;
1460
+ var row = session.selection.lead.row;
1461
+ while(row > 0 && !/\S/.test(session.getLine(row)))
1462
+ row--;
1463
+ while(/\S/.test(session.getLine(row)))
1464
+ row--;
1465
+ return {column: 0, row: row};
1466
+ }),
1467
+ "}": new Motion(function(ed) {
1468
+ var session = ed.session;
1469
+ var l = session.getLength();
1470
+ var row = session.selection.lead.row;
1471
+ while(row < l && !/\S/.test(session.getLine(row)))
1472
+ row++;
1473
+ while(/\S/.test(session.getLine(row)))
1474
+ row++;
1475
+ return {column: 0, row: row};
1476
+ }),
1375
1477
  "ctrl-d": {
1376
1478
  nav: function(editor, range, count, param) {
1377
1479
  editor.selection.clearSelection();
@@ -1385,16 +1487,42 @@ module.exports = {
1385
1487
  nav: function(editor, range, count, param) {
1386
1488
  editor.selection.clearSelection();
1387
1489
  keepScrollPosition(editor, editor.gotoPageUp);
1388
-
1389
1490
  },
1390
1491
  sel: function(editor, range, count, param) {
1391
1492
  keepScrollPosition(editor, editor.selectPageUp);
1392
1493
  }
1393
1494
  },
1495
+ "`": new Motion({
1496
+ param: true,
1497
+ handlesCount: true,
1498
+ getPos: function(editor, range, count, param, isSel) {
1499
+ var s = editor.session;
1500
+ var marker = s.vimMarkers && s.vimMarkers[param];
1501
+ if (marker) {
1502
+ return marker.getPosition();
1503
+ }
1504
+ }
1505
+ }),
1506
+ "'": new Motion({
1507
+ param: true,
1508
+ handlesCount: true,
1509
+ getPos: function(editor, range, count, param, isSel) {
1510
+ var s = editor.session;
1511
+ var marker = s.vimMarkers && s.vimMarkers[param];
1512
+ if (marker) {
1513
+ var pos = marker.getPosition();
1514
+ var line = editor.session.getLine(pos.row);
1515
+ pos.column = line.search(/\S/);
1516
+ if (pos.column == -1)
1517
+ pos.column = line.length;
1518
+ return pos;
1519
+ }
1520
+ }
1521
+ })
1394
1522
  };
1395
1523
 
1396
1524
  module.exports.backspace = module.exports.left = module.exports.h;
1397
- module.exports.right = module.exports.l;
1525
+ module.exports.space = module.exports['return'] = module.exports.right = module.exports.l;
1398
1526
  module.exports.up = module.exports.k;
1399
1527
  module.exports.down = module.exports.j;
1400
1528
  module.exports.pagedown = module.exports["ctrl-d"];
@@ -1404,7 +1532,7 @@ module.exports.pageup = module.exports["ctrl-u"];
1404
1532
 
1405
1533
  define('ace/keyboard/vim/maps/operators', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/registers'], function(require, exports, module) {
1406
1534
 
1407
- "never use strict";
1535
+
1408
1536
 
1409
1537
  var util = require("./util");
1410
1538
  var registers = require("../registers");
@@ -1430,9 +1558,7 @@ module.exports = {
1430
1558
  editor.selection.selectLine();
1431
1559
  registers._default.text += editor.getCopyText();
1432
1560
  var selRange = editor.getSelectionRange();
1433
- // check if end of the document was reached
1434
1561
  if (!selRange.isMultiLine()) {
1435
- lastLineReached = true
1436
1562
  var row = selRange.start.row - 1;
1437
1563
  var col = editor.session.getLine(row).length
1438
1564
  selRange.setStart(row, col);
@@ -1473,8 +1599,6 @@ module.exports = {
1473
1599
  break;
1474
1600
  default:
1475
1601
  if (range) {
1476
-
1477
- // range.end.column ++;
1478
1602
  editor.session.remove(range);
1479
1603
  util.insertMode(editor);
1480
1604
  }
@@ -1575,57 +1699,57 @@ define('ace/keyboard/vim/maps/aliases', ['require', 'exports', 'module' ], funct
1575
1699
  module.exports = {
1576
1700
  "x": {
1577
1701
  operator: {
1578
- char: "d",
1702
+ ch: "d",
1579
1703
  count: 1
1580
1704
  },
1581
1705
  motion: {
1582
- char: "l",
1706
+ ch: "l",
1583
1707
  count: 1
1584
1708
  }
1585
1709
  },
1586
1710
  "X": {
1587
1711
  operator: {
1588
- char: "d",
1712
+ ch: "d",
1589
1713
  count: 1
1590
1714
  },
1591
1715
  motion: {
1592
- char: "h",
1716
+ ch: "h",
1593
1717
  count: 1
1594
1718
  }
1595
1719
  },
1596
1720
  "D": {
1597
1721
  operator: {
1598
- char: "d",
1722
+ ch: "d",
1599
1723
  count: 1
1600
1724
  },
1601
1725
  motion: {
1602
- char: "$",
1726
+ ch: "$",
1603
1727
  count: 1
1604
1728
  }
1605
1729
  },
1606
1730
  "C": {
1607
1731
  operator: {
1608
- char: "c",
1732
+ ch: "c",
1609
1733
  count: 1
1610
1734
  },
1611
1735
  motion: {
1612
- char: "$",
1736
+ ch: "$",
1613
1737
  count: 1
1614
1738
  }
1615
1739
  },
1616
1740
  "s": {
1617
1741
  operator: {
1618
- char: "c",
1742
+ ch: "c",
1619
1743
  count: 1
1620
1744
  },
1621
1745
  motion: {
1622
- char: "l",
1746
+ ch: "l",
1623
1747
  count: 1
1624
1748
  }
1625
1749
  },
1626
1750
  "S": {
1627
1751
  operator: {
1628
- char: "c",
1752
+ ch: "c",
1629
1753
  count: 1
1630
1754
  },
1631
1755
  param: "c"