@muze-nl/simplystore 0.1.2
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.
- package/.dockerignore +8 -0
- package/.github/workflows/docker-build.yml +45 -0
- package/.gitignore~ +1 -0
- package/Dockerfile +60 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/data.jsontag +20 -0
- package/design/access-management.md +25 -0
- package/design/acid.md +31 -0
- package/design/commands.md +25 -0
- package/design/identity.md +71 -0
- package/design/immutability.md +26 -0
- package/design/jsontag-selector.md +365 -0
- package/design/multitasking.md +13 -0
- package/design/thoughts.md +32 -0
- package/docs/docker.md +129 -0
- package/package.json +29 -0
- package/package.json~ +29 -0
- package/src/run.mjs +3 -0
- package/src/server.mjs +323 -0
- package/src/triplestore.mjs +182 -0
- package/www/assets/css/style.css +2296 -0
- package/www/assets/feather-sprite.svg +1 -0
- package/www/assets/img/simplystore-narrow-white.svg +138 -0
- package/www/assets/img/simplystore-narrow.svg +138 -0
- package/www/assets/img/simplystore-white.svg +153 -0
- package/www/assets/img/simplystore.svg +153 -0
- package/www/codemirror/AUTHORS +979 -0
- package/www/codemirror/CHANGELOG.md +2208 -0
- package/www/codemirror/CONTRIBUTING.md +92 -0
- package/www/codemirror/LICENSE +21 -0
- package/www/codemirror/README.md +47 -0
- package/www/codemirror/addon/comment/comment.js +211 -0
- package/www/codemirror/addon/comment/continuecomment.js +114 -0
- package/www/codemirror/addon/dialog/dialog.css +32 -0
- package/www/codemirror/addon/dialog/dialog.js +163 -0
- package/www/codemirror/addon/display/autorefresh.js +47 -0
- package/www/codemirror/addon/display/fullscreen.css +6 -0
- package/www/codemirror/addon/display/fullscreen.js +41 -0
- package/www/codemirror/addon/display/panel.js +133 -0
- package/www/codemirror/addon/display/placeholder.js +78 -0
- package/www/codemirror/addon/display/rulers.js +51 -0
- package/www/codemirror/addon/edit/closebrackets.js +201 -0
- package/www/codemirror/addon/edit/closetag.js +185 -0
- package/www/codemirror/addon/edit/continuelist.js +101 -0
- package/www/codemirror/addon/edit/matchbrackets.js +160 -0
- package/www/codemirror/addon/edit/matchtags.js +66 -0
- package/www/codemirror/addon/edit/trailingspace.js +27 -0
- package/www/codemirror/addon/fold/brace-fold.js +119 -0
- package/www/codemirror/addon/fold/comment-fold.js +59 -0
- package/www/codemirror/addon/fold/foldcode.js +159 -0
- package/www/codemirror/addon/fold/foldgutter.css +20 -0
- package/www/codemirror/addon/fold/foldgutter.js +169 -0
- package/www/codemirror/addon/fold/indent-fold.js +48 -0
- package/www/codemirror/addon/fold/markdown-fold.js +49 -0
- package/www/codemirror/addon/fold/xml-fold.js +184 -0
- package/www/codemirror/addon/hint/anyword-hint.js +41 -0
- package/www/codemirror/addon/hint/css-hint.js +66 -0
- package/www/codemirror/addon/hint/html-hint.js +351 -0
- package/www/codemirror/addon/hint/javascript-hint.js +162 -0
- package/www/codemirror/addon/hint/show-hint.css +37 -0
- package/www/codemirror/addon/hint/show-hint.js +523 -0
- package/www/codemirror/addon/hint/sql-hint.js +304 -0
- package/www/codemirror/addon/hint/xml-hint.js +132 -0
- package/www/codemirror/addon/lint/coffeescript-lint.js +47 -0
- package/www/codemirror/addon/lint/css-lint.js +40 -0
- package/www/codemirror/addon/lint/html-lint.js +59 -0
- package/www/codemirror/addon/lint/javascript-lint.js +65 -0
- package/www/codemirror/addon/lint/json-lint.js +40 -0
- package/www/codemirror/addon/lint/lint.css +79 -0
- package/www/codemirror/addon/lint/lint.js +291 -0
- package/www/codemirror/addon/lint/yaml-lint.js +41 -0
- package/www/codemirror/addon/merge/merge.css +119 -0
- package/www/codemirror/addon/merge/merge.js +1018 -0
- package/www/codemirror/addon/mode/loadmode.js +66 -0
- package/www/codemirror/addon/mode/multiplex.js +136 -0
- package/www/codemirror/addon/mode/multiplex_test.js +49 -0
- package/www/codemirror/addon/mode/overlay.js +90 -0
- package/www/codemirror/addon/mode/simple.js +216 -0
- package/www/codemirror/addon/runmode/colorize.js +40 -0
- package/www/codemirror/addon/runmode/runmode-standalone.js +334 -0
- package/www/codemirror/addon/runmode/runmode.js +76 -0
- package/www/codemirror/addon/runmode/runmode.node.js +329 -0
- package/www/codemirror/addon/scroll/annotatescrollbar.js +128 -0
- package/www/codemirror/addon/scroll/scrollpastend.js +48 -0
- package/www/codemirror/addon/scroll/simplescrollbars.css +66 -0
- package/www/codemirror/addon/scroll/simplescrollbars.js +152 -0
- package/www/codemirror/addon/search/jump-to-line.js +53 -0
- package/www/codemirror/addon/search/match-highlighter.js +167 -0
- package/www/codemirror/addon/search/matchesonscrollbar.css +8 -0
- package/www/codemirror/addon/search/matchesonscrollbar.js +97 -0
- package/www/codemirror/addon/search/search.js +295 -0
- package/www/codemirror/addon/search/searchcursor.js +305 -0
- package/www/codemirror/addon/selection/active-line.js +72 -0
- package/www/codemirror/addon/selection/mark-selection.js +119 -0
- package/www/codemirror/addon/selection/selection-pointer.js +98 -0
- package/www/codemirror/addon/tern/tern.css +87 -0
- package/www/codemirror/addon/tern/tern.js +756 -0
- package/www/codemirror/addon/tern/worker.js +44 -0
- package/www/codemirror/addon/wrap/hardwrap.js +160 -0
- package/www/codemirror/bin/source-highlight +48 -0
- package/www/codemirror/keymap/emacs.js +545 -0
- package/www/codemirror/keymap/sublime.js +720 -0
- package/www/codemirror/keymap/vim.js +5978 -0
- package/www/codemirror/lib/codemirror.css +344 -0
- package/www/codemirror/lib/codemirror.js +9874 -0
- package/www/codemirror/mode/apl/apl.js +174 -0
- package/www/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- package/www/codemirror/mode/asn.1/asn.1.js +204 -0
- package/www/codemirror/mode/asterisk/asterisk.js +220 -0
- package/www/codemirror/mode/brainfuck/brainfuck.js +85 -0
- package/www/codemirror/mode/clike/clike.js +940 -0
- package/www/codemirror/mode/clojure/clojure.js +292 -0
- package/www/codemirror/mode/cmake/cmake.js +97 -0
- package/www/codemirror/mode/cobol/cobol.js +255 -0
- package/www/codemirror/mode/coffeescript/coffeescript.js +359 -0
- package/www/codemirror/mode/commonlisp/commonlisp.js +125 -0
- package/www/codemirror/mode/crystal/crystal.js +433 -0
- package/www/codemirror/mode/css/css.js +862 -0
- package/www/codemirror/mode/cypher/cypher.js +152 -0
- package/www/codemirror/mode/d/d.js +223 -0
- package/www/codemirror/mode/dart/dart.js +166 -0
- package/www/codemirror/mode/diff/diff.js +47 -0
- package/www/codemirror/mode/django/django.js +356 -0
- package/www/codemirror/mode/dockerfile/dockerfile.js +211 -0
- package/www/codemirror/mode/dtd/dtd.js +142 -0
- package/www/codemirror/mode/dylan/dylan.js +352 -0
- package/www/codemirror/mode/ebnf/ebnf.js +195 -0
- package/www/codemirror/mode/ecl/ecl.js +206 -0
- package/www/codemirror/mode/eiffel/eiffel.js +160 -0
- package/www/codemirror/mode/elm/elm.js +245 -0
- package/www/codemirror/mode/erlang/erlang.js +619 -0
- package/www/codemirror/mode/factor/factor.js +85 -0
- package/www/codemirror/mode/fcl/fcl.js +173 -0
- package/www/codemirror/mode/forth/forth.js +180 -0
- package/www/codemirror/mode/fortran/fortran.js +188 -0
- package/www/codemirror/mode/gas/gas.js +353 -0
- package/www/codemirror/mode/gfm/gfm.js +129 -0
- package/www/codemirror/mode/gherkin/gherkin.js +178 -0
- package/www/codemirror/mode/go/go.js +187 -0
- package/www/codemirror/mode/groovy/groovy.js +247 -0
- package/www/codemirror/mode/haml/haml.js +161 -0
- package/www/codemirror/mode/handlebars/handlebars.js +70 -0
- package/www/codemirror/mode/haskell/haskell.js +268 -0
- package/www/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- package/www/codemirror/mode/haxe/haxe.js +515 -0
- package/www/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- package/www/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
- package/www/codemirror/mode/http/http.js +113 -0
- package/www/codemirror/mode/idl/idl.js +290 -0
- package/www/codemirror/mode/javascript/javascript.js +960 -0
- package/www/codemirror/mode/jinja2/jinja2.js +193 -0
- package/www/codemirror/mode/jsx/jsx.js +148 -0
- package/www/codemirror/mode/julia/julia.js +390 -0
- package/www/codemirror/mode/livescript/livescript.js +280 -0
- package/www/codemirror/mode/lua/lua.js +160 -0
- package/www/codemirror/mode/markdown/markdown.js +886 -0
- package/www/codemirror/mode/mathematica/mathematica.js +176 -0
- package/www/codemirror/mode/mbox/mbox.js +129 -0
- package/www/codemirror/mode/meta.js +221 -0
- package/www/codemirror/mode/mirc/mirc.js +193 -0
- package/www/codemirror/mode/mllike/mllike.js +359 -0
- package/www/codemirror/mode/modelica/modelica.js +245 -0
- package/www/codemirror/mode/mscgen/mscgen.js +175 -0
- package/www/codemirror/mode/mumps/mumps.js +148 -0
- package/www/codemirror/mode/nginx/nginx.js +178 -0
- package/www/codemirror/mode/nsis/nsis.js +95 -0
- package/www/codemirror/mode/ntriples/ntriples.js +195 -0
- package/www/codemirror/mode/octave/octave.js +139 -0
- package/www/codemirror/mode/oz/oz.js +252 -0
- package/www/codemirror/mode/pascal/pascal.js +136 -0
- package/www/codemirror/mode/pegjs/pegjs.js +111 -0
- package/www/codemirror/mode/perl/perl.js +836 -0
- package/www/codemirror/mode/php/php.js +234 -0
- package/www/codemirror/mode/pig/pig.js +178 -0
- package/www/codemirror/mode/powershell/powershell.js +398 -0
- package/www/codemirror/mode/properties/properties.js +78 -0
- package/www/codemirror/mode/protobuf/protobuf.js +72 -0
- package/www/codemirror/mode/pug/pug.js +591 -0
- package/www/codemirror/mode/puppet/puppet.js +220 -0
- package/www/codemirror/mode/python/python.js +402 -0
- package/www/codemirror/mode/q/q.js +139 -0
- package/www/codemirror/mode/r/r.js +190 -0
- package/www/codemirror/mode/rpm/changes/index.html +66 -0
- package/www/codemirror/mode/rpm/rpm.js +109 -0
- package/www/codemirror/mode/rst/rst.js +557 -0
- package/www/codemirror/mode/ruby/ruby.js +303 -0
- package/www/codemirror/mode/rust/rust.js +72 -0
- package/www/codemirror/mode/sas/sas.js +303 -0
- package/www/codemirror/mode/sass/sass.js +459 -0
- package/www/codemirror/mode/scheme/scheme.js +284 -0
- package/www/codemirror/mode/shell/shell.js +168 -0
- package/www/codemirror/mode/sieve/sieve.js +193 -0
- package/www/codemirror/mode/slim/slim.js +575 -0
- package/www/codemirror/mode/smalltalk/smalltalk.js +168 -0
- package/www/codemirror/mode/smarty/smarty.js +225 -0
- package/www/codemirror/mode/solr/solr.js +104 -0
- package/www/codemirror/mode/soy/soy.js +665 -0
- package/www/codemirror/mode/sparql/sparql.js +184 -0
- package/www/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- package/www/codemirror/mode/sql/sql.js +525 -0
- package/www/codemirror/mode/stex/stex.js +264 -0
- package/www/codemirror/mode/stylus/stylus.js +775 -0
- package/www/codemirror/mode/swift/swift.js +221 -0
- package/www/codemirror/mode/tcl/tcl.js +140 -0
- package/www/codemirror/mode/textile/textile.js +469 -0
- package/www/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- package/www/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- package/www/codemirror/mode/tiki/tiki.css +26 -0
- package/www/codemirror/mode/tiki/tiki.js +312 -0
- package/www/codemirror/mode/toml/toml.js +88 -0
- package/www/codemirror/mode/tornado/tornado.js +68 -0
- package/www/codemirror/mode/troff/troff.js +84 -0
- package/www/codemirror/mode/ttcn/ttcn.js +283 -0
- package/www/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- package/www/codemirror/mode/turtle/turtle.js +162 -0
- package/www/codemirror/mode/twig/twig.js +141 -0
- package/www/codemirror/mode/vb/vb.js +275 -0
- package/www/codemirror/mode/vbscript/vbscript.js +350 -0
- package/www/codemirror/mode/velocity/velocity.js +202 -0
- package/www/codemirror/mode/verilog/verilog.js +781 -0
- package/www/codemirror/mode/vhdl/vhdl.js +189 -0
- package/www/codemirror/mode/vue/vue.js +77 -0
- package/www/codemirror/mode/wast/wast.js +132 -0
- package/www/codemirror/mode/webidl/webidl.js +195 -0
- package/www/codemirror/mode/xml/xml.js +417 -0
- package/www/codemirror/mode/xquery/xquery.js +448 -0
- package/www/codemirror/mode/yacas/yacas.js +204 -0
- package/www/codemirror/mode/yaml/yaml.js +120 -0
- package/www/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +72 -0
- package/www/codemirror/mode/z80/z80.js +116 -0
- package/www/codemirror/package.json +52 -0
- package/www/codemirror/rollup.config.js +52 -0
- package/www/codemirror/src/addon/runmode/codemirror-standalone.js +24 -0
- package/www/codemirror/src/addon/runmode/codemirror.node.js +21 -0
- package/www/codemirror/src/addon/runmode/runmode-standalone.js +2 -0
- package/www/codemirror/src/addon/runmode/runmode.node.js +2 -0
- package/www/codemirror/src/codemirror.js +3 -0
- package/www/codemirror/src/display/Display.js +116 -0
- package/www/codemirror/src/display/focus.js +50 -0
- package/www/codemirror/src/display/gutters.js +44 -0
- package/www/codemirror/src/display/highlight_worker.js +55 -0
- package/www/codemirror/src/display/line_numbers.js +48 -0
- package/www/codemirror/src/display/mode_state.js +22 -0
- package/www/codemirror/src/display/operations.js +206 -0
- package/www/codemirror/src/display/scroll_events.js +132 -0
- package/www/codemirror/src/display/scrollbars.js +194 -0
- package/www/codemirror/src/display/scrolling.js +186 -0
- package/www/codemirror/src/display/selection.js +173 -0
- package/www/codemirror/src/display/update_display.js +267 -0
- package/www/codemirror/src/display/update_line.js +189 -0
- package/www/codemirror/src/display/update_lines.js +82 -0
- package/www/codemirror/src/display/view_tracking.js +153 -0
- package/www/codemirror/src/edit/CodeMirror.js +217 -0
- package/www/codemirror/src/edit/commands.js +178 -0
- package/www/codemirror/src/edit/deleteNearSelection.js +30 -0
- package/www/codemirror/src/edit/drop_events.js +130 -0
- package/www/codemirror/src/edit/fromTextArea.js +61 -0
- package/www/codemirror/src/edit/global_events.js +45 -0
- package/www/codemirror/src/edit/key_events.js +163 -0
- package/www/codemirror/src/edit/legacy.js +62 -0
- package/www/codemirror/src/edit/main.js +69 -0
- package/www/codemirror/src/edit/methods.js +555 -0
- package/www/codemirror/src/edit/mouse_events.js +417 -0
- package/www/codemirror/src/edit/options.js +194 -0
- package/www/codemirror/src/edit/utils.js +7 -0
- package/www/codemirror/src/input/ContentEditableInput.js +546 -0
- package/www/codemirror/src/input/TextareaInput.js +380 -0
- package/www/codemirror/src/input/indent.js +71 -0
- package/www/codemirror/src/input/input.js +134 -0
- package/www/codemirror/src/input/keymap.js +147 -0
- package/www/codemirror/src/input/keynames.js +17 -0
- package/www/codemirror/src/input/movement.js +111 -0
- package/www/codemirror/src/line/highlight.js +284 -0
- package/www/codemirror/src/line/line_data.js +349 -0
- package/www/codemirror/src/line/pos.js +40 -0
- package/www/codemirror/src/line/saw_special_spans.js +10 -0
- package/www/codemirror/src/line/spans.js +390 -0
- package/www/codemirror/src/line/utils_line.js +85 -0
- package/www/codemirror/src/measurement/position_measurement.js +702 -0
- package/www/codemirror/src/measurement/widgets.js +26 -0
- package/www/codemirror/src/model/Doc.js +436 -0
- package/www/codemirror/src/model/change_measurement.js +61 -0
- package/www/codemirror/src/model/changes.js +339 -0
- package/www/codemirror/src/model/chunk.js +167 -0
- package/www/codemirror/src/model/document_data.js +112 -0
- package/www/codemirror/src/model/history.js +228 -0
- package/www/codemirror/src/model/line_widget.js +78 -0
- package/www/codemirror/src/model/mark_text.js +293 -0
- package/www/codemirror/src/model/selection.js +84 -0
- package/www/codemirror/src/model/selection_updates.js +216 -0
- package/www/codemirror/src/modes.js +96 -0
- package/www/codemirror/src/util/StringStream.js +90 -0
- package/www/codemirror/src/util/bidi.js +215 -0
- package/www/codemirror/src/util/browser.js +34 -0
- package/www/codemirror/src/util/dom.js +101 -0
- package/www/codemirror/src/util/event.js +103 -0
- package/www/codemirror/src/util/feature_detection.js +84 -0
- package/www/codemirror/src/util/misc.js +168 -0
- package/www/codemirror/src/util/operation_group.js +72 -0
- package/www/codemirror/theme/3024-day.css +41 -0
- package/www/codemirror/theme/3024-night.css +39 -0
- package/www/codemirror/theme/abbott.css +268 -0
- package/www/codemirror/theme/abcdef.css +32 -0
- package/www/codemirror/theme/ambiance-mobile.css +5 -0
- package/www/codemirror/theme/ambiance.css +74 -0
- package/www/codemirror/theme/ayu-dark.css +44 -0
- package/www/codemirror/theme/ayu-mirage.css +45 -0
- package/www/codemirror/theme/base16-dark.css +40 -0
- package/www/codemirror/theme/base16-light.css +38 -0
- package/www/codemirror/theme/bespin.css +34 -0
- package/www/codemirror/theme/blackboard.css +32 -0
- package/www/codemirror/theme/cobalt.css +25 -0
- package/www/codemirror/theme/colorforth.css +33 -0
- package/www/codemirror/theme/darcula.css +53 -0
- package/www/codemirror/theme/dracula.css +40 -0
- package/www/codemirror/theme/duotone-dark.css +35 -0
- package/www/codemirror/theme/duotone-light.css +36 -0
- package/www/codemirror/theme/eclipse.css +23 -0
- package/www/codemirror/theme/elegant.css +13 -0
- package/www/codemirror/theme/erlang-dark.css +34 -0
- package/www/codemirror/theme/gruvbox-dark.css +39 -0
- package/www/codemirror/theme/hopscotch.css +34 -0
- package/www/codemirror/theme/icecoder.css +43 -0
- package/www/codemirror/theme/idea.css +42 -0
- package/www/codemirror/theme/isotope.css +34 -0
- package/www/codemirror/theme/juejin.css +30 -0
- package/www/codemirror/theme/lesser-dark.css +47 -0
- package/www/codemirror/theme/liquibyte.css +95 -0
- package/www/codemirror/theme/lucario.css +37 -0
- package/www/codemirror/theme/material-darker.css +135 -0
- package/www/codemirror/theme/material-ocean.css +141 -0
- package/www/codemirror/theme/material-palenight.css +141 -0
- package/www/codemirror/theme/material.css +141 -0
- package/www/codemirror/theme/mbo.css +37 -0
- package/www/codemirror/theme/mdn-like.css +46 -0
- package/www/codemirror/theme/midnight.css +39 -0
- package/www/codemirror/theme/monokai.css +41 -0
- package/www/codemirror/theme/moxer.css +143 -0
- package/www/codemirror/theme/neat.css +12 -0
- package/www/codemirror/theme/neo.css +43 -0
- package/www/codemirror/theme/night.css +27 -0
- package/www/codemirror/theme/nord.css +42 -0
- package/www/codemirror/theme/oceanic-next.css +46 -0
- package/www/codemirror/theme/panda-syntax.css +85 -0
- package/www/codemirror/theme/paraiso-dark.css +38 -0
- package/www/codemirror/theme/paraiso-light.css +38 -0
- package/www/codemirror/theme/pastel-on-dark.css +52 -0
- package/www/codemirror/theme/railscasts.css +34 -0
- package/www/codemirror/theme/rubyblue.css +25 -0
- package/www/codemirror/theme/seti.css +44 -0
- package/www/codemirror/theme/shadowfox.css +52 -0
- package/www/codemirror/theme/solarized.css +165 -0
- package/www/codemirror/theme/ssms.css +16 -0
- package/www/codemirror/theme/the-matrix.css +30 -0
- package/www/codemirror/theme/tomorrow-night-bright.css +35 -0
- package/www/codemirror/theme/tomorrow-night-eighties.css +38 -0
- package/www/codemirror/theme/ttcn.css +64 -0
- package/www/codemirror/theme/twilight.css +32 -0
- package/www/codemirror/theme/vibrant-ink.css +34 -0
- package/www/codemirror/theme/xq-dark.css +53 -0
- package/www/codemirror/theme/xq-light.css +43 -0
- package/www/codemirror/theme/yeti.css +44 -0
- package/www/codemirror/theme/yonce.css +59 -0
- package/www/codemirror/theme/zenburn.css +37 -0
- package/www/index.html +216 -0
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
|
|
3
|
+
|
|
4
|
+
(function(mod) {
|
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
|
6
|
+
mod(require("../lib/codemirror"));
|
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
|
8
|
+
define(["../lib/codemirror"], mod);
|
|
9
|
+
else // Plain browser env
|
|
10
|
+
mod(CodeMirror);
|
|
11
|
+
})(function(CodeMirror) {
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
var cmds = CodeMirror.commands;
|
|
15
|
+
var Pos = CodeMirror.Pos;
|
|
16
|
+
function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
|
|
17
|
+
|
|
18
|
+
// Kill 'ring'
|
|
19
|
+
|
|
20
|
+
var killRing = [];
|
|
21
|
+
function addToRing(str) {
|
|
22
|
+
killRing.push(str);
|
|
23
|
+
if (killRing.length > 50) killRing.shift();
|
|
24
|
+
}
|
|
25
|
+
function growRingTop(str) {
|
|
26
|
+
if (!killRing.length) return addToRing(str);
|
|
27
|
+
killRing[killRing.length - 1] += str;
|
|
28
|
+
}
|
|
29
|
+
function getFromRing(n) { return killRing[killRing.length - (n ? Math.min(n, 1) : 1)] || ""; }
|
|
30
|
+
function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }
|
|
31
|
+
|
|
32
|
+
var lastKill = null;
|
|
33
|
+
|
|
34
|
+
// Internal generic kill function, used by several mapped kill "family" functions.
|
|
35
|
+
function _kill(cm, from, to, ring, text) {
|
|
36
|
+
if (text == null) text = cm.getRange(from, to);
|
|
37
|
+
|
|
38
|
+
if (ring == "grow" && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
|
|
39
|
+
growRingTop(text);
|
|
40
|
+
else if (ring !== false)
|
|
41
|
+
addToRing(text);
|
|
42
|
+
cm.replaceRange("", from, to, "+delete");
|
|
43
|
+
|
|
44
|
+
if (ring == "grow") lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};
|
|
45
|
+
else lastKill = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Boundaries of various units
|
|
49
|
+
|
|
50
|
+
function byChar(cm, pos, dir) {
|
|
51
|
+
return cm.findPosH(pos, dir, "char", true);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function byWord(cm, pos, dir) {
|
|
55
|
+
return cm.findPosH(pos, dir, "word", true);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function byLine(cm, pos, dir) {
|
|
59
|
+
return cm.findPosV(pos, dir, "line", cm.doc.sel.goalColumn);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function byPage(cm, pos, dir) {
|
|
63
|
+
return cm.findPosV(pos, dir, "page", cm.doc.sel.goalColumn);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function byParagraph(cm, pos, dir) {
|
|
67
|
+
var no = pos.line, line = cm.getLine(no);
|
|
68
|
+
var sawText = /\S/.test(dir < 0 ? line.slice(0, pos.ch) : line.slice(pos.ch));
|
|
69
|
+
var fst = cm.firstLine(), lst = cm.lastLine();
|
|
70
|
+
for (;;) {
|
|
71
|
+
no += dir;
|
|
72
|
+
if (no < fst || no > lst)
|
|
73
|
+
return cm.clipPos(Pos(no - dir, dir < 0 ? 0 : null));
|
|
74
|
+
line = cm.getLine(no);
|
|
75
|
+
var hasText = /\S/.test(line);
|
|
76
|
+
if (hasText) sawText = true;
|
|
77
|
+
else if (sawText) return Pos(no, 0);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function bySentence(cm, pos, dir) {
|
|
82
|
+
var line = pos.line, ch = pos.ch;
|
|
83
|
+
var text = cm.getLine(pos.line), sawWord = false;
|
|
84
|
+
for (;;) {
|
|
85
|
+
var next = text.charAt(ch + (dir < 0 ? -1 : 0));
|
|
86
|
+
if (!next) { // End/beginning of line reached
|
|
87
|
+
if (line == (dir < 0 ? cm.firstLine() : cm.lastLine())) return Pos(line, ch);
|
|
88
|
+
text = cm.getLine(line + dir);
|
|
89
|
+
if (!/\S/.test(text)) return Pos(line, ch);
|
|
90
|
+
line += dir;
|
|
91
|
+
ch = dir < 0 ? text.length : 0;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (sawWord && /[!?.]/.test(next)) return Pos(line, ch + (dir > 0 ? 1 : 0));
|
|
95
|
+
if (!sawWord) sawWord = /\w/.test(next);
|
|
96
|
+
ch += dir;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function byExpr(cm, pos, dir) {
|
|
101
|
+
var wrap;
|
|
102
|
+
if (cm.findMatchingBracket && (wrap = cm.findMatchingBracket(pos, {strict: true}))
|
|
103
|
+
&& wrap.match && (wrap.forward ? 1 : -1) == dir)
|
|
104
|
+
return dir > 0 ? Pos(wrap.to.line, wrap.to.ch + 1) : wrap.to;
|
|
105
|
+
|
|
106
|
+
for (var first = true;; first = false) {
|
|
107
|
+
var token = cm.getTokenAt(pos);
|
|
108
|
+
var after = Pos(pos.line, dir < 0 ? token.start : token.end);
|
|
109
|
+
if (first && dir > 0 && token.end == pos.ch || !/\w/.test(token.string)) {
|
|
110
|
+
var newPos = cm.findPosH(after, dir, "char");
|
|
111
|
+
if (posEq(after, newPos)) return pos;
|
|
112
|
+
else pos = newPos;
|
|
113
|
+
} else {
|
|
114
|
+
return after;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Prefixes (only crudely supported)
|
|
120
|
+
|
|
121
|
+
function getPrefix(cm, precise) {
|
|
122
|
+
var digits = cm.state.emacsPrefix;
|
|
123
|
+
if (!digits) return precise ? null : 1;
|
|
124
|
+
clearPrefix(cm);
|
|
125
|
+
return digits == "-" ? -1 : Number(digits);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function repeated(cmd) {
|
|
129
|
+
var f = typeof cmd == "string" ? function(cm) { cm.execCommand(cmd); } : cmd;
|
|
130
|
+
return function(cm) {
|
|
131
|
+
var prefix = getPrefix(cm);
|
|
132
|
+
f(cm);
|
|
133
|
+
for (var i = 1; i < prefix; ++i) f(cm);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function findEnd(cm, pos, by, dir) {
|
|
138
|
+
var prefix = getPrefix(cm);
|
|
139
|
+
if (prefix < 0) { dir = -dir; prefix = -prefix; }
|
|
140
|
+
for (var i = 0; i < prefix; ++i) {
|
|
141
|
+
var newPos = by(cm, pos, dir);
|
|
142
|
+
if (posEq(newPos, pos)) break;
|
|
143
|
+
pos = newPos;
|
|
144
|
+
}
|
|
145
|
+
return pos;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function move(by, dir) {
|
|
149
|
+
var f = function(cm) {
|
|
150
|
+
cm.extendSelection(findEnd(cm, cm.getCursor(), by, dir));
|
|
151
|
+
};
|
|
152
|
+
f.motion = true;
|
|
153
|
+
return f;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function killTo(cm, by, dir, ring) {
|
|
157
|
+
var selections = cm.listSelections(), cursor;
|
|
158
|
+
var i = selections.length;
|
|
159
|
+
while (i--) {
|
|
160
|
+
cursor = selections[i].head;
|
|
161
|
+
_kill(cm, cursor, findEnd(cm, cursor, by, dir), ring);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function _killRegion(cm, ring) {
|
|
166
|
+
if (cm.somethingSelected()) {
|
|
167
|
+
var selections = cm.listSelections(), selection;
|
|
168
|
+
var i = selections.length;
|
|
169
|
+
while (i--) {
|
|
170
|
+
selection = selections[i];
|
|
171
|
+
_kill(cm, selection.anchor, selection.head, ring);
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function addPrefix(cm, digit) {
|
|
178
|
+
if (cm.state.emacsPrefix) {
|
|
179
|
+
if (digit != "-") cm.state.emacsPrefix += digit;
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// Not active yet
|
|
183
|
+
cm.state.emacsPrefix = digit;
|
|
184
|
+
cm.on("keyHandled", maybeClearPrefix);
|
|
185
|
+
cm.on("inputRead", maybeDuplicateInput);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
var prefixPreservingKeys = {"Alt-G": true, "Ctrl-X": true, "Ctrl-Q": true, "Ctrl-U": true};
|
|
189
|
+
|
|
190
|
+
function maybeClearPrefix(cm, arg) {
|
|
191
|
+
if (!cm.state.emacsPrefixMap && !prefixPreservingKeys.hasOwnProperty(arg))
|
|
192
|
+
clearPrefix(cm);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function clearPrefix(cm) {
|
|
196
|
+
cm.state.emacsPrefix = null;
|
|
197
|
+
cm.off("keyHandled", maybeClearPrefix);
|
|
198
|
+
cm.off("inputRead", maybeDuplicateInput);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function maybeDuplicateInput(cm, event) {
|
|
202
|
+
var dup = getPrefix(cm);
|
|
203
|
+
if (dup > 1 && event.origin == "+input") {
|
|
204
|
+
var one = event.text.join("\n"), txt = "";
|
|
205
|
+
for (var i = 1; i < dup; ++i) txt += one;
|
|
206
|
+
cm.replaceSelection(txt);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function maybeRemovePrefixMap(cm, arg) {
|
|
211
|
+
if (typeof arg == "string" && (/^\d$/.test(arg) || arg == "Ctrl-U")) return;
|
|
212
|
+
cm.removeKeyMap(prefixMap);
|
|
213
|
+
cm.state.emacsPrefixMap = false;
|
|
214
|
+
cm.off("keyHandled", maybeRemovePrefixMap);
|
|
215
|
+
cm.off("inputRead", maybeRemovePrefixMap);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Utilities
|
|
219
|
+
|
|
220
|
+
cmds.setMark = function (cm) {
|
|
221
|
+
cm.setCursor(cm.getCursor());
|
|
222
|
+
cm.setExtending(!cm.getExtending());
|
|
223
|
+
cm.on("change", function() { cm.setExtending(false); });
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function clearMark(cm) {
|
|
227
|
+
cm.setExtending(false);
|
|
228
|
+
cm.setCursor(cm.getCursor());
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function makePrompt(msg) {
|
|
232
|
+
var fragment = document.createDocumentFragment();
|
|
233
|
+
var input = document.createElement("input");
|
|
234
|
+
input.setAttribute("type", "text");
|
|
235
|
+
input.style.width = "10em";
|
|
236
|
+
fragment.appendChild(document.createTextNode(msg + ": "));
|
|
237
|
+
fragment.appendChild(input);
|
|
238
|
+
return fragment;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function getInput(cm, msg, f) {
|
|
242
|
+
if (cm.openDialog)
|
|
243
|
+
cm.openDialog(makePrompt(msg), f, {bottom: true});
|
|
244
|
+
else
|
|
245
|
+
f(prompt(msg, ""));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function operateOnWord(cm, op) {
|
|
249
|
+
var start = cm.getCursor(), end = cm.findPosH(start, 1, "word");
|
|
250
|
+
cm.replaceRange(op(cm.getRange(start, end)), start, end);
|
|
251
|
+
cm.setCursor(end);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function toEnclosingExpr(cm) {
|
|
255
|
+
var pos = cm.getCursor(), line = pos.line, ch = pos.ch;
|
|
256
|
+
var stack = [];
|
|
257
|
+
while (line >= cm.firstLine()) {
|
|
258
|
+
var text = cm.getLine(line);
|
|
259
|
+
for (var i = ch == null ? text.length : ch; i > 0;) {
|
|
260
|
+
var ch = text.charAt(--i);
|
|
261
|
+
if (ch == ")")
|
|
262
|
+
stack.push("(");
|
|
263
|
+
else if (ch == "]")
|
|
264
|
+
stack.push("[");
|
|
265
|
+
else if (ch == "}")
|
|
266
|
+
stack.push("{");
|
|
267
|
+
else if (/[\(\{\[]/.test(ch) && (!stack.length || stack.pop() != ch))
|
|
268
|
+
return cm.extendSelection(Pos(line, i));
|
|
269
|
+
}
|
|
270
|
+
--line; ch = null;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Commands. Names should match emacs function names (albeit in camelCase)
|
|
275
|
+
// except where emacs function names collide with code mirror core commands.
|
|
276
|
+
|
|
277
|
+
cmds.killRegion = function(cm) {
|
|
278
|
+
_kill(cm, cm.getCursor("start"), cm.getCursor("end"), true);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// Maps to emacs kill-line
|
|
282
|
+
cmds.killLineEmacs = repeated(function(cm) {
|
|
283
|
+
var start = cm.getCursor(), end = cm.clipPos(Pos(start.line));
|
|
284
|
+
var text = cm.getRange(start, end);
|
|
285
|
+
if (!/\S/.test(text)) {
|
|
286
|
+
text += "\n";
|
|
287
|
+
end = Pos(start.line + 1, 0);
|
|
288
|
+
}
|
|
289
|
+
_kill(cm, start, end, "grow", text);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
cmds.killRingSave = function(cm) {
|
|
293
|
+
addToRing(cm.getSelection());
|
|
294
|
+
clearMark(cm);
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
cmds.yank = function(cm) {
|
|
298
|
+
var start = cm.getCursor();
|
|
299
|
+
cm.replaceRange(getFromRing(getPrefix(cm)), start, start, "paste");
|
|
300
|
+
cm.setSelection(start, cm.getCursor());
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
cmds.yankPop = function(cm) {
|
|
304
|
+
cm.replaceSelection(popFromRing(), "around", "paste");
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
cmds.forwardChar = move(byChar, 1);
|
|
308
|
+
|
|
309
|
+
cmds.backwardChar = move(byChar, -1)
|
|
310
|
+
|
|
311
|
+
cmds.deleteChar = function(cm) { killTo(cm, byChar, 1, false); };
|
|
312
|
+
|
|
313
|
+
cmds.deleteForwardChar = function(cm) {
|
|
314
|
+
_killRegion(cm, false) || killTo(cm, byChar, 1, false);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
cmds.deleteBackwardChar = function(cm) {
|
|
318
|
+
_killRegion(cm, false) || killTo(cm, byChar, -1, false);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
cmds.forwardWord = move(byWord, 1);
|
|
322
|
+
|
|
323
|
+
cmds.backwardWord = move(byWord, -1);
|
|
324
|
+
|
|
325
|
+
cmds.killWord = function(cm) { killTo(cm, byWord, 1, "grow"); };
|
|
326
|
+
|
|
327
|
+
cmds.backwardKillWord = function(cm) { killTo(cm, byWord, -1, "grow"); };
|
|
328
|
+
|
|
329
|
+
cmds.nextLine = move(byLine, 1);
|
|
330
|
+
|
|
331
|
+
cmds.previousLine = move(byLine, -1);
|
|
332
|
+
|
|
333
|
+
cmds.scrollDownCommand = move(byPage, -1);
|
|
334
|
+
|
|
335
|
+
cmds.scrollUpCommand = move(byPage, 1);
|
|
336
|
+
|
|
337
|
+
cmds.backwardParagraph = move(byParagraph, -1);
|
|
338
|
+
|
|
339
|
+
cmds.forwardParagraph = move(byParagraph, 1);
|
|
340
|
+
|
|
341
|
+
cmds.backwardSentence = move(bySentence, -1);
|
|
342
|
+
|
|
343
|
+
cmds.forwardSentence = move(bySentence, 1);
|
|
344
|
+
|
|
345
|
+
cmds.killSentence = function(cm) { killTo(cm, bySentence, 1, "grow"); };
|
|
346
|
+
|
|
347
|
+
cmds.backwardKillSentence = function(cm) {
|
|
348
|
+
_kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), "grow");
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
cmds.killSexp = function(cm) { killTo(cm, byExpr, 1, "grow"); };
|
|
352
|
+
|
|
353
|
+
cmds.backwardKillSexp = function(cm) { killTo(cm, byExpr, -1, "grow"); };
|
|
354
|
+
|
|
355
|
+
cmds.forwardSexp = move(byExpr, 1);
|
|
356
|
+
|
|
357
|
+
cmds.backwardSexp = move(byExpr, -1);
|
|
358
|
+
|
|
359
|
+
cmds.markSexp = function(cm) {
|
|
360
|
+
var cursor = cm.getCursor();
|
|
361
|
+
cm.setSelection(findEnd(cm, cursor, byExpr, 1), cursor);
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
cmds.transposeSexps = function(cm) {
|
|
365
|
+
var leftStart = byExpr(cm, cm.getCursor(), -1);
|
|
366
|
+
var leftEnd = byExpr(cm, leftStart, 1);
|
|
367
|
+
var rightEnd = byExpr(cm, leftEnd, 1);
|
|
368
|
+
var rightStart = byExpr(cm, rightEnd, -1);
|
|
369
|
+
cm.replaceRange(cm.getRange(rightStart, rightEnd) +
|
|
370
|
+
cm.getRange(leftEnd, rightStart) +
|
|
371
|
+
cm.getRange(leftStart, leftEnd), leftStart, rightEnd);
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
cmds.backwardUpList = repeated(toEnclosingExpr);
|
|
375
|
+
|
|
376
|
+
cmds.justOneSpace = function(cm) {
|
|
377
|
+
var pos = cm.getCursor(), from = pos.ch;
|
|
378
|
+
var to = pos.ch, text = cm.getLine(pos.line);
|
|
379
|
+
while (from && /\s/.test(text.charAt(from - 1))) --from;
|
|
380
|
+
while (to < text.length && /\s/.test(text.charAt(to))) ++to;
|
|
381
|
+
cm.replaceRange(" ", Pos(pos.line, from), Pos(pos.line, to));
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
cmds.openLine = repeated(function(cm) {
|
|
385
|
+
cm.replaceSelection("\n", "start");
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// maps to emacs 'transpose-chars'
|
|
389
|
+
cmds.transposeCharsRepeatable = repeated(function(cm) {
|
|
390
|
+
cm.execCommand("transposeChars");
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
cmds.capitalizeWord = repeated(function(cm) {
|
|
394
|
+
operateOnWord(cm, function(w) {
|
|
395
|
+
var letter = w.search(/\w/);
|
|
396
|
+
if (letter == -1) return w;
|
|
397
|
+
return w.slice(0, letter) + w.charAt(letter).toUpperCase() +
|
|
398
|
+
w.slice(letter + 1).toLowerCase();
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
cmds.upcaseWord = repeated(function(cm) {
|
|
403
|
+
operateOnWord(cm, function(w) { return w.toUpperCase(); });
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
cmds.downcaseWord = repeated(function(cm) {
|
|
407
|
+
operateOnWord(cm, function(w) { return w.toLowerCase(); });
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// maps to emacs 'undo'
|
|
411
|
+
cmds.undoRepeatable = repeated("undo");
|
|
412
|
+
|
|
413
|
+
cmds.keyboardQuit = function(cm) {
|
|
414
|
+
cm.execCommand("clearSearch");
|
|
415
|
+
clearMark(cm);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
cmds.newline = repeated(function(cm) { cm.replaceSelection("\n", "end"); });
|
|
419
|
+
|
|
420
|
+
cmds.gotoLine = function(cm) {
|
|
421
|
+
var prefix = getPrefix(cm, true);
|
|
422
|
+
if (prefix != null && prefix > 0) return cm.setCursor(prefix - 1);
|
|
423
|
+
|
|
424
|
+
getInput(cm, "Goto line", function(str) {
|
|
425
|
+
var num;
|
|
426
|
+
if (str && !isNaN(num = Number(str)) && num == (num|0) && num > 0)
|
|
427
|
+
cm.setCursor(num - 1);
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
cmds.indentRigidly = function(cm) {
|
|
432
|
+
cm.indentSelection(getPrefix(cm, true) || cm.getOption("indentUnit"));
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
cmds.exchangePointAndMark = function(cm) {
|
|
436
|
+
cm.setSelection(cm.getCursor("head"), cm.getCursor("anchor"));
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
cmds.quotedInsertTab = repeated("insertTab");
|
|
440
|
+
|
|
441
|
+
cmds.universalArgument = function addPrefixMap(cm) {
|
|
442
|
+
cm.state.emacsPrefixMap = true;
|
|
443
|
+
cm.addKeyMap(prefixMap);
|
|
444
|
+
cm.on("keyHandled", maybeRemovePrefixMap);
|
|
445
|
+
cm.on("inputRead", maybeRemovePrefixMap);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
CodeMirror.emacs = {kill: _kill, killRegion: _killRegion, repeated: repeated};
|
|
449
|
+
|
|
450
|
+
// Actual keymap
|
|
451
|
+
var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({
|
|
452
|
+
"Ctrl-W": "killRegion",
|
|
453
|
+
"Ctrl-K": "killLineEmacs",
|
|
454
|
+
"Alt-W": "killRingSave",
|
|
455
|
+
"Ctrl-Y": "yank",
|
|
456
|
+
"Alt-Y": "yankPop",
|
|
457
|
+
"Ctrl-Space": "setMark",
|
|
458
|
+
"Ctrl-Shift-2": "setMark",
|
|
459
|
+
"Ctrl-F": "forwardChar",
|
|
460
|
+
"Ctrl-B": "backwardChar",
|
|
461
|
+
"Right": "forwardChar",
|
|
462
|
+
"Left": "backwardChar",
|
|
463
|
+
"Ctrl-D": "deleteChar",
|
|
464
|
+
"Delete": "deleteForwardChar",
|
|
465
|
+
"Ctrl-H": "deleteBackwardChar",
|
|
466
|
+
"Backspace": "deleteBackwardChar",
|
|
467
|
+
"Alt-F": "forwardWord",
|
|
468
|
+
"Alt-B": "backwardWord",
|
|
469
|
+
"Alt-Right": "forwardWord",
|
|
470
|
+
"Alt-Left": "backwardWord",
|
|
471
|
+
"Alt-D": "killWord",
|
|
472
|
+
"Alt-Backspace": "backwardKillWord",
|
|
473
|
+
"Ctrl-N": "nextLine",
|
|
474
|
+
"Ctrl-P": "previousLine",
|
|
475
|
+
"Down": "nextLine",
|
|
476
|
+
"Up": "previousLine",
|
|
477
|
+
"Ctrl-A": "goLineStart",
|
|
478
|
+
"Ctrl-E": "goLineEnd",
|
|
479
|
+
"End": "goLineEnd",
|
|
480
|
+
"Home": "goLineStart",
|
|
481
|
+
"Alt-V": "scrollDownCommand",
|
|
482
|
+
"Ctrl-V": "scrollUpCommand",
|
|
483
|
+
"PageUp": "scrollDownCommand",
|
|
484
|
+
"PageDown": "scrollUpCommand",
|
|
485
|
+
"Ctrl-Up": "backwardParagraph",
|
|
486
|
+
"Ctrl-Down": "forwardParagraph",
|
|
487
|
+
"Alt-{": "backwardParagraph",
|
|
488
|
+
"Alt-}": "forwardParagraph",
|
|
489
|
+
"Alt-A": "backwardSentence",
|
|
490
|
+
"Alt-E": "forwardSentence",
|
|
491
|
+
"Alt-K": "killSentence",
|
|
492
|
+
"Ctrl-X Delete": "backwardKillSentence",
|
|
493
|
+
"Ctrl-Alt-K": "killSexp",
|
|
494
|
+
"Ctrl-Alt-Backspace": "backwardKillSexp",
|
|
495
|
+
"Ctrl-Alt-F": "forwardSexp",
|
|
496
|
+
"Ctrl-Alt-B": "backwardSexp",
|
|
497
|
+
"Shift-Ctrl-Alt-2": "markSexp",
|
|
498
|
+
"Ctrl-Alt-T": "transposeSexps",
|
|
499
|
+
"Ctrl-Alt-U": "backwardUpList",
|
|
500
|
+
"Alt-Space": "justOneSpace",
|
|
501
|
+
"Ctrl-O": "openLine",
|
|
502
|
+
"Ctrl-T": "transposeCharsRepeatable",
|
|
503
|
+
"Alt-C": "capitalizeWord",
|
|
504
|
+
"Alt-U": "upcaseWord",
|
|
505
|
+
"Alt-L": "downcaseWord",
|
|
506
|
+
"Alt-;": "toggleComment",
|
|
507
|
+
"Ctrl-/": "undoRepeatable",
|
|
508
|
+
"Shift-Ctrl--": "undoRepeatable",
|
|
509
|
+
"Ctrl-Z": "undoRepeatable",
|
|
510
|
+
"Cmd-Z": "undoRepeatable",
|
|
511
|
+
"Ctrl-X U": "undoRepeatable",
|
|
512
|
+
"Shift-Ctrl-Z": "redo",
|
|
513
|
+
"Shift-Alt-,": "goDocStart",
|
|
514
|
+
"Shift-Alt-.": "goDocEnd",
|
|
515
|
+
"Ctrl-S": "findPersistentNext",
|
|
516
|
+
"Ctrl-R": "findPersistentPrev",
|
|
517
|
+
"Ctrl-G": "keyboardQuit",
|
|
518
|
+
"Shift-Alt-5": "replace",
|
|
519
|
+
"Alt-/": "autocomplete",
|
|
520
|
+
"Enter": "newlineAndIndent",
|
|
521
|
+
"Ctrl-J": "newline",
|
|
522
|
+
"Tab": "indentAuto",
|
|
523
|
+
"Alt-G G": "gotoLine",
|
|
524
|
+
"Ctrl-X Tab": "indentRigidly",
|
|
525
|
+
"Ctrl-X Ctrl-X": "exchangePointAndMark",
|
|
526
|
+
"Ctrl-X Ctrl-S": "save",
|
|
527
|
+
"Ctrl-X Ctrl-W": "save",
|
|
528
|
+
"Ctrl-X S": "saveAll",
|
|
529
|
+
"Ctrl-X F": "open",
|
|
530
|
+
"Ctrl-X K": "close",
|
|
531
|
+
"Ctrl-X H": "selectAll",
|
|
532
|
+
"Ctrl-Q Tab": "quotedInsertTab",
|
|
533
|
+
"Ctrl-U": "universalArgument",
|
|
534
|
+
"fallthrough": "default"
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
var prefixMap = {"Ctrl-G": clearPrefix};
|
|
538
|
+
function regPrefix(d) {
|
|
539
|
+
prefixMap[d] = function(cm) { addPrefix(cm, d); };
|
|
540
|
+
keyMap["Ctrl-" + d] = function(cm) { addPrefix(cm, d); };
|
|
541
|
+
prefixPreservingKeys["Ctrl-" + d] = true;
|
|
542
|
+
}
|
|
543
|
+
for (var i = 0; i < 10; ++i) regPrefix(String(i));
|
|
544
|
+
regPrefix("-");
|
|
545
|
+
});
|