fluentd-ui 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +4 -0
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/javascripts/application.js +2 -0
  5. data/app/assets/javascripts/codemirror.js +29 -0
  6. data/app/assets/javascripts/codemirror_fluentd.js +59 -0
  7. data/app/assets/stylesheets/application.css +6 -0
  8. data/app/views/fluentd/settings/edit.html.haml +1 -1
  9. data/app/views/shared/vue/_setting.html.erb +1 -1
  10. data/bower.json +2 -1
  11. data/lib/fluentd-ui/version.rb +1 -1
  12. data/spec/features/source_and_output_spec.rb +16 -6
  13. data/vendor/assets/javascripts/bower/codemirror/.bower.json +29 -0
  14. data/vendor/assets/javascripts/bower/codemirror/AUTHORS +423 -0
  15. data/vendor/assets/javascripts/bower/codemirror/CONTRIBUTING.md +76 -0
  16. data/vendor/assets/javascripts/bower/codemirror/LICENSE +19 -0
  17. data/vendor/assets/javascripts/bower/codemirror/README.md +11 -0
  18. data/vendor/assets/javascripts/bower/codemirror/addon/comment/comment.js +183 -0
  19. data/vendor/assets/javascripts/bower/codemirror/addon/comment/continuecomment.js +85 -0
  20. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.css +32 -0
  21. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.js +155 -0
  22. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.css +6 -0
  23. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.js +41 -0
  24. data/vendor/assets/javascripts/bower/codemirror/addon/display/panel.js +94 -0
  25. data/vendor/assets/javascripts/bower/codemirror/addon/display/placeholder.js +58 -0
  26. data/vendor/assets/javascripts/bower/codemirror/addon/display/rulers.js +64 -0
  27. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closebrackets.js +159 -0
  28. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closetag.js +159 -0
  29. data/vendor/assets/javascripts/bower/codemirror/addon/edit/continuelist.js +51 -0
  30. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchbrackets.js +120 -0
  31. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchtags.js +66 -0
  32. data/vendor/assets/javascripts/bower/codemirror/addon/edit/trailingspace.js +27 -0
  33. data/vendor/assets/javascripts/bower/codemirror/addon/fold/brace-fold.js +105 -0
  34. data/vendor/assets/javascripts/bower/codemirror/addon/fold/comment-fold.js +57 -0
  35. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldcode.js +145 -0
  36. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.css +20 -0
  37. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.js +134 -0
  38. data/vendor/assets/javascripts/bower/codemirror/addon/fold/indent-fold.js +44 -0
  39. data/vendor/assets/javascripts/bower/codemirror/addon/fold/markdown-fold.js +49 -0
  40. data/vendor/assets/javascripts/bower/codemirror/addon/fold/xml-fold.js +182 -0
  41. data/vendor/assets/javascripts/bower/codemirror/addon/hint/anyword-hint.js +41 -0
  42. data/vendor/assets/javascripts/bower/codemirror/addon/hint/css-hint.js +56 -0
  43. data/vendor/assets/javascripts/bower/codemirror/addon/hint/html-hint.js +348 -0
  44. data/vendor/assets/javascripts/bower/codemirror/addon/hint/javascript-hint.js +146 -0
  45. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.css +38 -0
  46. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.js +389 -0
  47. data/vendor/assets/javascripts/bower/codemirror/addon/hint/sql-hint.js +197 -0
  48. data/vendor/assets/javascripts/bower/codemirror/addon/hint/xml-hint.js +110 -0
  49. data/vendor/assets/javascripts/bower/codemirror/addon/lint/coffeescript-lint.js +41 -0
  50. data/vendor/assets/javascripts/bower/codemirror/addon/lint/css-lint.js +35 -0
  51. data/vendor/assets/javascripts/bower/codemirror/addon/lint/javascript-lint.js +136 -0
  52. data/vendor/assets/javascripts/bower/codemirror/addon/lint/json-lint.js +31 -0
  53. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.css +73 -0
  54. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.js +204 -0
  55. data/vendor/assets/javascripts/bower/codemirror/addon/lint/yaml-lint.js +28 -0
  56. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.css +112 -0
  57. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.js +643 -0
  58. data/vendor/assets/javascripts/bower/codemirror/addon/mode/loadmode.js +64 -0
  59. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex.js +118 -0
  60. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex_test.js +33 -0
  61. data/vendor/assets/javascripts/bower/codemirror/addon/mode/overlay.js +85 -0
  62. data/vendor/assets/javascripts/bower/codemirror/addon/mode/simple.js +213 -0
  63. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/colorize.js +40 -0
  64. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode-standalone.js +157 -0
  65. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.js +72 -0
  66. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.node.js +120 -0
  67. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/annotatescrollbar.js +76 -0
  68. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/scrollpastend.js +46 -0
  69. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.css +66 -0
  70. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.js +139 -0
  71. data/vendor/assets/javascripts/bower/codemirror/addon/search/match-highlighter.js +128 -0
  72. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.css +8 -0
  73. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.js +90 -0
  74. data/vendor/assets/javascripts/bower/codemirror/addon/search/search.js +164 -0
  75. data/vendor/assets/javascripts/bower/codemirror/addon/search/searchcursor.js +189 -0
  76. data/vendor/assets/javascripts/bower/codemirror/addon/selection/active-line.js +71 -0
  77. data/vendor/assets/javascripts/bower/codemirror/addon/selection/mark-selection.js +118 -0
  78. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.css +86 -0
  79. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.js +670 -0
  80. data/vendor/assets/javascripts/bower/codemirror/addon/tern/worker.js +44 -0
  81. data/vendor/assets/javascripts/bower/codemirror/addon/wrap/hardwrap.js +139 -0
  82. data/vendor/assets/javascripts/bower/codemirror/bower.json +16 -0
  83. data/vendor/assets/javascripts/bower/codemirror/keymap/emacs.js +411 -0
  84. data/vendor/assets/javascripts/bower/codemirror/keymap/sublime.js +540 -0
  85. data/vendor/assets/javascripts/bower/codemirror/keymap/vim.js +4901 -0
  86. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.css +309 -0
  87. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.js +8029 -0
  88. data/vendor/assets/javascripts/bower/codemirror/mode/apl/apl.js +175 -0
  89. data/vendor/assets/javascripts/bower/codemirror/mode/asterisk/asterisk.js +198 -0
  90. data/vendor/assets/javascripts/bower/codemirror/mode/clike/clike.js +489 -0
  91. data/vendor/assets/javascripts/bower/codemirror/mode/clike/scala.html +767 -0
  92. data/vendor/assets/javascripts/bower/codemirror/mode/clojure/clojure.js +243 -0
  93. data/vendor/assets/javascripts/bower/codemirror/mode/cobol/cobol.js +255 -0
  94. data/vendor/assets/javascripts/bower/codemirror/mode/coffeescript/coffeescript.js +369 -0
  95. data/vendor/assets/javascripts/bower/codemirror/mode/commonlisp/commonlisp.js +122 -0
  96. data/vendor/assets/javascripts/bower/codemirror/mode/css/css.js +717 -0
  97. data/vendor/assets/javascripts/bower/codemirror/mode/css/less.html +152 -0
  98. data/vendor/assets/javascripts/bower/codemirror/mode/css/less_test.js +51 -0
  99. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss.html +157 -0
  100. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss_test.js +110 -0
  101. data/vendor/assets/javascripts/bower/codemirror/mode/css/test.js +135 -0
  102. data/vendor/assets/javascripts/bower/codemirror/mode/cypher/cypher.js +146 -0
  103. data/vendor/assets/javascripts/bower/codemirror/mode/d/d.js +218 -0
  104. data/vendor/assets/javascripts/bower/codemirror/mode/dart/dart.js +50 -0
  105. data/vendor/assets/javascripts/bower/codemirror/mode/diff/diff.js +47 -0
  106. data/vendor/assets/javascripts/bower/codemirror/mode/django/django.js +67 -0
  107. data/vendor/assets/javascripts/bower/codemirror/mode/dockerfile/dockerfile.js +76 -0
  108. data/vendor/assets/javascripts/bower/codemirror/mode/dtd/dtd.js +142 -0
  109. data/vendor/assets/javascripts/bower/codemirror/mode/dylan/dylan.js +299 -0
  110. data/vendor/assets/javascripts/bower/codemirror/mode/ebnf/ebnf.js +195 -0
  111. data/vendor/assets/javascripts/bower/codemirror/mode/ecl/ecl.js +207 -0
  112. data/vendor/assets/javascripts/bower/codemirror/mode/eiffel/eiffel.js +162 -0
  113. data/vendor/assets/javascripts/bower/codemirror/mode/erlang/erlang.js +622 -0
  114. data/vendor/assets/javascripts/bower/codemirror/mode/fortran/fortran.js +188 -0
  115. data/vendor/assets/javascripts/bower/codemirror/mode/gas/gas.js +345 -0
  116. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/gfm.js +123 -0
  117. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/test.js +213 -0
  118. data/vendor/assets/javascripts/bower/codemirror/mode/gherkin/gherkin.js +178 -0
  119. data/vendor/assets/javascripts/bower/codemirror/mode/go/go.js +184 -0
  120. data/vendor/assets/javascripts/bower/codemirror/mode/groovy/groovy.js +226 -0
  121. data/vendor/assets/javascripts/bower/codemirror/mode/haml/haml.js +159 -0
  122. data/vendor/assets/javascripts/bower/codemirror/mode/haml/test.js +97 -0
  123. data/vendor/assets/javascripts/bower/codemirror/mode/haskell/haskell.js +267 -0
  124. data/vendor/assets/javascripts/bower/codemirror/mode/haxe/haxe.js +518 -0
  125. data/vendor/assets/javascripts/bower/codemirror/mode/htmlembedded/htmlembedded.js +86 -0
  126. data/vendor/assets/javascripts/bower/codemirror/mode/htmlmixed/htmlmixed.js +121 -0
  127. data/vendor/assets/javascripts/bower/codemirror/mode/http/http.js +113 -0
  128. data/vendor/assets/javascripts/bower/codemirror/mode/idl/idl.js +290 -0
  129. data/vendor/assets/javascripts/bower/codemirror/mode/jade/jade.js +590 -0
  130. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/javascript.js +686 -0
  131. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/json-ld.html +72 -0
  132. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/test.js +200 -0
  133. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/typescript.html +61 -0
  134. data/vendor/assets/javascripts/bower/codemirror/mode/jinja2/jinja2.js +142 -0
  135. data/vendor/assets/javascripts/bower/codemirror/mode/julia/julia.js +301 -0
  136. data/vendor/assets/javascripts/bower/codemirror/mode/kotlin/kotlin.js +280 -0
  137. data/vendor/assets/javascripts/bower/codemirror/mode/livescript/livescript.js +280 -0
  138. data/vendor/assets/javascripts/bower/codemirror/mode/lua/lua.js +159 -0
  139. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/markdown.js +765 -0
  140. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/test.js +754 -0
  141. data/vendor/assets/javascripts/bower/codemirror/mode/meta.js +165 -0
  142. data/vendor/assets/javascripts/bower/codemirror/mode/mirc/mirc.js +193 -0
  143. data/vendor/assets/javascripts/bower/codemirror/mode/mllike/mllike.js +205 -0
  144. data/vendor/assets/javascripts/bower/codemirror/mode/modelica/modelica.js +245 -0
  145. data/vendor/assets/javascripts/bower/codemirror/mode/nginx/nginx.js +178 -0
  146. data/vendor/assets/javascripts/bower/codemirror/mode/ntriples/ntriples.js +186 -0
  147. data/vendor/assets/javascripts/bower/codemirror/mode/octave/octave.js +135 -0
  148. data/vendor/assets/javascripts/bower/codemirror/mode/pascal/pascal.js +109 -0
  149. data/vendor/assets/javascripts/bower/codemirror/mode/pegjs/pegjs.js +114 -0
  150. data/vendor/assets/javascripts/bower/codemirror/mode/perl/perl.js +832 -0
  151. data/vendor/assets/javascripts/bower/codemirror/mode/php/php.js +226 -0
  152. data/vendor/assets/javascripts/bower/codemirror/mode/php/test.js +154 -0
  153. data/vendor/assets/javascripts/bower/codemirror/mode/pig/pig.js +188 -0
  154. data/vendor/assets/javascripts/bower/codemirror/mode/properties/properties.js +78 -0
  155. data/vendor/assets/javascripts/bower/codemirror/mode/puppet/puppet.js +220 -0
  156. data/vendor/assets/javascripts/bower/codemirror/mode/python/python.js +359 -0
  157. data/vendor/assets/javascripts/bower/codemirror/mode/q/q.js +139 -0
  158. data/vendor/assets/javascripts/bower/codemirror/mode/r/r.js +162 -0
  159. data/vendor/assets/javascripts/bower/codemirror/mode/rpm/rpm.js +101 -0
  160. data/vendor/assets/javascripts/bower/codemirror/mode/rst/rst.js +557 -0
  161. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/ruby.js +285 -0
  162. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/test.js +14 -0
  163. data/vendor/assets/javascripts/bower/codemirror/mode/rust/rust.js +451 -0
  164. data/vendor/assets/javascripts/bower/codemirror/mode/sass/sass.js +327 -0
  165. data/vendor/assets/javascripts/bower/codemirror/mode/scheme/scheme.js +248 -0
  166. data/vendor/assets/javascripts/bower/codemirror/mode/shell/shell.js +139 -0
  167. data/vendor/assets/javascripts/bower/codemirror/mode/shell/test.js +58 -0
  168. data/vendor/assets/javascripts/bower/codemirror/mode/sieve/sieve.js +193 -0
  169. data/vendor/assets/javascripts/bower/codemirror/mode/slim/slim.js +575 -0
  170. data/vendor/assets/javascripts/bower/codemirror/mode/slim/test.js +96 -0
  171. data/vendor/assets/javascripts/bower/codemirror/mode/smalltalk/smalltalk.js +168 -0
  172. data/vendor/assets/javascripts/bower/codemirror/mode/smarty/smarty.js +221 -0
  173. data/vendor/assets/javascripts/bower/codemirror/mode/smartymixed/smartymixed.js +197 -0
  174. data/vendor/assets/javascripts/bower/codemirror/mode/solr/solr.js +104 -0
  175. data/vendor/assets/javascripts/bower/codemirror/mode/soy/soy.js +198 -0
  176. data/vendor/assets/javascripts/bower/codemirror/mode/sparql/sparql.js +174 -0
  177. data/vendor/assets/javascripts/bower/codemirror/mode/spreadsheet/spreadsheet.js +109 -0
  178. data/vendor/assets/javascripts/bower/codemirror/mode/sql/sql.js +391 -0
  179. data/vendor/assets/javascripts/bower/codemirror/mode/stex/stex.js +251 -0
  180. data/vendor/assets/javascripts/bower/codemirror/mode/stex/test.js +123 -0
  181. data/vendor/assets/javascripts/bower/codemirror/mode/tcl/tcl.js +147 -0
  182. data/vendor/assets/javascripts/bower/codemirror/mode/textile/test.js +417 -0
  183. data/vendor/assets/javascripts/bower/codemirror/mode/textile/textile.js +469 -0
  184. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  185. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.js +369 -0
  186. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.css +26 -0
  187. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.js +323 -0
  188. data/vendor/assets/javascripts/bower/codemirror/mode/toml/toml.js +88 -0
  189. data/vendor/assets/javascripts/bower/codemirror/mode/tornado/tornado.js +68 -0
  190. data/vendor/assets/javascripts/bower/codemirror/mode/turtle/turtle.js +162 -0
  191. data/vendor/assets/javascripts/bower/codemirror/mode/vb/vb.js +274 -0
  192. data/vendor/assets/javascripts/bower/codemirror/mode/vbscript/vbscript.js +350 -0
  193. data/vendor/assets/javascripts/bower/codemirror/mode/velocity/velocity.js +201 -0
  194. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/test.js +273 -0
  195. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/verilog.js +364 -0
  196. data/vendor/assets/javascripts/bower/codemirror/mode/xml/test.js +51 -0
  197. data/vendor/assets/javascripts/bower/codemirror/mode/xml/xml.js +384 -0
  198. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/test.js +67 -0
  199. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/xquery.js +447 -0
  200. data/vendor/assets/javascripts/bower/codemirror/mode/yaml/yaml.js +117 -0
  201. data/vendor/assets/javascripts/bower/codemirror/mode/z80/z80.js +100 -0
  202. data/vendor/assets/javascripts/bower/codemirror/theme/3024-day.css +38 -0
  203. data/vendor/assets/javascripts/bower/codemirror/theme/3024-night.css +37 -0
  204. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance-mobile.css +5 -0
  205. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance.css +77 -0
  206. data/vendor/assets/javascripts/bower/codemirror/theme/base16-dark.css +36 -0
  207. data/vendor/assets/javascripts/bower/codemirror/theme/base16-light.css +36 -0
  208. data/vendor/assets/javascripts/bower/codemirror/theme/blackboard.css +30 -0
  209. data/vendor/assets/javascripts/bower/codemirror/theme/cobalt.css +23 -0
  210. data/vendor/assets/javascripts/bower/codemirror/theme/eclipse.css +23 -0
  211. data/vendor/assets/javascripts/bower/codemirror/theme/elegant.css +13 -0
  212. data/vendor/assets/javascripts/bower/codemirror/theme/erlang-dark.css +32 -0
  213. data/vendor/assets/javascripts/bower/codemirror/theme/lesser-dark.css +45 -0
  214. data/vendor/assets/javascripts/bower/codemirror/theme/mbo.css +35 -0
  215. data/vendor/assets/javascripts/bower/codemirror/theme/mdn-like.css +44 -0
  216. data/vendor/assets/javascripts/bower/codemirror/theme/midnight.css +45 -0
  217. data/vendor/assets/javascripts/bower/codemirror/theme/monokai.css +31 -0
  218. data/vendor/assets/javascripts/bower/codemirror/theme/neat.css +12 -0
  219. data/vendor/assets/javascripts/bower/codemirror/theme/neo.css +43 -0
  220. data/vendor/assets/javascripts/bower/codemirror/theme/night.css +26 -0
  221. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-dark.css +36 -0
  222. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-light.css +36 -0
  223. data/vendor/assets/javascripts/bower/codemirror/theme/pastel-on-dark.css +50 -0
  224. data/vendor/assets/javascripts/bower/codemirror/theme/rubyblue.css +23 -0
  225. data/vendor/assets/javascripts/bower/codemirror/theme/solarized.css +165 -0
  226. data/vendor/assets/javascripts/bower/codemirror/theme/the-matrix.css +28 -0
  227. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-bright.css +35 -0
  228. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-eighties.css +36 -0
  229. data/vendor/assets/javascripts/bower/codemirror/theme/twilight.css +30 -0
  230. data/vendor/assets/javascripts/bower/codemirror/theme/vibrant-ink.css +32 -0
  231. data/vendor/assets/javascripts/bower/codemirror/theme/xq-dark.css +51 -0
  232. data/vendor/assets/javascripts/bower/codemirror/theme/xq-light.css +43 -0
  233. data/vendor/assets/javascripts/bower/codemirror/theme/zenburn.css +37 -0
  234. metadata +225 -2
@@ -0,0 +1,540 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ // A rough approximation of Sublime Text's keybindings
5
+ // Depends on addon/search/searchcursor.js and optionally addon/dialog/dialogs.js
6
+
7
+ (function(mod) {
8
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
9
+ mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/edit/matchbrackets"));
10
+ else if (typeof define == "function" && define.amd) // AMD
11
+ define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/edit/matchbrackets"], mod);
12
+ else // Plain browser env
13
+ mod(CodeMirror);
14
+ })(function(CodeMirror) {
15
+ "use strict";
16
+
17
+ var map = CodeMirror.keyMap.sublime = {fallthrough: "default"};
18
+ var cmds = CodeMirror.commands;
19
+ var Pos = CodeMirror.Pos;
20
+ var mac = CodeMirror.keyMap["default"] == CodeMirror.keyMap.macDefault;
21
+ var ctrl = mac ? "Cmd-" : "Ctrl-";
22
+
23
+ // This is not exactly Sublime's algorithm. I couldn't make heads or tails of that.
24
+ function findPosSubword(doc, start, dir) {
25
+ if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));
26
+ var line = doc.getLine(start.line);
27
+ if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));
28
+ var state = "start", type;
29
+ for (var pos = start.ch, e = dir < 0 ? 0 : line.length, i = 0; pos != e; pos += dir, i++) {
30
+ var next = line.charAt(dir < 0 ? pos - 1 : pos);
31
+ var cat = next != "_" && CodeMirror.isWordChar(next) ? "w" : "o";
32
+ if (cat == "w" && next.toUpperCase() == next) cat = "W";
33
+ if (state == "start") {
34
+ if (cat != "o") { state = "in"; type = cat; }
35
+ } else if (state == "in") {
36
+ if (type != cat) {
37
+ if (type == "w" && cat == "W" && dir < 0) pos--;
38
+ if (type == "W" && cat == "w" && dir > 0) { type = "w"; continue; }
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ return Pos(start.line, pos);
44
+ }
45
+
46
+ function moveSubword(cm, dir) {
47
+ cm.extendSelectionsBy(function(range) {
48
+ if (cm.display.shift || cm.doc.extend || range.empty())
49
+ return findPosSubword(cm.doc, range.head, dir);
50
+ else
51
+ return dir < 0 ? range.from() : range.to();
52
+ });
53
+ }
54
+
55
+ cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); };
56
+ cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); };
57
+
58
+ cmds[map[ctrl + "Up"] = "scrollLineUp"] = function(cm) {
59
+ var info = cm.getScrollInfo();
60
+ if (!cm.somethingSelected()) {
61
+ var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, "local");
62
+ if (cm.getCursor().line >= visibleBottomLine)
63
+ cm.execCommand("goLineUp");
64
+ }
65
+ cm.scrollTo(null, info.top - cm.defaultTextHeight());
66
+ };
67
+ cmds[map[ctrl + "Down"] = "scrollLineDown"] = function(cm) {
68
+ var info = cm.getScrollInfo();
69
+ if (!cm.somethingSelected()) {
70
+ var visibleTopLine = cm.lineAtHeight(info.top, "local")+1;
71
+ if (cm.getCursor().line <= visibleTopLine)
72
+ cm.execCommand("goLineDown");
73
+ }
74
+ cm.scrollTo(null, info.top + cm.defaultTextHeight());
75
+ };
76
+
77
+ cmds[map["Shift-" + ctrl + "L"] = "splitSelectionByLine"] = function(cm) {
78
+ var ranges = cm.listSelections(), lineRanges = [];
79
+ for (var i = 0; i < ranges.length; i++) {
80
+ var from = ranges[i].from(), to = ranges[i].to();
81
+ for (var line = from.line; line <= to.line; ++line)
82
+ if (!(to.line > from.line && line == to.line && to.ch == 0))
83
+ lineRanges.push({anchor: line == from.line ? from : Pos(line, 0),
84
+ head: line == to.line ? to : Pos(line)});
85
+ }
86
+ cm.setSelections(lineRanges, 0);
87
+ };
88
+
89
+ map["Shift-Tab"] = "indentLess";
90
+
91
+ cmds[map["Esc"] = "singleSelectionTop"] = function(cm) {
92
+ var range = cm.listSelections()[0];
93
+ cm.setSelection(range.anchor, range.head, {scroll: false});
94
+ };
95
+
96
+ cmds[map[ctrl + "L"] = "selectLine"] = function(cm) {
97
+ var ranges = cm.listSelections(), extended = [];
98
+ for (var i = 0; i < ranges.length; i++) {
99
+ var range = ranges[i];
100
+ extended.push({anchor: Pos(range.from().line, 0),
101
+ head: Pos(range.to().line + 1, 0)});
102
+ }
103
+ cm.setSelections(extended);
104
+ };
105
+
106
+ map["Shift-" + ctrl + "K"] = "deleteLine";
107
+
108
+ function insertLine(cm, above) {
109
+ cm.operation(function() {
110
+ var len = cm.listSelections().length, newSelection = [], last = -1;
111
+ for (var i = 0; i < len; i++) {
112
+ var head = cm.listSelections()[i].head;
113
+ if (head.line <= last) continue;
114
+ var at = Pos(head.line + (above ? 0 : 1), 0);
115
+ cm.replaceRange("\n", at, null, "+insertLine");
116
+ cm.indentLine(at.line, null, true);
117
+ newSelection.push({head: at, anchor: at});
118
+ last = head.line + 1;
119
+ }
120
+ cm.setSelections(newSelection);
121
+ });
122
+ }
123
+
124
+ cmds[map[ctrl + "Enter"] = "insertLineAfter"] = function(cm) { insertLine(cm, false); };
125
+
126
+ cmds[map["Shift-" + ctrl + "Enter"] = "insertLineBefore"] = function(cm) { insertLine(cm, true); };
127
+
128
+ function wordAt(cm, pos) {
129
+ var start = pos.ch, end = start, line = cm.getLine(pos.line);
130
+ while (start && CodeMirror.isWordChar(line.charAt(start - 1))) --start;
131
+ while (end < line.length && CodeMirror.isWordChar(line.charAt(end))) ++end;
132
+ return {from: Pos(pos.line, start), to: Pos(pos.line, end), word: line.slice(start, end)};
133
+ }
134
+
135
+ cmds[map[ctrl + "D"] = "selectNextOccurrence"] = function(cm) {
136
+ var from = cm.getCursor("from"), to = cm.getCursor("to");
137
+ var fullWord = cm.state.sublimeFindFullWord == cm.doc.sel;
138
+ if (CodeMirror.cmpPos(from, to) == 0) {
139
+ var word = wordAt(cm, from);
140
+ if (!word.word) return;
141
+ cm.setSelection(word.from, word.to);
142
+ fullWord = true;
143
+ } else {
144
+ var text = cm.getRange(from, to);
145
+ var query = fullWord ? new RegExp("\\b" + text + "\\b") : text;
146
+ var cur = cm.getSearchCursor(query, to);
147
+ if (cur.findNext()) {
148
+ cm.addSelection(cur.from(), cur.to());
149
+ } else {
150
+ cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));
151
+ if (cur.findNext())
152
+ cm.addSelection(cur.from(), cur.to());
153
+ }
154
+ }
155
+ if (fullWord)
156
+ cm.state.sublimeFindFullWord = cm.doc.sel;
157
+ };
158
+
159
+ var mirror = "(){}[]";
160
+ function selectBetweenBrackets(cm) {
161
+ var pos = cm.getCursor(), opening = cm.scanForBracket(pos, -1);
162
+ if (!opening) return;
163
+ for (;;) {
164
+ var closing = cm.scanForBracket(pos, 1);
165
+ if (!closing) return;
166
+ if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {
167
+ cm.setSelection(Pos(opening.pos.line, opening.pos.ch + 1), closing.pos, false);
168
+ return true;
169
+ }
170
+ pos = Pos(closing.pos.line, closing.pos.ch + 1);
171
+ }
172
+ }
173
+
174
+ cmds[map["Shift-" + ctrl + "Space"] = "selectScope"] = function(cm) {
175
+ selectBetweenBrackets(cm) || cm.execCommand("selectAll");
176
+ };
177
+ cmds[map["Shift-" + ctrl + "M"] = "selectBetweenBrackets"] = function(cm) {
178
+ if (!selectBetweenBrackets(cm)) return CodeMirror.Pass;
179
+ };
180
+
181
+ cmds[map[ctrl + "M"] = "goToBracket"] = function(cm) {
182
+ cm.extendSelectionsBy(function(range) {
183
+ var next = cm.scanForBracket(range.head, 1);
184
+ if (next && CodeMirror.cmpPos(next.pos, range.head) != 0) return next.pos;
185
+ var prev = cm.scanForBracket(range.head, -1);
186
+ return prev && Pos(prev.pos.line, prev.pos.ch + 1) || range.head;
187
+ });
188
+ };
189
+
190
+ var swapLineCombo = mac ? "Cmd-Ctrl-" : "Shift-Ctrl-";
191
+
192
+ cmds[map[swapLineCombo + "Up"] = "swapLineUp"] = function(cm) {
193
+ var ranges = cm.listSelections(), linesToMove = [], at = cm.firstLine() - 1, newSels = [];
194
+ for (var i = 0; i < ranges.length; i++) {
195
+ var range = ranges[i], from = range.from().line - 1, to = range.to().line;
196
+ newSels.push({anchor: Pos(range.anchor.line - 1, range.anchor.ch),
197
+ head: Pos(range.head.line - 1, range.head.ch)});
198
+ if (range.to().ch == 0 && !range.empty()) --to;
199
+ if (from > at) linesToMove.push(from, to);
200
+ else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;
201
+ at = to;
202
+ }
203
+ cm.operation(function() {
204
+ for (var i = 0; i < linesToMove.length; i += 2) {
205
+ var from = linesToMove[i], to = linesToMove[i + 1];
206
+ var line = cm.getLine(from);
207
+ cm.replaceRange("", Pos(from, 0), Pos(from + 1, 0), "+swapLine");
208
+ if (to > cm.lastLine())
209
+ cm.replaceRange("\n" + line, Pos(cm.lastLine()), null, "+swapLine");
210
+ else
211
+ cm.replaceRange(line + "\n", Pos(to, 0), null, "+swapLine");
212
+ }
213
+ cm.setSelections(newSels);
214
+ cm.scrollIntoView();
215
+ });
216
+ };
217
+
218
+ cmds[map[swapLineCombo + "Down"] = "swapLineDown"] = function(cm) {
219
+ var ranges = cm.listSelections(), linesToMove = [], at = cm.lastLine() + 1;
220
+ for (var i = ranges.length - 1; i >= 0; i--) {
221
+ var range = ranges[i], from = range.to().line + 1, to = range.from().line;
222
+ if (range.to().ch == 0 && !range.empty()) from--;
223
+ if (from < at) linesToMove.push(from, to);
224
+ else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;
225
+ at = to;
226
+ }
227
+ cm.operation(function() {
228
+ for (var i = linesToMove.length - 2; i >= 0; i -= 2) {
229
+ var from = linesToMove[i], to = linesToMove[i + 1];
230
+ var line = cm.getLine(from);
231
+ if (from == cm.lastLine())
232
+ cm.replaceRange("", Pos(from - 1), Pos(from), "+swapLine");
233
+ else
234
+ cm.replaceRange("", Pos(from, 0), Pos(from + 1, 0), "+swapLine");
235
+ cm.replaceRange(line + "\n", Pos(to, 0), null, "+swapLine");
236
+ }
237
+ cm.scrollIntoView();
238
+ });
239
+ };
240
+
241
+ map[ctrl + "/"] = "toggleComment";
242
+
243
+ cmds[map[ctrl + "J"] = "joinLines"] = function(cm) {
244
+ var ranges = cm.listSelections(), joined = [];
245
+ for (var i = 0; i < ranges.length; i++) {
246
+ var range = ranges[i], from = range.from();
247
+ var start = from.line, end = range.to().line;
248
+ while (i < ranges.length - 1 && ranges[i + 1].from().line == end)
249
+ end = ranges[++i].to().line;
250
+ joined.push({start: start, end: end, anchor: !range.empty() && from});
251
+ }
252
+ cm.operation(function() {
253
+ var offset = 0, ranges = [];
254
+ for (var i = 0; i < joined.length; i++) {
255
+ var obj = joined[i];
256
+ var anchor = obj.anchor && Pos(obj.anchor.line - offset, obj.anchor.ch), head;
257
+ for (var line = obj.start; line <= obj.end; line++) {
258
+ var actual = line - offset;
259
+ if (line == obj.end) head = Pos(actual, cm.getLine(actual).length + 1);
260
+ if (actual < cm.lastLine()) {
261
+ cm.replaceRange(" ", Pos(actual), Pos(actual + 1, /^\s*/.exec(cm.getLine(actual + 1))[0].length));
262
+ ++offset;
263
+ }
264
+ }
265
+ ranges.push({anchor: anchor || head, head: head});
266
+ }
267
+ cm.setSelections(ranges, 0);
268
+ });
269
+ };
270
+
271
+ cmds[map["Shift-" + ctrl + "D"] = "duplicateLine"] = function(cm) {
272
+ cm.operation(function() {
273
+ var rangeCount = cm.listSelections().length;
274
+ for (var i = 0; i < rangeCount; i++) {
275
+ var range = cm.listSelections()[i];
276
+ if (range.empty())
277
+ cm.replaceRange(cm.getLine(range.head.line) + "\n", Pos(range.head.line, 0));
278
+ else
279
+ cm.replaceRange(cm.getRange(range.from(), range.to()), range.from());
280
+ }
281
+ cm.scrollIntoView();
282
+ });
283
+ };
284
+
285
+ map[ctrl + "T"] = "transposeChars";
286
+
287
+ function sortLines(cm, caseSensitive) {
288
+ var ranges = cm.listSelections(), toSort = [], selected;
289
+ for (var i = 0; i < ranges.length; i++) {
290
+ var range = ranges[i];
291
+ if (range.empty()) continue;
292
+ var from = range.from().line, to = range.to().line;
293
+ while (i < ranges.length - 1 && ranges[i + 1].from().line == to)
294
+ to = range[++i].to().line;
295
+ toSort.push(from, to);
296
+ }
297
+ if (toSort.length) selected = true;
298
+ else toSort.push(cm.firstLine(), cm.lastLine());
299
+
300
+ cm.operation(function() {
301
+ var ranges = [];
302
+ for (var i = 0; i < toSort.length; i += 2) {
303
+ var from = toSort[i], to = toSort[i + 1];
304
+ var start = Pos(from, 0), end = Pos(to);
305
+ var lines = cm.getRange(start, end, false);
306
+ if (caseSensitive)
307
+ lines.sort();
308
+ else
309
+ lines.sort(function(a, b) {
310
+ var au = a.toUpperCase(), bu = b.toUpperCase();
311
+ if (au != bu) { a = au; b = bu; }
312
+ return a < b ? -1 : a == b ? 0 : 1;
313
+ });
314
+ cm.replaceRange(lines, start, end);
315
+ if (selected) ranges.push({anchor: start, head: end});
316
+ }
317
+ if (selected) cm.setSelections(ranges, 0);
318
+ });
319
+ }
320
+
321
+ cmds[map["F9"] = "sortLines"] = function(cm) { sortLines(cm, true); };
322
+ cmds[map[ctrl + "F9"] = "sortLinesInsensitive"] = function(cm) { sortLines(cm, false); };
323
+
324
+ cmds[map["F2"] = "nextBookmark"] = function(cm) {
325
+ var marks = cm.state.sublimeBookmarks;
326
+ if (marks) while (marks.length) {
327
+ var current = marks.shift();
328
+ var found = current.find();
329
+ if (found) {
330
+ marks.push(current);
331
+ return cm.setSelection(found.from, found.to);
332
+ }
333
+ }
334
+ };
335
+
336
+ cmds[map["Shift-F2"] = "prevBookmark"] = function(cm) {
337
+ var marks = cm.state.sublimeBookmarks;
338
+ if (marks) while (marks.length) {
339
+ marks.unshift(marks.pop());
340
+ var found = marks[marks.length - 1].find();
341
+ if (!found)
342
+ marks.pop();
343
+ else
344
+ return cm.setSelection(found.from, found.to);
345
+ }
346
+ };
347
+
348
+ cmds[map[ctrl + "F2"] = "toggleBookmark"] = function(cm) {
349
+ var ranges = cm.listSelections();
350
+ var marks = cm.state.sublimeBookmarks || (cm.state.sublimeBookmarks = []);
351
+ for (var i = 0; i < ranges.length; i++) {
352
+ var from = ranges[i].from(), to = ranges[i].to();
353
+ var found = cm.findMarks(from, to);
354
+ for (var j = 0; j < found.length; j++) {
355
+ if (found[j].sublimeBookmark) {
356
+ found[j].clear();
357
+ for (var k = 0; k < marks.length; k++)
358
+ if (marks[k] == found[j])
359
+ marks.splice(k--, 1);
360
+ break;
361
+ }
362
+ }
363
+ if (j == found.length)
364
+ marks.push(cm.markText(from, to, {sublimeBookmark: true, clearWhenEmpty: false}));
365
+ }
366
+ };
367
+
368
+ cmds[map["Shift-" + ctrl + "F2"] = "clearBookmarks"] = function(cm) {
369
+ var marks = cm.state.sublimeBookmarks;
370
+ if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
371
+ marks.length = 0;
372
+ };
373
+
374
+ cmds[map["Alt-F2"] = "selectBookmarks"] = function(cm) {
375
+ var marks = cm.state.sublimeBookmarks, ranges = [];
376
+ if (marks) for (var i = 0; i < marks.length; i++) {
377
+ var found = marks[i].find();
378
+ if (!found)
379
+ marks.splice(i--, 0);
380
+ else
381
+ ranges.push({anchor: found.from, head: found.to});
382
+ }
383
+ if (ranges.length)
384
+ cm.setSelections(ranges, 0);
385
+ };
386
+
387
+ map["Alt-Q"] = "wrapLines";
388
+
389
+ var cK = ctrl + "K ";
390
+
391
+ function modifyWordOrSelection(cm, mod) {
392
+ cm.operation(function() {
393
+ var ranges = cm.listSelections(), indices = [], replacements = [];
394
+ for (var i = 0; i < ranges.length; i++) {
395
+ var range = ranges[i];
396
+ if (range.empty()) { indices.push(i); replacements.push(""); }
397
+ else replacements.push(mod(cm.getRange(range.from(), range.to())));
398
+ }
399
+ cm.replaceSelections(replacements, "around", "case");
400
+ for (var i = indices.length - 1, at; i >= 0; i--) {
401
+ var range = ranges[indices[i]];
402
+ if (at && CodeMirror.cmpPos(range.head, at) > 0) continue;
403
+ var word = wordAt(cm, range.head);
404
+ at = word.from;
405
+ cm.replaceRange(mod(word.word), word.from, word.to);
406
+ }
407
+ });
408
+ }
409
+
410
+ map[cK + ctrl + "Backspace"] = "delLineLeft";
411
+
412
+ cmds[map[cK + ctrl + "K"] = "delLineRight"] = function(cm) {
413
+ cm.operation(function() {
414
+ var ranges = cm.listSelections();
415
+ for (var i = ranges.length - 1; i >= 0; i--)
416
+ cm.replaceRange("", ranges[i].anchor, Pos(ranges[i].to().line), "+delete");
417
+ cm.scrollIntoView();
418
+ });
419
+ };
420
+
421
+ cmds[map[cK + ctrl + "U"] = "upcaseAtCursor"] = function(cm) {
422
+ modifyWordOrSelection(cm, function(str) { return str.toUpperCase(); });
423
+ };
424
+ cmds[map[cK + ctrl + "L"] = "downcaseAtCursor"] = function(cm) {
425
+ modifyWordOrSelection(cm, function(str) { return str.toLowerCase(); });
426
+ };
427
+
428
+ cmds[map[cK + ctrl + "Space"] = "setSublimeMark"] = function(cm) {
429
+ if (cm.state.sublimeMark) cm.state.sublimeMark.clear();
430
+ cm.state.sublimeMark = cm.setBookmark(cm.getCursor());
431
+ };
432
+ cmds[map[cK + ctrl + "A"] = "selectToSublimeMark"] = function(cm) {
433
+ var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
434
+ if (found) cm.setSelection(cm.getCursor(), found);
435
+ };
436
+ cmds[map[cK + ctrl + "W"] = "deleteToSublimeMark"] = function(cm) {
437
+ var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
438
+ if (found) {
439
+ var from = cm.getCursor(), to = found;
440
+ if (CodeMirror.cmpPos(from, to) > 0) { var tmp = to; to = from; from = tmp; }
441
+ cm.state.sublimeKilled = cm.getRange(from, to);
442
+ cm.replaceRange("", from, to);
443
+ }
444
+ };
445
+ cmds[map[cK + ctrl + "X"] = "swapWithSublimeMark"] = function(cm) {
446
+ var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
447
+ if (found) {
448
+ cm.state.sublimeMark.clear();
449
+ cm.state.sublimeMark = cm.setBookmark(cm.getCursor());
450
+ cm.setCursor(found);
451
+ }
452
+ };
453
+ cmds[map[cK + ctrl + "Y"] = "sublimeYank"] = function(cm) {
454
+ if (cm.state.sublimeKilled != null)
455
+ cm.replaceSelection(cm.state.sublimeKilled, null, "paste");
456
+ };
457
+
458
+ map[cK + ctrl + "G"] = "clearBookmarks";
459
+ cmds[map[cK + ctrl + "C"] = "showInCenter"] = function(cm) {
460
+ var pos = cm.cursorCoords(null, "local");
461
+ cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);
462
+ };
463
+
464
+ cmds[map["Shift-Alt-Up"] = "selectLinesUpward"] = function(cm) {
465
+ cm.operation(function() {
466
+ var ranges = cm.listSelections();
467
+ for (var i = 0; i < ranges.length; i++) {
468
+ var range = ranges[i];
469
+ if (range.head.line > cm.firstLine())
470
+ cm.addSelection(Pos(range.head.line - 1, range.head.ch));
471
+ }
472
+ });
473
+ };
474
+ cmds[map["Shift-Alt-Down"] = "selectLinesDownward"] = function(cm) {
475
+ cm.operation(function() {
476
+ var ranges = cm.listSelections();
477
+ for (var i = 0; i < ranges.length; i++) {
478
+ var range = ranges[i];
479
+ if (range.head.line < cm.lastLine())
480
+ cm.addSelection(Pos(range.head.line + 1, range.head.ch));
481
+ }
482
+ });
483
+ };
484
+
485
+ function getTarget(cm) {
486
+ var from = cm.getCursor("from"), to = cm.getCursor("to");
487
+ if (CodeMirror.cmpPos(from, to) == 0) {
488
+ var word = wordAt(cm, from);
489
+ if (!word.word) return;
490
+ from = word.from;
491
+ to = word.to;
492
+ }
493
+ return {from: from, to: to, query: cm.getRange(from, to), word: word};
494
+ }
495
+
496
+ function findAndGoTo(cm, forward) {
497
+ var target = getTarget(cm);
498
+ if (!target) return;
499
+ var query = target.query;
500
+ var cur = cm.getSearchCursor(query, forward ? target.to : target.from);
501
+
502
+ if (forward ? cur.findNext() : cur.findPrevious()) {
503
+ cm.setSelection(cur.from(), cur.to());
504
+ } else {
505
+ cur = cm.getSearchCursor(query, forward ? Pos(cm.firstLine(), 0)
506
+ : cm.clipPos(Pos(cm.lastLine())));
507
+ if (forward ? cur.findNext() : cur.findPrevious())
508
+ cm.setSelection(cur.from(), cur.to());
509
+ else if (target.word)
510
+ cm.setSelection(target.from, target.to);
511
+ }
512
+ };
513
+ cmds[map[ctrl + "F3"] = "findUnder"] = function(cm) { findAndGoTo(cm, true); };
514
+ cmds[map["Shift-" + ctrl + "F3"] = "findUnderPrevious"] = function(cm) { findAndGoTo(cm,false); };
515
+ cmds[map["Alt-F3"] = "findAllUnder"] = function(cm) {
516
+ var target = getTarget(cm);
517
+ if (!target) return;
518
+ var cur = cm.getSearchCursor(target.query);
519
+ var matches = [];
520
+ var primaryIndex = -1;
521
+ while (cur.findNext()) {
522
+ matches.push({anchor: cur.from(), head: cur.to()});
523
+ if (cur.from().line <= target.from.line && cur.from().ch <= target.from.ch)
524
+ primaryIndex++;
525
+ }
526
+ cm.setSelections(matches, primaryIndex);
527
+ };
528
+
529
+ map["Shift-" + ctrl + "["] = "fold";
530
+ map["Shift-" + ctrl + "]"] = "unfold";
531
+ map[cK + ctrl + "0"] = map[cK + ctrl + "j"] = "unfoldAll";
532
+
533
+ map[ctrl + "I"] = "findIncremental";
534
+ map["Shift-" + ctrl + "I"] = "findIncrementalReverse";
535
+ map[ctrl + "H"] = "replace";
536
+ map["F3"] = "findNext";
537
+ map["Shift-F3"] = "findPrev";
538
+
539
+ CodeMirror.normalizeKeyMap(map);
540
+ });