wallaby 7.0.0.beta2 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/wallaby/base/_override_vars.scss +3 -0
- data/app/assets/stylesheets/wallaby/base.scss +2 -1
- data/lib/wallaby/version.rb +1 -1
- metadata +21 -434
- data/config/brakeman.ignore +0 -26
- data/config/massa.yml +0 -45
- data/config/rails_best_practices.yml +0 -42
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/comment/comment.js +0 -209
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/comment/continuecomment.js +0 -113
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/dialog/dialog.css +0 -32
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/dialog/dialog.js +0 -161
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/display/autorefresh.js +0 -47
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.css +0 -6
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/display/fullscreen.js +0 -41
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/display/panel.js +0 -127
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/display/placeholder.js +0 -63
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/display/rulers.js +0 -51
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/edit/closebrackets.js +0 -191
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/edit/closetag.js +0 -184
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/edit/continuelist.js +0 -99
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/edit/matchbrackets.js +0 -150
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/edit/matchtags.js +0 -66
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/edit/trailingspace.js +0 -27
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/brace-fold.js +0 -105
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/comment-fold.js +0 -59
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/foldcode.js +0 -152
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/foldgutter.css +0 -20
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/foldgutter.js +0 -163
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/indent-fold.js +0 -48
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/markdown-fold.js +0 -49
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/fold/xml-fold.js +0 -184
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/anyword-hint.js +0 -41
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/css-hint.js +0 -60
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/html-hint.js +0 -350
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/javascript-hint.js +0 -157
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/show-hint.css +0 -36
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/show-hint.js +0 -460
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/sql-hint.js +0 -304
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/hint/xml-hint.js +0 -123
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/coffeescript-lint.js +0 -47
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/css-lint.js +0 -40
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/html-lint.js +0 -59
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/javascript-lint.js +0 -63
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/json-lint.js +0 -40
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/lint.css +0 -73
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/lint.js +0 -252
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/lint/yaml-lint.js +0 -41
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/merge/merge.css +0 -119
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/merge/merge.js +0 -1002
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/mode/loadmode.js +0 -64
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/mode/multiplex.js +0 -131
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/mode/multiplex_test.js +0 -33
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/mode/overlay.js +0 -90
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/mode/simple.js +0 -216
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/runmode/colorize.js +0 -40
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/runmode/runmode-standalone.js +0 -158
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/runmode/runmode.js +0 -72
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/runmode/runmode.node.js +0 -197
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/scroll/annotatescrollbar.js +0 -122
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/scroll/scrollpastend.js +0 -48
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/scroll/simplescrollbars.css +0 -66
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/scroll/simplescrollbars.js +0 -152
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/search/jump-to-line.js +0 -50
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/search/match-highlighter.js +0 -165
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/search/matchesonscrollbar.css +0 -8
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/search/matchesonscrollbar.js +0 -97
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/search/search.js +0 -260
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/search/searchcursor.js +0 -293
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/selection/active-line.js +0 -72
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/selection/mark-selection.js +0 -119
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/selection/selection-pointer.js +0 -98
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/tern/tern.css +0 -87
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/tern/tern.js +0 -718
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/tern/worker.js +0 -44
- data/vendor/assets/javascripts/codemirror/5.49.2/addon/wrap/hardwrap.js +0 -145
- data/vendor/assets/javascripts/codemirror/5.49.2/lib/codemirror.js +0 -9783
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/apl/apl.js +0 -174
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/apl/index.html +0 -72
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/asciiarmor/asciiarmor.js +0 -74
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/asciiarmor/index.html +0 -46
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/asn.1/asn.1.js +0 -204
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/asn.1/index.html +0 -78
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/asterisk/asterisk.js +0 -220
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/asterisk/index.html +0 -155
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/brainfuck/brainfuck.js +0 -85
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/brainfuck/index.html +0 -85
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clike/clike.js +0 -935
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clike/index.html +0 -380
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clike/scala.html +0 -767
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clike/test.js +0 -165
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clojure/clojure.js +0 -292
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clojure/index.html +0 -95
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/clojure/test.js +0 -384
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cmake/cmake.js +0 -97
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cmake/index.html +0 -129
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cobol/cobol.js +0 -255
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cobol/index.html +0 -210
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/coffeescript/coffeescript.js +0 -359
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/coffeescript/index.html +0 -740
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/commonlisp/commonlisp.js +0 -124
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/commonlisp/index.html +0 -177
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/crystal/crystal.js +0 -433
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/crystal/index.html +0 -116
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/css.js +0 -831
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/gss.html +0 -104
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/gss_test.js +0 -17
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/index.html +0 -75
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/less.html +0 -152
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/less_test.js +0 -54
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/scss.html +0 -158
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/scss_test.js +0 -110
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/css/test.js +0 -217
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cypher/cypher.js +0 -150
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cypher/index.html +0 -64
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/cypher/test.js +0 -37
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/d/d.js +0 -223
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/d/index.html +0 -273
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/d/test.js +0 -11
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dart/dart.js +0 -166
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dart/index.html +0 -71
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/diff/diff.js +0 -47
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/diff/index.html +0 -117
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/django/django.js +0 -356
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/django/index.html +0 -73
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dockerfile/dockerfile.js +0 -211
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dockerfile/index.html +0 -73
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dockerfile/test.js +0 -128
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dtd/dtd.js +0 -142
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dtd/index.html +0 -89
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dylan/dylan.js +0 -352
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dylan/index.html +0 -407
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/dylan/test.js +0 -88
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ebnf/ebnf.js +0 -195
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ebnf/index.html +0 -102
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ecl/ecl.js +0 -206
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ecl/index.html +0 -52
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/eiffel/eiffel.js +0 -160
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/eiffel/index.html +0 -429
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/elm/elm.js +0 -205
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/elm/index.html +0 -61
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/erlang/erlang.js +0 -619
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/erlang/index.html +0 -76
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/factor/factor.js +0 -85
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/factor/index.html +0 -77
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/fcl/fcl.js +0 -173
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/fcl/index.html +0 -108
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/forth/forth.js +0 -180
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/forth/index.html +0 -75
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/fortran/fortran.js +0 -188
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/fortran/index.html +0 -81
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gas/gas.js +0 -345
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gas/index.html +0 -68
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gfm/gfm.js +0 -129
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gfm/index.html +0 -136
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gfm/test.js +0 -198
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gherkin/gherkin.js +0 -178
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/gherkin/index.html +0 -48
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/go/go.js +0 -187
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/go/index.html +0 -85
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/groovy/groovy.js +0 -233
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/groovy/index.html +0 -84
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haml/haml.js +0 -161
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haml/index.html +0 -79
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haml/test.js +0 -97
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/handlebars/handlebars.js +0 -70
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/handlebars/index.html +0 -82
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haskell/haskell.js +0 -268
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haskell/index.html +0 -73
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haskell-literate/haskell-literate.js +0 -43
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haskell-literate/index.html +0 -282
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haxe/haxe.js +0 -515
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/haxe/index.html +0 -124
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/htmlembedded/htmlembedded.js +0 -37
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/htmlembedded/index.html +0 -60
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/htmlmixed/htmlmixed.js +0 -152
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/htmlmixed/index.html +0 -100
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/http/http.js +0 -113
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/http/index.html +0 -45
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/idl/idl.js +0 -290
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/idl/index.html +0 -65
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/index.html +0 -165
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/javascript/index.html +0 -114
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/javascript/javascript.js +0 -930
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/javascript/json-ld.html +0 -72
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/javascript/test.js +0 -513
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/javascript/typescript.html +0 -62
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/jinja2/index.html +0 -54
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/jinja2/jinja2.js +0 -146
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/jsx/index.html +0 -89
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/jsx/jsx.js +0 -148
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/jsx/test.js +0 -91
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/julia/index.html +0 -196
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/julia/julia.js +0 -429
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/livescript/index.html +0 -459
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/livescript/livescript.js +0 -280
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/lua/index.html +0 -85
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/lua/lua.js +0 -159
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/markdown/index.html +0 -412
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/markdown/markdown.js +0 -883
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/markdown/test.js +0 -1317
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mathematica/index.html +0 -72
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mathematica/mathematica.js +0 -176
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mbox/index.html +0 -44
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mbox/mbox.js +0 -129
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/meta.js +0 -219
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mirc/index.html +0 -161
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mirc/mirc.js +0 -193
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mllike/index.html +0 -198
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mllike/mllike.js +0 -359
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/modelica/index.html +0 -67
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/modelica/modelica.js +0 -245
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mscgen/index.html +0 -151
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mscgen/mscgen.js +0 -175
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mscgen/mscgen_test.js +0 -84
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mscgen/msgenny_test.js +0 -77
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mscgen/xu_test.js +0 -87
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mumps/index.html +0 -85
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/mumps/mumps.js +0 -148
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/nginx/index.html +0 -181
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/nginx/nginx.js +0 -178
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/nsis/index.html +0 -80
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/nsis/nsis.js +0 -95
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ntriples/index.html +0 -70
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ntriples/ntriples.js +0 -195
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/octave/index.html +0 -84
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/octave/octave.js +0 -139
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/oz/index.html +0 -59
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/oz/oz.js +0 -252
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pascal/index.html +0 -61
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pascal/pascal.js +0 -121
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pegjs/index.html +0 -66
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pegjs/pegjs.js +0 -114
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/perl/index.html +0 -75
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/perl/perl.js +0 -837
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/php/index.html +0 -64
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/php/php.js +0 -234
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/php/test.js +0 -154
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pig/index.html +0 -53
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pig/pig.js +0 -178
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/powershell/index.html +0 -205
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/powershell/powershell.js +0 -398
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/powershell/test.js +0 -74
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/properties/index.html +0 -53
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/properties/properties.js +0 -78
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/protobuf/index.html +0 -104
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/protobuf/protobuf.js +0 -69
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pug/index.html +0 -70
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/pug/pug.js +0 -591
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/puppet/index.html +0 -121
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/puppet/puppet.js +0 -220
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/python/index.html +0 -207
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/python/python.js +0 -399
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/python/test.js +0 -44
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/q/index.html +0 -144
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/q/q.js +0 -139
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/r/index.html +0 -88
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/r/r.js +0 -190
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rpm/changes/index.html +0 -66
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rpm/index.html +0 -149
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rpm/rpm.js +0 -109
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rst/index.html +0 -535
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rst/rst.js +0 -557
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ruby/index.html +0 -183
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ruby/ruby.js +0 -298
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ruby/test.js +0 -23
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rust/index.html +0 -64
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rust/rust.js +0 -72
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/rust/test.js +0 -39
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sas/index.html +0 -81
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sas/sas.js +0 -303
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sass/index.html +0 -68
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sass/sass.js +0 -454
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sass/test.js +0 -122
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/scheme/index.html +0 -77
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/scheme/scheme.js +0 -265
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/shell/index.html +0 -66
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/shell/shell.js +0 -152
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/shell/test.js +0 -73
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sieve/index.html +0 -93
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sieve/sieve.js +0 -193
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/slim/index.html +0 -96
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/slim/slim.js +0 -575
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/slim/test.js +0 -96
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/smalltalk/index.html +0 -68
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/smalltalk/smalltalk.js +0 -168
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/smarty/index.html +0 -138
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/smarty/smarty.js +0 -225
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/solr/index.html +0 -57
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/solr/solr.js +0 -104
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/soy/index.html +0 -68
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/soy/soy.js +0 -437
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/soy/test.js +0 -204
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sparql/index.html +0 -61
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sparql/sparql.js +0 -180
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/spreadsheet/index.html +0 -42
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/spreadsheet/spreadsheet.js +0 -112
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sql/index.html +0 -89
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/sql/sql.js +0 -494
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/stex/index.html +0 -116
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/stex/stex.js +0 -264
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/stex/test.js +0 -132
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/stylus/index.html +0 -106
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/stylus/stylus.js +0 -771
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/swift/index.html +0 -70
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/swift/swift.js +0 -223
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/swift/test.js +0 -162
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tcl/index.html +0 -142
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tcl/tcl.js +0 -139
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/textile/index.html +0 -191
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/textile/test.js +0 -417
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/textile/textile.js +0 -469
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tiddlywiki/index.html +0 -154
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tiddlywiki/tiddlywiki.css +0 -14
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tiddlywiki/tiddlywiki.js +0 -308
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tiki/index.html +0 -95
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tiki/tiki.css +0 -26
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tiki/tiki.js +0 -312
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/toml/index.html +0 -73
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/toml/toml.js +0 -88
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tornado/index.html +0 -63
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/tornado/tornado.js +0 -68
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/troff/index.html +0 -146
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/troff/troff.js +0 -84
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ttcn/index.html +0 -119
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ttcn/ttcn.js +0 -283
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ttcn-cfg/index.html +0 -116
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/ttcn-cfg/ttcn-cfg.js +0 -214
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/turtle/index.html +0 -51
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/turtle/turtle.js +0 -162
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/twig/index.html +0 -45
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/twig/twig.js +0 -141
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vb/index.html +0 -49
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vb/vb.js +0 -275
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vbscript/index.html +0 -55
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vbscript/vbscript.js +0 -350
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/velocity/index.html +0 -120
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/velocity/velocity.js +0 -201
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/verilog/index.html +0 -120
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/verilog/test.js +0 -273
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/verilog/verilog.js +0 -675
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vhdl/index.html +0 -95
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vhdl/vhdl.js +0 -189
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vue/index.html +0 -69
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/vue/vue.js +0 -77
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/webidl/index.html +0 -71
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/webidl/webidl.js +0 -195
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/xml/index.html +0 -61
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/xml/test.js +0 -51
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/xml/xml.js +0 -413
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/xquery/index.html +0 -211
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/xquery/test.js +0 -67
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/xquery/xquery.js +0 -448
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/yacas/index.html +0 -87
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/yacas/yacas.js +0 -204
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/yaml/index.html +0 -80
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/yaml/yaml.js +0 -120
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/yaml-frontmatter/index.html +0 -121
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/yaml-frontmatter/yaml-frontmatter.js +0 -68
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/z80/index.html +0 -53
- data/vendor/assets/javascripts/codemirror/5.49.2/mode/z80/z80.js +0 -116
- data/vendor/assets/stylesheets/codemirror/5.49.2/lib/codemirror.css +0 -349
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/3024-day.css +0 -41
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/3024-night.css +0 -39
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/abcdef.css +0 -32
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/ambiance-mobile.css +0 -5
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/ambiance.css +0 -74
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/base16-dark.css +0 -38
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/base16-light.css +0 -38
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/bespin.css +0 -34
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/blackboard.css +0 -32
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/cobalt.css +0 -25
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/colorforth.css +0 -33
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/darcula.css +0 -53
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/dracula.css +0 -40
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/duotone-dark.css +0 -35
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/duotone-light.css +0 -36
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/eclipse.css +0 -23
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/elegant.css +0 -13
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/erlang-dark.css +0 -34
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/gruvbox-dark.css +0 -37
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/hopscotch.css +0 -34
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/icecoder.css +0 -43
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/idea.css +0 -42
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/isotope.css +0 -34
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/lesser-dark.css +0 -47
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/liquibyte.css +0 -95
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/lucario.css +0 -37
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/material-darker.css +0 -135
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/material-ocean.css +0 -135
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/material-palenight.css +0 -135
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/material.css +0 -135
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/mbo.css +0 -37
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/mdn-like.css +0 -46
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/midnight.css +0 -39
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/monokai.css +0 -41
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/moxer.css +0 -143
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/neat.css +0 -12
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/neo.css +0 -43
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/night.css +0 -27
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/nord.css +0 -42
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/oceanic-next.css +0 -44
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/panda-syntax.css +0 -85
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/paraiso-dark.css +0 -38
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/paraiso-light.css +0 -38
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/pastel-on-dark.css +0 -52
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/railscasts.css +0 -34
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/rubyblue.css +0 -25
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/seti.css +0 -44
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/shadowfox.css +0 -52
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/solarized.css +0 -168
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/ssms.css +0 -16
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/the-matrix.css +0 -30
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/tomorrow-night-bright.css +0 -35
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/tomorrow-night-eighties.css +0 -38
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/ttcn.css +0 -64
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/twilight.css +0 -32
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/vibrant-ink.css +0 -34
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/xq-dark.css +0 -53
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/xq-light.css +0 -43
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/yeti.css +0 -44
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/yonce.css +0 -59
- data/vendor/assets/stylesheets/codemirror/5.49.2/theme/zenburn.css +0 -37
@@ -1,1002 +0,0 @@
|
|
1
|
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3
|
-
|
4
|
-
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL
|
5
|
-
|
6
|
-
(function(mod) {
|
7
|
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8
|
-
mod(require("../../lib/codemirror")); // Note non-packaged dependency diff_match_patch
|
9
|
-
else if (typeof define == "function" && define.amd) // AMD
|
10
|
-
define(["../../lib/codemirror", "diff_match_patch"], mod);
|
11
|
-
else // Plain browser env
|
12
|
-
mod(CodeMirror);
|
13
|
-
})(function(CodeMirror) {
|
14
|
-
"use strict";
|
15
|
-
var Pos = CodeMirror.Pos;
|
16
|
-
var svgNS = "http://www.w3.org/2000/svg";
|
17
|
-
|
18
|
-
function DiffView(mv, type) {
|
19
|
-
this.mv = mv;
|
20
|
-
this.type = type;
|
21
|
-
this.classes = type == "left"
|
22
|
-
? {chunk: "CodeMirror-merge-l-chunk",
|
23
|
-
start: "CodeMirror-merge-l-chunk-start",
|
24
|
-
end: "CodeMirror-merge-l-chunk-end",
|
25
|
-
insert: "CodeMirror-merge-l-inserted",
|
26
|
-
del: "CodeMirror-merge-l-deleted",
|
27
|
-
connect: "CodeMirror-merge-l-connect"}
|
28
|
-
: {chunk: "CodeMirror-merge-r-chunk",
|
29
|
-
start: "CodeMirror-merge-r-chunk-start",
|
30
|
-
end: "CodeMirror-merge-r-chunk-end",
|
31
|
-
insert: "CodeMirror-merge-r-inserted",
|
32
|
-
del: "CodeMirror-merge-r-deleted",
|
33
|
-
connect: "CodeMirror-merge-r-connect"};
|
34
|
-
}
|
35
|
-
|
36
|
-
DiffView.prototype = {
|
37
|
-
constructor: DiffView,
|
38
|
-
init: function(pane, orig, options) {
|
39
|
-
this.edit = this.mv.edit;
|
40
|
-
;(this.edit.state.diffViews || (this.edit.state.diffViews = [])).push(this);
|
41
|
-
this.orig = CodeMirror(pane, copyObj({value: orig, readOnly: !this.mv.options.allowEditingOriginals}, copyObj(options)));
|
42
|
-
if (this.mv.options.connect == "align") {
|
43
|
-
if (!this.edit.state.trackAlignable) this.edit.state.trackAlignable = new TrackAlignable(this.edit)
|
44
|
-
this.orig.state.trackAlignable = new TrackAlignable(this.orig)
|
45
|
-
}
|
46
|
-
this.lockButton.title = this.edit.phrase("Toggle locked scrolling");
|
47
|
-
|
48
|
-
this.orig.state.diffViews = [this];
|
49
|
-
var classLocation = options.chunkClassLocation || "background";
|
50
|
-
if (Object.prototype.toString.call(classLocation) != "[object Array]") classLocation = [classLocation]
|
51
|
-
this.classes.classLocation = classLocation
|
52
|
-
|
53
|
-
this.diff = getDiff(asString(orig), asString(options.value), this.mv.options.ignoreWhitespace);
|
54
|
-
this.chunks = getChunks(this.diff);
|
55
|
-
this.diffOutOfDate = this.dealigned = false;
|
56
|
-
this.needsScrollSync = null
|
57
|
-
|
58
|
-
this.showDifferences = options.showDifferences !== false;
|
59
|
-
},
|
60
|
-
registerEvents: function(otherDv) {
|
61
|
-
this.forceUpdate = registerUpdate(this);
|
62
|
-
setScrollLock(this, true, false);
|
63
|
-
registerScroll(this, otherDv);
|
64
|
-
},
|
65
|
-
setShowDifferences: function(val) {
|
66
|
-
val = val !== false;
|
67
|
-
if (val != this.showDifferences) {
|
68
|
-
this.showDifferences = val;
|
69
|
-
this.forceUpdate("full");
|
70
|
-
}
|
71
|
-
}
|
72
|
-
};
|
73
|
-
|
74
|
-
function ensureDiff(dv) {
|
75
|
-
if (dv.diffOutOfDate) {
|
76
|
-
dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue(), dv.mv.options.ignoreWhitespace);
|
77
|
-
dv.chunks = getChunks(dv.diff);
|
78
|
-
dv.diffOutOfDate = false;
|
79
|
-
CodeMirror.signal(dv.edit, "updateDiff", dv.diff);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
var updating = false;
|
84
|
-
function registerUpdate(dv) {
|
85
|
-
var edit = {from: 0, to: 0, marked: []};
|
86
|
-
var orig = {from: 0, to: 0, marked: []};
|
87
|
-
var debounceChange, updatingFast = false;
|
88
|
-
function update(mode) {
|
89
|
-
updating = true;
|
90
|
-
updatingFast = false;
|
91
|
-
if (mode == "full") {
|
92
|
-
if (dv.svg) clear(dv.svg);
|
93
|
-
if (dv.copyButtons) clear(dv.copyButtons);
|
94
|
-
clearMarks(dv.edit, edit.marked, dv.classes);
|
95
|
-
clearMarks(dv.orig, orig.marked, dv.classes);
|
96
|
-
edit.from = edit.to = orig.from = orig.to = 0;
|
97
|
-
}
|
98
|
-
ensureDiff(dv);
|
99
|
-
if (dv.showDifferences) {
|
100
|
-
updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes);
|
101
|
-
updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes);
|
102
|
-
}
|
103
|
-
|
104
|
-
if (dv.mv.options.connect == "align")
|
105
|
-
alignChunks(dv);
|
106
|
-
makeConnections(dv);
|
107
|
-
if (dv.needsScrollSync != null) syncScroll(dv, dv.needsScrollSync)
|
108
|
-
|
109
|
-
updating = false;
|
110
|
-
}
|
111
|
-
function setDealign(fast) {
|
112
|
-
if (updating) return;
|
113
|
-
dv.dealigned = true;
|
114
|
-
set(fast);
|
115
|
-
}
|
116
|
-
function set(fast) {
|
117
|
-
if (updating || updatingFast) return;
|
118
|
-
clearTimeout(debounceChange);
|
119
|
-
if (fast === true) updatingFast = true;
|
120
|
-
debounceChange = setTimeout(update, fast === true ? 20 : 250);
|
121
|
-
}
|
122
|
-
function change(_cm, change) {
|
123
|
-
if (!dv.diffOutOfDate) {
|
124
|
-
dv.diffOutOfDate = true;
|
125
|
-
edit.from = edit.to = orig.from = orig.to = 0;
|
126
|
-
}
|
127
|
-
// Update faster when a line was added/removed
|
128
|
-
setDealign(change.text.length - 1 != change.to.line - change.from.line);
|
129
|
-
}
|
130
|
-
function swapDoc() {
|
131
|
-
dv.diffOutOfDate = true;
|
132
|
-
dv.dealigned = true;
|
133
|
-
update("full");
|
134
|
-
}
|
135
|
-
dv.edit.on("change", change);
|
136
|
-
dv.orig.on("change", change);
|
137
|
-
dv.edit.on("swapDoc", swapDoc);
|
138
|
-
dv.orig.on("swapDoc", swapDoc);
|
139
|
-
if (dv.mv.options.connect == "align") {
|
140
|
-
CodeMirror.on(dv.edit.state.trackAlignable, "realign", setDealign)
|
141
|
-
CodeMirror.on(dv.orig.state.trackAlignable, "realign", setDealign)
|
142
|
-
}
|
143
|
-
dv.edit.on("viewportChange", function() { set(false); });
|
144
|
-
dv.orig.on("viewportChange", function() { set(false); });
|
145
|
-
update();
|
146
|
-
return update;
|
147
|
-
}
|
148
|
-
|
149
|
-
function registerScroll(dv, otherDv) {
|
150
|
-
dv.edit.on("scroll", function() {
|
151
|
-
syncScroll(dv, true) && makeConnections(dv);
|
152
|
-
});
|
153
|
-
dv.orig.on("scroll", function() {
|
154
|
-
syncScroll(dv, false) && makeConnections(dv);
|
155
|
-
if (otherDv) syncScroll(otherDv, true) && makeConnections(otherDv);
|
156
|
-
});
|
157
|
-
}
|
158
|
-
|
159
|
-
function syncScroll(dv, toOrig) {
|
160
|
-
// Change handler will do a refresh after a timeout when diff is out of date
|
161
|
-
if (dv.diffOutOfDate) {
|
162
|
-
if (dv.lockScroll && dv.needsScrollSync == null) dv.needsScrollSync = toOrig
|
163
|
-
return false
|
164
|
-
}
|
165
|
-
dv.needsScrollSync = null
|
166
|
-
if (!dv.lockScroll) return true;
|
167
|
-
var editor, other, now = +new Date;
|
168
|
-
if (toOrig) { editor = dv.edit; other = dv.orig; }
|
169
|
-
else { editor = dv.orig; other = dv.edit; }
|
170
|
-
// Don't take action if the position of this editor was recently set
|
171
|
-
// (to prevent feedback loops)
|
172
|
-
if (editor.state.scrollSetBy == dv && (editor.state.scrollSetAt || 0) + 250 > now) return false;
|
173
|
-
|
174
|
-
var sInfo = editor.getScrollInfo();
|
175
|
-
if (dv.mv.options.connect == "align") {
|
176
|
-
targetPos = sInfo.top;
|
177
|
-
} else {
|
178
|
-
var halfScreen = .5 * sInfo.clientHeight, midY = sInfo.top + halfScreen;
|
179
|
-
var mid = editor.lineAtHeight(midY, "local");
|
180
|
-
var around = chunkBoundariesAround(dv.chunks, mid, toOrig);
|
181
|
-
var off = getOffsets(editor, toOrig ? around.edit : around.orig);
|
182
|
-
var offOther = getOffsets(other, toOrig ? around.orig : around.edit);
|
183
|
-
var ratio = (midY - off.top) / (off.bot - off.top);
|
184
|
-
var targetPos = (offOther.top - halfScreen) + ratio * (offOther.bot - offOther.top);
|
185
|
-
|
186
|
-
var botDist, mix;
|
187
|
-
// Some careful tweaking to make sure no space is left out of view
|
188
|
-
// when scrolling to top or bottom.
|
189
|
-
if (targetPos > sInfo.top && (mix = sInfo.top / halfScreen) < 1) {
|
190
|
-
targetPos = targetPos * mix + sInfo.top * (1 - mix);
|
191
|
-
} else if ((botDist = sInfo.height - sInfo.clientHeight - sInfo.top) < halfScreen) {
|
192
|
-
var otherInfo = other.getScrollInfo();
|
193
|
-
var botDistOther = otherInfo.height - otherInfo.clientHeight - targetPos;
|
194
|
-
if (botDistOther > botDist && (mix = botDist / halfScreen) < 1)
|
195
|
-
targetPos = targetPos * mix + (otherInfo.height - otherInfo.clientHeight - botDist) * (1 - mix);
|
196
|
-
}
|
197
|
-
}
|
198
|
-
|
199
|
-
other.scrollTo(sInfo.left, targetPos);
|
200
|
-
other.state.scrollSetAt = now;
|
201
|
-
other.state.scrollSetBy = dv;
|
202
|
-
return true;
|
203
|
-
}
|
204
|
-
|
205
|
-
function getOffsets(editor, around) {
|
206
|
-
var bot = around.after;
|
207
|
-
if (bot == null) bot = editor.lastLine() + 1;
|
208
|
-
return {top: editor.heightAtLine(around.before || 0, "local"),
|
209
|
-
bot: editor.heightAtLine(bot, "local")};
|
210
|
-
}
|
211
|
-
|
212
|
-
function setScrollLock(dv, val, action) {
|
213
|
-
dv.lockScroll = val;
|
214
|
-
if (val && action != false) syncScroll(dv, DIFF_INSERT) && makeConnections(dv);
|
215
|
-
(val ? CodeMirror.addClass : CodeMirror.rmClass)(dv.lockButton, "CodeMirror-merge-scrolllock-enabled");
|
216
|
-
}
|
217
|
-
|
218
|
-
// Updating the marks for editor content
|
219
|
-
|
220
|
-
function removeClass(editor, line, classes) {
|
221
|
-
var locs = classes.classLocation
|
222
|
-
for (var i = 0; i < locs.length; i++) {
|
223
|
-
editor.removeLineClass(line, locs[i], classes.chunk);
|
224
|
-
editor.removeLineClass(line, locs[i], classes.start);
|
225
|
-
editor.removeLineClass(line, locs[i], classes.end);
|
226
|
-
}
|
227
|
-
}
|
228
|
-
|
229
|
-
function clearMarks(editor, arr, classes) {
|
230
|
-
for (var i = 0; i < arr.length; ++i) {
|
231
|
-
var mark = arr[i];
|
232
|
-
if (mark instanceof CodeMirror.TextMarker)
|
233
|
-
mark.clear();
|
234
|
-
else if (mark.parent)
|
235
|
-
removeClass(editor, mark, classes);
|
236
|
-
}
|
237
|
-
arr.length = 0;
|
238
|
-
}
|
239
|
-
|
240
|
-
// FIXME maybe add a margin around viewport to prevent too many updates
|
241
|
-
function updateMarks(editor, diff, state, type, classes) {
|
242
|
-
var vp = editor.getViewport();
|
243
|
-
editor.operation(function() {
|
244
|
-
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
|
245
|
-
clearMarks(editor, state.marked, classes);
|
246
|
-
markChanges(editor, diff, type, state.marked, vp.from, vp.to, classes);
|
247
|
-
state.from = vp.from; state.to = vp.to;
|
248
|
-
} else {
|
249
|
-
if (vp.from < state.from) {
|
250
|
-
markChanges(editor, diff, type, state.marked, vp.from, state.from, classes);
|
251
|
-
state.from = vp.from;
|
252
|
-
}
|
253
|
-
if (vp.to > state.to) {
|
254
|
-
markChanges(editor, diff, type, state.marked, state.to, vp.to, classes);
|
255
|
-
state.to = vp.to;
|
256
|
-
}
|
257
|
-
}
|
258
|
-
});
|
259
|
-
}
|
260
|
-
|
261
|
-
function addClass(editor, lineNr, classes, main, start, end) {
|
262
|
-
var locs = classes.classLocation, line = editor.getLineHandle(lineNr);
|
263
|
-
for (var i = 0; i < locs.length; i++) {
|
264
|
-
if (main) editor.addLineClass(line, locs[i], classes.chunk);
|
265
|
-
if (start) editor.addLineClass(line, locs[i], classes.start);
|
266
|
-
if (end) editor.addLineClass(line, locs[i], classes.end);
|
267
|
-
}
|
268
|
-
return line;
|
269
|
-
}
|
270
|
-
|
271
|
-
function markChanges(editor, diff, type, marks, from, to, classes) {
|
272
|
-
var pos = Pos(0, 0);
|
273
|
-
var top = Pos(from, 0), bot = editor.clipPos(Pos(to - 1));
|
274
|
-
var cls = type == DIFF_DELETE ? classes.del : classes.insert;
|
275
|
-
function markChunk(start, end) {
|
276
|
-
var bfrom = Math.max(from, start), bto = Math.min(to, end);
|
277
|
-
for (var i = bfrom; i < bto; ++i)
|
278
|
-
marks.push(addClass(editor, i, classes, true, i == start, i == end - 1));
|
279
|
-
// When the chunk is empty, make sure a horizontal line shows up
|
280
|
-
if (start == end && bfrom == end && bto == end) {
|
281
|
-
if (bfrom)
|
282
|
-
marks.push(addClass(editor, bfrom - 1, classes, false, false, true));
|
283
|
-
else
|
284
|
-
marks.push(addClass(editor, bfrom, classes, false, true, false));
|
285
|
-
}
|
286
|
-
}
|
287
|
-
|
288
|
-
var chunkStart = 0, pending = false;
|
289
|
-
for (var i = 0; i < diff.length; ++i) {
|
290
|
-
var part = diff[i], tp = part[0], str = part[1];
|
291
|
-
if (tp == DIFF_EQUAL) {
|
292
|
-
var cleanFrom = pos.line + (startOfLineClean(diff, i) ? 0 : 1);
|
293
|
-
moveOver(pos, str);
|
294
|
-
var cleanTo = pos.line + (endOfLineClean(diff, i) ? 1 : 0);
|
295
|
-
if (cleanTo > cleanFrom) {
|
296
|
-
if (pending) { markChunk(chunkStart, cleanFrom); pending = false }
|
297
|
-
chunkStart = cleanTo;
|
298
|
-
}
|
299
|
-
} else {
|
300
|
-
pending = true
|
301
|
-
if (tp == type) {
|
302
|
-
var end = moveOver(pos, str, true);
|
303
|
-
var a = posMax(top, pos), b = posMin(bot, end);
|
304
|
-
if (!posEq(a, b))
|
305
|
-
marks.push(editor.markText(a, b, {className: cls}));
|
306
|
-
pos = end;
|
307
|
-
}
|
308
|
-
}
|
309
|
-
}
|
310
|
-
if (pending) markChunk(chunkStart, pos.line + 1);
|
311
|
-
}
|
312
|
-
|
313
|
-
// Updating the gap between editor and original
|
314
|
-
|
315
|
-
function makeConnections(dv) {
|
316
|
-
if (!dv.showDifferences) return;
|
317
|
-
|
318
|
-
if (dv.svg) {
|
319
|
-
clear(dv.svg);
|
320
|
-
var w = dv.gap.offsetWidth;
|
321
|
-
attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight);
|
322
|
-
}
|
323
|
-
if (dv.copyButtons) clear(dv.copyButtons);
|
324
|
-
|
325
|
-
var vpEdit = dv.edit.getViewport(), vpOrig = dv.orig.getViewport();
|
326
|
-
var outerTop = dv.mv.wrap.getBoundingClientRect().top
|
327
|
-
var sTopEdit = outerTop - dv.edit.getScrollerElement().getBoundingClientRect().top + dv.edit.getScrollInfo().top
|
328
|
-
var sTopOrig = outerTop - dv.orig.getScrollerElement().getBoundingClientRect().top + dv.orig.getScrollInfo().top;
|
329
|
-
for (var i = 0; i < dv.chunks.length; i++) {
|
330
|
-
var ch = dv.chunks[i];
|
331
|
-
if (ch.editFrom <= vpEdit.to && ch.editTo >= vpEdit.from &&
|
332
|
-
ch.origFrom <= vpOrig.to && ch.origTo >= vpOrig.from)
|
333
|
-
drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w);
|
334
|
-
}
|
335
|
-
}
|
336
|
-
|
337
|
-
function getMatchingOrigLine(editLine, chunks) {
|
338
|
-
var editStart = 0, origStart = 0;
|
339
|
-
for (var i = 0; i < chunks.length; i++) {
|
340
|
-
var chunk = chunks[i];
|
341
|
-
if (chunk.editTo > editLine && chunk.editFrom <= editLine) return null;
|
342
|
-
if (chunk.editFrom > editLine) break;
|
343
|
-
editStart = chunk.editTo;
|
344
|
-
origStart = chunk.origTo;
|
345
|
-
}
|
346
|
-
return origStart + (editLine - editStart);
|
347
|
-
}
|
348
|
-
|
349
|
-
// Combines information about chunks and widgets/markers to return
|
350
|
-
// an array of lines, in a single editor, that probably need to be
|
351
|
-
// aligned with their counterparts in the editor next to it.
|
352
|
-
function alignableFor(cm, chunks, isOrig) {
|
353
|
-
var tracker = cm.state.trackAlignable
|
354
|
-
var start = cm.firstLine(), trackI = 0
|
355
|
-
var result = []
|
356
|
-
for (var i = 0;; i++) {
|
357
|
-
var chunk = chunks[i]
|
358
|
-
var chunkStart = !chunk ? 1e9 : isOrig ? chunk.origFrom : chunk.editFrom
|
359
|
-
for (; trackI < tracker.alignable.length; trackI += 2) {
|
360
|
-
var n = tracker.alignable[trackI] + 1
|
361
|
-
if (n <= start) continue
|
362
|
-
if (n <= chunkStart) result.push(n)
|
363
|
-
else break
|
364
|
-
}
|
365
|
-
if (!chunk) break
|
366
|
-
result.push(start = isOrig ? chunk.origTo : chunk.editTo)
|
367
|
-
}
|
368
|
-
return result
|
369
|
-
}
|
370
|
-
|
371
|
-
// Given information about alignable lines in two editors, fill in
|
372
|
-
// the result (an array of three-element arrays) to reflect the
|
373
|
-
// lines that need to be aligned with each other.
|
374
|
-
function mergeAlignable(result, origAlignable, chunks, setIndex) {
|
375
|
-
var rI = 0, origI = 0, chunkI = 0, diff = 0
|
376
|
-
outer: for (;; rI++) {
|
377
|
-
var nextR = result[rI], nextO = origAlignable[origI]
|
378
|
-
if (!nextR && nextO == null) break
|
379
|
-
|
380
|
-
var rLine = nextR ? nextR[0] : 1e9, oLine = nextO == null ? 1e9 : nextO
|
381
|
-
while (chunkI < chunks.length) {
|
382
|
-
var chunk = chunks[chunkI]
|
383
|
-
if (chunk.origFrom <= oLine && chunk.origTo > oLine) {
|
384
|
-
origI++
|
385
|
-
rI--
|
386
|
-
continue outer;
|
387
|
-
}
|
388
|
-
if (chunk.editTo > rLine) {
|
389
|
-
if (chunk.editFrom <= rLine) continue outer;
|
390
|
-
break
|
391
|
-
}
|
392
|
-
diff += (chunk.origTo - chunk.origFrom) - (chunk.editTo - chunk.editFrom)
|
393
|
-
chunkI++
|
394
|
-
}
|
395
|
-
if (rLine == oLine - diff) {
|
396
|
-
nextR[setIndex] = oLine
|
397
|
-
origI++
|
398
|
-
} else if (rLine < oLine - diff) {
|
399
|
-
nextR[setIndex] = rLine + diff
|
400
|
-
} else {
|
401
|
-
var record = [oLine - diff, null, null]
|
402
|
-
record[setIndex] = oLine
|
403
|
-
result.splice(rI, 0, record)
|
404
|
-
origI++
|
405
|
-
}
|
406
|
-
}
|
407
|
-
}
|
408
|
-
|
409
|
-
function findAlignedLines(dv, other) {
|
410
|
-
var alignable = alignableFor(dv.edit, dv.chunks, false), result = []
|
411
|
-
if (other) for (var i = 0, j = 0; i < other.chunks.length; i++) {
|
412
|
-
var n = other.chunks[i].editTo
|
413
|
-
while (j < alignable.length && alignable[j] < n) j++
|
414
|
-
if (j == alignable.length || alignable[j] != n) alignable.splice(j++, 0, n)
|
415
|
-
}
|
416
|
-
for (var i = 0; i < alignable.length; i++)
|
417
|
-
result.push([alignable[i], null, null])
|
418
|
-
|
419
|
-
mergeAlignable(result, alignableFor(dv.orig, dv.chunks, true), dv.chunks, 1)
|
420
|
-
if (other)
|
421
|
-
mergeAlignable(result, alignableFor(other.orig, other.chunks, true), other.chunks, 2)
|
422
|
-
|
423
|
-
return result
|
424
|
-
}
|
425
|
-
|
426
|
-
function alignChunks(dv, force) {
|
427
|
-
if (!dv.dealigned && !force) return;
|
428
|
-
if (!dv.orig.curOp) return dv.orig.operation(function() {
|
429
|
-
alignChunks(dv, force);
|
430
|
-
});
|
431
|
-
|
432
|
-
dv.dealigned = false;
|
433
|
-
var other = dv.mv.left == dv ? dv.mv.right : dv.mv.left;
|
434
|
-
if (other) {
|
435
|
-
ensureDiff(other);
|
436
|
-
other.dealigned = false;
|
437
|
-
}
|
438
|
-
var linesToAlign = findAlignedLines(dv, other);
|
439
|
-
|
440
|
-
// Clear old aligners
|
441
|
-
var aligners = dv.mv.aligners;
|
442
|
-
for (var i = 0; i < aligners.length; i++)
|
443
|
-
aligners[i].clear();
|
444
|
-
aligners.length = 0;
|
445
|
-
|
446
|
-
var cm = [dv.edit, dv.orig], scroll = [];
|
447
|
-
if (other) cm.push(other.orig);
|
448
|
-
for (var i = 0; i < cm.length; i++)
|
449
|
-
scroll.push(cm[i].getScrollInfo().top);
|
450
|
-
|
451
|
-
for (var ln = 0; ln < linesToAlign.length; ln++)
|
452
|
-
alignLines(cm, linesToAlign[ln], aligners);
|
453
|
-
|
454
|
-
for (var i = 0; i < cm.length; i++)
|
455
|
-
cm[i].scrollTo(null, scroll[i]);
|
456
|
-
}
|
457
|
-
|
458
|
-
function alignLines(cm, lines, aligners) {
|
459
|
-
var maxOffset = 0, offset = [];
|
460
|
-
for (var i = 0; i < cm.length; i++) if (lines[i] != null) {
|
461
|
-
var off = cm[i].heightAtLine(lines[i], "local");
|
462
|
-
offset[i] = off;
|
463
|
-
maxOffset = Math.max(maxOffset, off);
|
464
|
-
}
|
465
|
-
for (var i = 0; i < cm.length; i++) if (lines[i] != null) {
|
466
|
-
var diff = maxOffset - offset[i];
|
467
|
-
if (diff > 1)
|
468
|
-
aligners.push(padAbove(cm[i], lines[i], diff));
|
469
|
-
}
|
470
|
-
}
|
471
|
-
|
472
|
-
function padAbove(cm, line, size) {
|
473
|
-
var above = true;
|
474
|
-
if (line > cm.lastLine()) {
|
475
|
-
line--;
|
476
|
-
above = false;
|
477
|
-
}
|
478
|
-
var elt = document.createElement("div");
|
479
|
-
elt.className = "CodeMirror-merge-spacer";
|
480
|
-
elt.style.height = size + "px"; elt.style.minWidth = "1px";
|
481
|
-
return cm.addLineWidget(line, elt, {height: size, above: above, mergeSpacer: true, handleMouseEvents: true});
|
482
|
-
}
|
483
|
-
|
484
|
-
function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w) {
|
485
|
-
var flip = dv.type == "left";
|
486
|
-
var top = dv.orig.heightAtLine(chunk.origFrom, "local", true) - sTopOrig;
|
487
|
-
if (dv.svg) {
|
488
|
-
var topLpx = top;
|
489
|
-
var topRpx = dv.edit.heightAtLine(chunk.editFrom, "local", true) - sTopEdit;
|
490
|
-
if (flip) { var tmp = topLpx; topLpx = topRpx; topRpx = tmp; }
|
491
|
-
var botLpx = dv.orig.heightAtLine(chunk.origTo, "local", true) - sTopOrig;
|
492
|
-
var botRpx = dv.edit.heightAtLine(chunk.editTo, "local", true) - sTopEdit;
|
493
|
-
if (flip) { var tmp = botLpx; botLpx = botRpx; botRpx = tmp; }
|
494
|
-
var curveTop = " C " + w/2 + " " + topRpx + " " + w/2 + " " + topLpx + " " + (w + 2) + " " + topLpx;
|
495
|
-
var curveBot = " C " + w/2 + " " + botLpx + " " + w/2 + " " + botRpx + " -1 " + botRpx;
|
496
|
-
attrs(dv.svg.appendChild(document.createElementNS(svgNS, "path")),
|
497
|
-
"d", "M -1 " + topRpx + curveTop + " L " + (w + 2) + " " + botLpx + curveBot + " z",
|
498
|
-
"class", dv.classes.connect);
|
499
|
-
}
|
500
|
-
if (dv.copyButtons) {
|
501
|
-
var copy = dv.copyButtons.appendChild(elt("div", dv.type == "left" ? "\u21dd" : "\u21dc",
|
502
|
-
"CodeMirror-merge-copy"));
|
503
|
-
var editOriginals = dv.mv.options.allowEditingOriginals;
|
504
|
-
copy.title = dv.edit.phrase(editOriginals ? "Push to left" : "Revert chunk");
|
505
|
-
copy.chunk = chunk;
|
506
|
-
copy.style.top = (chunk.origTo > chunk.origFrom ? top : dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit) + "px";
|
507
|
-
|
508
|
-
if (editOriginals) {
|
509
|
-
var topReverse = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit;
|
510
|
-
var copyReverse = dv.copyButtons.appendChild(elt("div", dv.type == "right" ? "\u21dd" : "\u21dc",
|
511
|
-
"CodeMirror-merge-copy-reverse"));
|
512
|
-
copyReverse.title = "Push to right";
|
513
|
-
copyReverse.chunk = {editFrom: chunk.origFrom, editTo: chunk.origTo,
|
514
|
-
origFrom: chunk.editFrom, origTo: chunk.editTo};
|
515
|
-
copyReverse.style.top = topReverse + "px";
|
516
|
-
dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px";
|
517
|
-
}
|
518
|
-
}
|
519
|
-
}
|
520
|
-
|
521
|
-
function copyChunk(dv, to, from, chunk) {
|
522
|
-
if (dv.diffOutOfDate) return;
|
523
|
-
var origStart = chunk.origTo > from.lastLine() ? Pos(chunk.origFrom - 1) : Pos(chunk.origFrom, 0)
|
524
|
-
var origEnd = Pos(chunk.origTo, 0)
|
525
|
-
var editStart = chunk.editTo > to.lastLine() ? Pos(chunk.editFrom - 1) : Pos(chunk.editFrom, 0)
|
526
|
-
var editEnd = Pos(chunk.editTo, 0)
|
527
|
-
var handler = dv.mv.options.revertChunk
|
528
|
-
if (handler)
|
529
|
-
handler(dv.mv, from, origStart, origEnd, to, editStart, editEnd)
|
530
|
-
else
|
531
|
-
to.replaceRange(from.getRange(origStart, origEnd), editStart, editEnd)
|
532
|
-
}
|
533
|
-
|
534
|
-
// Merge view, containing 0, 1, or 2 diff views.
|
535
|
-
|
536
|
-
var MergeView = CodeMirror.MergeView = function(node, options) {
|
537
|
-
if (!(this instanceof MergeView)) return new MergeView(node, options);
|
538
|
-
|
539
|
-
this.options = options;
|
540
|
-
var origLeft = options.origLeft, origRight = options.origRight == null ? options.orig : options.origRight;
|
541
|
-
|
542
|
-
var hasLeft = origLeft != null, hasRight = origRight != null;
|
543
|
-
var panes = 1 + (hasLeft ? 1 : 0) + (hasRight ? 1 : 0);
|
544
|
-
var wrap = [], left = this.left = null, right = this.right = null;
|
545
|
-
var self = this;
|
546
|
-
|
547
|
-
if (hasLeft) {
|
548
|
-
left = this.left = new DiffView(this, "left");
|
549
|
-
var leftPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-left");
|
550
|
-
wrap.push(leftPane);
|
551
|
-
wrap.push(buildGap(left));
|
552
|
-
}
|
553
|
-
|
554
|
-
var editPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-editor");
|
555
|
-
wrap.push(editPane);
|
556
|
-
|
557
|
-
if (hasRight) {
|
558
|
-
right = this.right = new DiffView(this, "right");
|
559
|
-
wrap.push(buildGap(right));
|
560
|
-
var rightPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-right");
|
561
|
-
wrap.push(rightPane);
|
562
|
-
}
|
563
|
-
|
564
|
-
(hasRight ? rightPane : editPane).className += " CodeMirror-merge-pane-rightmost";
|
565
|
-
|
566
|
-
wrap.push(elt("div", null, null, "height: 0; clear: both;"));
|
567
|
-
|
568
|
-
var wrapElt = this.wrap = node.appendChild(elt("div", wrap, "CodeMirror-merge CodeMirror-merge-" + panes + "pane"));
|
569
|
-
this.edit = CodeMirror(editPane, copyObj(options));
|
570
|
-
|
571
|
-
if (left) left.init(leftPane, origLeft, options);
|
572
|
-
if (right) right.init(rightPane, origRight, options);
|
573
|
-
if (options.collapseIdentical)
|
574
|
-
this.editor().operation(function() {
|
575
|
-
collapseIdenticalStretches(self, options.collapseIdentical);
|
576
|
-
});
|
577
|
-
if (options.connect == "align") {
|
578
|
-
this.aligners = [];
|
579
|
-
alignChunks(this.left || this.right, true);
|
580
|
-
}
|
581
|
-
if (left) left.registerEvents(right)
|
582
|
-
if (right) right.registerEvents(left)
|
583
|
-
|
584
|
-
|
585
|
-
var onResize = function() {
|
586
|
-
if (left) makeConnections(left);
|
587
|
-
if (right) makeConnections(right);
|
588
|
-
};
|
589
|
-
CodeMirror.on(window, "resize", onResize);
|
590
|
-
var resizeInterval = setInterval(function() {
|
591
|
-
for (var p = wrapElt.parentNode; p && p != document.body; p = p.parentNode) {}
|
592
|
-
if (!p) { clearInterval(resizeInterval); CodeMirror.off(window, "resize", onResize); }
|
593
|
-
}, 5000);
|
594
|
-
};
|
595
|
-
|
596
|
-
function buildGap(dv) {
|
597
|
-
var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock");
|
598
|
-
var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap");
|
599
|
-
CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); });
|
600
|
-
var gapElts = [lockWrap];
|
601
|
-
if (dv.mv.options.revertButtons !== false) {
|
602
|
-
dv.copyButtons = elt("div", null, "CodeMirror-merge-copybuttons-" + dv.type);
|
603
|
-
CodeMirror.on(dv.copyButtons, "click", function(e) {
|
604
|
-
var node = e.target || e.srcElement;
|
605
|
-
if (!node.chunk) return;
|
606
|
-
if (node.className == "CodeMirror-merge-copy-reverse") {
|
607
|
-
copyChunk(dv, dv.orig, dv.edit, node.chunk);
|
608
|
-
return;
|
609
|
-
}
|
610
|
-
copyChunk(dv, dv.edit, dv.orig, node.chunk);
|
611
|
-
});
|
612
|
-
gapElts.unshift(dv.copyButtons);
|
613
|
-
}
|
614
|
-
if (dv.mv.options.connect != "align") {
|
615
|
-
var svg = document.createElementNS && document.createElementNS(svgNS, "svg");
|
616
|
-
if (svg && !svg.createSVGRect) svg = null;
|
617
|
-
dv.svg = svg;
|
618
|
-
if (svg) gapElts.push(svg);
|
619
|
-
}
|
620
|
-
|
621
|
-
return dv.gap = elt("div", gapElts, "CodeMirror-merge-gap");
|
622
|
-
}
|
623
|
-
|
624
|
-
MergeView.prototype = {
|
625
|
-
constructor: MergeView,
|
626
|
-
editor: function() { return this.edit; },
|
627
|
-
rightOriginal: function() { return this.right && this.right.orig; },
|
628
|
-
leftOriginal: function() { return this.left && this.left.orig; },
|
629
|
-
setShowDifferences: function(val) {
|
630
|
-
if (this.right) this.right.setShowDifferences(val);
|
631
|
-
if (this.left) this.left.setShowDifferences(val);
|
632
|
-
},
|
633
|
-
rightChunks: function() {
|
634
|
-
if (this.right) { ensureDiff(this.right); return this.right.chunks; }
|
635
|
-
},
|
636
|
-
leftChunks: function() {
|
637
|
-
if (this.left) { ensureDiff(this.left); return this.left.chunks; }
|
638
|
-
}
|
639
|
-
};
|
640
|
-
|
641
|
-
function asString(obj) {
|
642
|
-
if (typeof obj == "string") return obj;
|
643
|
-
else return obj.getValue();
|
644
|
-
}
|
645
|
-
|
646
|
-
// Operations on diffs
|
647
|
-
var dmp;
|
648
|
-
function getDiff(a, b, ignoreWhitespace) {
|
649
|
-
if (!dmp) dmp = new diff_match_patch();
|
650
|
-
|
651
|
-
var diff = dmp.diff_main(a, b);
|
652
|
-
// The library sometimes leaves in empty parts, which confuse the algorithm
|
653
|
-
for (var i = 0; i < diff.length; ++i) {
|
654
|
-
var part = diff[i];
|
655
|
-
if (ignoreWhitespace ? !/[^ \t]/.test(part[1]) : !part[1]) {
|
656
|
-
diff.splice(i--, 1);
|
657
|
-
} else if (i && diff[i - 1][0] == part[0]) {
|
658
|
-
diff.splice(i--, 1);
|
659
|
-
diff[i][1] += part[1];
|
660
|
-
}
|
661
|
-
}
|
662
|
-
return diff;
|
663
|
-
}
|
664
|
-
|
665
|
-
function getChunks(diff) {
|
666
|
-
var chunks = [];
|
667
|
-
if (!diff.length) return chunks;
|
668
|
-
var startEdit = 0, startOrig = 0;
|
669
|
-
var edit = Pos(0, 0), orig = Pos(0, 0);
|
670
|
-
for (var i = 0; i < diff.length; ++i) {
|
671
|
-
var part = diff[i], tp = part[0];
|
672
|
-
if (tp == DIFF_EQUAL) {
|
673
|
-
var startOff = !startOfLineClean(diff, i) || edit.line < startEdit || orig.line < startOrig ? 1 : 0;
|
674
|
-
var cleanFromEdit = edit.line + startOff, cleanFromOrig = orig.line + startOff;
|
675
|
-
moveOver(edit, part[1], null, orig);
|
676
|
-
var endOff = endOfLineClean(diff, i) ? 1 : 0;
|
677
|
-
var cleanToEdit = edit.line + endOff, cleanToOrig = orig.line + endOff;
|
678
|
-
if (cleanToEdit > cleanFromEdit) {
|
679
|
-
if (i) chunks.push({origFrom: startOrig, origTo: cleanFromOrig,
|
680
|
-
editFrom: startEdit, editTo: cleanFromEdit});
|
681
|
-
startEdit = cleanToEdit; startOrig = cleanToOrig;
|
682
|
-
}
|
683
|
-
} else {
|
684
|
-
moveOver(tp == DIFF_INSERT ? edit : orig, part[1]);
|
685
|
-
}
|
686
|
-
}
|
687
|
-
if (startEdit <= edit.line || startOrig <= orig.line)
|
688
|
-
chunks.push({origFrom: startOrig, origTo: orig.line + 1,
|
689
|
-
editFrom: startEdit, editTo: edit.line + 1});
|
690
|
-
return chunks;
|
691
|
-
}
|
692
|
-
|
693
|
-
function endOfLineClean(diff, i) {
|
694
|
-
if (i == diff.length - 1) return true;
|
695
|
-
var next = diff[i + 1][1];
|
696
|
-
if ((next.length == 1 && i < diff.length - 2) || next.charCodeAt(0) != 10) return false;
|
697
|
-
if (i == diff.length - 2) return true;
|
698
|
-
next = diff[i + 2][1];
|
699
|
-
return (next.length > 1 || i == diff.length - 3) && next.charCodeAt(0) == 10;
|
700
|
-
}
|
701
|
-
|
702
|
-
function startOfLineClean(diff, i) {
|
703
|
-
if (i == 0) return true;
|
704
|
-
var last = diff[i - 1][1];
|
705
|
-
if (last.charCodeAt(last.length - 1) != 10) return false;
|
706
|
-
if (i == 1) return true;
|
707
|
-
last = diff[i - 2][1];
|
708
|
-
return last.charCodeAt(last.length - 1) == 10;
|
709
|
-
}
|
710
|
-
|
711
|
-
function chunkBoundariesAround(chunks, n, nInEdit) {
|
712
|
-
var beforeE, afterE, beforeO, afterO;
|
713
|
-
for (var i = 0; i < chunks.length; i++) {
|
714
|
-
var chunk = chunks[i];
|
715
|
-
var fromLocal = nInEdit ? chunk.editFrom : chunk.origFrom;
|
716
|
-
var toLocal = nInEdit ? chunk.editTo : chunk.origTo;
|
717
|
-
if (afterE == null) {
|
718
|
-
if (fromLocal > n) { afterE = chunk.editFrom; afterO = chunk.origFrom; }
|
719
|
-
else if (toLocal > n) { afterE = chunk.editTo; afterO = chunk.origTo; }
|
720
|
-
}
|
721
|
-
if (toLocal <= n) { beforeE = chunk.editTo; beforeO = chunk.origTo; }
|
722
|
-
else if (fromLocal <= n) { beforeE = chunk.editFrom; beforeO = chunk.origFrom; }
|
723
|
-
}
|
724
|
-
return {edit: {before: beforeE, after: afterE}, orig: {before: beforeO, after: afterO}};
|
725
|
-
}
|
726
|
-
|
727
|
-
function collapseSingle(cm, from, to) {
|
728
|
-
cm.addLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
|
729
|
-
var widget = document.createElement("span");
|
730
|
-
widget.className = "CodeMirror-merge-collapsed-widget";
|
731
|
-
widget.title = cm.phrase("Identical text collapsed. Click to expand.");
|
732
|
-
var mark = cm.markText(Pos(from, 0), Pos(to - 1), {
|
733
|
-
inclusiveLeft: true,
|
734
|
-
inclusiveRight: true,
|
735
|
-
replacedWith: widget,
|
736
|
-
clearOnEnter: true
|
737
|
-
});
|
738
|
-
function clear() {
|
739
|
-
mark.clear();
|
740
|
-
cm.removeLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
|
741
|
-
}
|
742
|
-
if (mark.explicitlyCleared) clear();
|
743
|
-
CodeMirror.on(widget, "click", clear);
|
744
|
-
mark.on("clear", clear);
|
745
|
-
CodeMirror.on(widget, "click", clear);
|
746
|
-
return {mark: mark, clear: clear};
|
747
|
-
}
|
748
|
-
|
749
|
-
function collapseStretch(size, editors) {
|
750
|
-
var marks = [];
|
751
|
-
function clear() {
|
752
|
-
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
753
|
-
}
|
754
|
-
for (var i = 0; i < editors.length; i++) {
|
755
|
-
var editor = editors[i];
|
756
|
-
var mark = collapseSingle(editor.cm, editor.line, editor.line + size);
|
757
|
-
marks.push(mark);
|
758
|
-
mark.mark.on("clear", clear);
|
759
|
-
}
|
760
|
-
return marks[0].mark;
|
761
|
-
}
|
762
|
-
|
763
|
-
function unclearNearChunks(dv, margin, off, clear) {
|
764
|
-
for (var i = 0; i < dv.chunks.length; i++) {
|
765
|
-
var chunk = dv.chunks[i];
|
766
|
-
for (var l = chunk.editFrom - margin; l < chunk.editTo + margin; l++) {
|
767
|
-
var pos = l + off;
|
768
|
-
if (pos >= 0 && pos < clear.length) clear[pos] = false;
|
769
|
-
}
|
770
|
-
}
|
771
|
-
}
|
772
|
-
|
773
|
-
function collapseIdenticalStretches(mv, margin) {
|
774
|
-
if (typeof margin != "number") margin = 2;
|
775
|
-
var clear = [], edit = mv.editor(), off = edit.firstLine();
|
776
|
-
for (var l = off, e = edit.lastLine(); l <= e; l++) clear.push(true);
|
777
|
-
if (mv.left) unclearNearChunks(mv.left, margin, off, clear);
|
778
|
-
if (mv.right) unclearNearChunks(mv.right, margin, off, clear);
|
779
|
-
|
780
|
-
for (var i = 0; i < clear.length; i++) {
|
781
|
-
if (clear[i]) {
|
782
|
-
var line = i + off;
|
783
|
-
for (var size = 1; i < clear.length - 1 && clear[i + 1]; i++, size++) {}
|
784
|
-
if (size > margin) {
|
785
|
-
var editors = [{line: line, cm: edit}];
|
786
|
-
if (mv.left) editors.push({line: getMatchingOrigLine(line, mv.left.chunks), cm: mv.left.orig});
|
787
|
-
if (mv.right) editors.push({line: getMatchingOrigLine(line, mv.right.chunks), cm: mv.right.orig});
|
788
|
-
var mark = collapseStretch(size, editors);
|
789
|
-
if (mv.options.onCollapse) mv.options.onCollapse(mv, line, size, mark);
|
790
|
-
}
|
791
|
-
}
|
792
|
-
}
|
793
|
-
}
|
794
|
-
|
795
|
-
// General utilities
|
796
|
-
|
797
|
-
function elt(tag, content, className, style) {
|
798
|
-
var e = document.createElement(tag);
|
799
|
-
if (className) e.className = className;
|
800
|
-
if (style) e.style.cssText = style;
|
801
|
-
if (typeof content == "string") e.appendChild(document.createTextNode(content));
|
802
|
-
else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
|
803
|
-
return e;
|
804
|
-
}
|
805
|
-
|
806
|
-
function clear(node) {
|
807
|
-
for (var count = node.childNodes.length; count > 0; --count)
|
808
|
-
node.removeChild(node.firstChild);
|
809
|
-
}
|
810
|
-
|
811
|
-
function attrs(elt) {
|
812
|
-
for (var i = 1; i < arguments.length; i += 2)
|
813
|
-
elt.setAttribute(arguments[i], arguments[i+1]);
|
814
|
-
}
|
815
|
-
|
816
|
-
function copyObj(obj, target) {
|
817
|
-
if (!target) target = {};
|
818
|
-
for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop];
|
819
|
-
return target;
|
820
|
-
}
|
821
|
-
|
822
|
-
function moveOver(pos, str, copy, other) {
|
823
|
-
var out = copy ? Pos(pos.line, pos.ch) : pos, at = 0;
|
824
|
-
for (;;) {
|
825
|
-
var nl = str.indexOf("\n", at);
|
826
|
-
if (nl == -1) break;
|
827
|
-
++out.line;
|
828
|
-
if (other) ++other.line;
|
829
|
-
at = nl + 1;
|
830
|
-
}
|
831
|
-
out.ch = (at ? 0 : out.ch) + (str.length - at);
|
832
|
-
if (other) other.ch = (at ? 0 : other.ch) + (str.length - at);
|
833
|
-
return out;
|
834
|
-
}
|
835
|
-
|
836
|
-
// Tracks collapsed markers and line widgets, in order to be able to
|
837
|
-
// accurately align the content of two editors.
|
838
|
-
|
839
|
-
var F_WIDGET = 1, F_WIDGET_BELOW = 2, F_MARKER = 4
|
840
|
-
|
841
|
-
function TrackAlignable(cm) {
|
842
|
-
this.cm = cm
|
843
|
-
this.alignable = []
|
844
|
-
this.height = cm.doc.height
|
845
|
-
var self = this
|
846
|
-
cm.on("markerAdded", function(_, marker) {
|
847
|
-
if (!marker.collapsed) return
|
848
|
-
var found = marker.find(1)
|
849
|
-
if (found != null) self.set(found.line, F_MARKER)
|
850
|
-
})
|
851
|
-
cm.on("markerCleared", function(_, marker, _min, max) {
|
852
|
-
if (max != null && marker.collapsed)
|
853
|
-
self.check(max, F_MARKER, self.hasMarker)
|
854
|
-
})
|
855
|
-
cm.on("markerChanged", this.signal.bind(this))
|
856
|
-
cm.on("lineWidgetAdded", function(_, widget, lineNo) {
|
857
|
-
if (widget.mergeSpacer) return
|
858
|
-
if (widget.above) self.set(lineNo - 1, F_WIDGET_BELOW)
|
859
|
-
else self.set(lineNo, F_WIDGET)
|
860
|
-
})
|
861
|
-
cm.on("lineWidgetCleared", function(_, widget, lineNo) {
|
862
|
-
if (widget.mergeSpacer) return
|
863
|
-
if (widget.above) self.check(lineNo - 1, F_WIDGET_BELOW, self.hasWidgetBelow)
|
864
|
-
else self.check(lineNo, F_WIDGET, self.hasWidget)
|
865
|
-
})
|
866
|
-
cm.on("lineWidgetChanged", this.signal.bind(this))
|
867
|
-
cm.on("change", function(_, change) {
|
868
|
-
var start = change.from.line, nBefore = change.to.line - change.from.line
|
869
|
-
var nAfter = change.text.length - 1, end = start + nAfter
|
870
|
-
if (nBefore || nAfter) self.map(start, nBefore, nAfter)
|
871
|
-
self.check(end, F_MARKER, self.hasMarker)
|
872
|
-
if (nBefore || nAfter) self.check(change.from.line, F_MARKER, self.hasMarker)
|
873
|
-
})
|
874
|
-
cm.on("viewportChange", function() {
|
875
|
-
if (self.cm.doc.height != self.height) self.signal()
|
876
|
-
})
|
877
|
-
}
|
878
|
-
|
879
|
-
TrackAlignable.prototype = {
|
880
|
-
signal: function() {
|
881
|
-
CodeMirror.signal(this, "realign")
|
882
|
-
this.height = this.cm.doc.height
|
883
|
-
},
|
884
|
-
|
885
|
-
set: function(n, flags) {
|
886
|
-
var pos = -1
|
887
|
-
for (; pos < this.alignable.length; pos += 2) {
|
888
|
-
var diff = this.alignable[pos] - n
|
889
|
-
if (diff == 0) {
|
890
|
-
if ((this.alignable[pos + 1] & flags) == flags) return
|
891
|
-
this.alignable[pos + 1] |= flags
|
892
|
-
this.signal()
|
893
|
-
return
|
894
|
-
}
|
895
|
-
if (diff > 0) break
|
896
|
-
}
|
897
|
-
this.signal()
|
898
|
-
this.alignable.splice(pos, 0, n, flags)
|
899
|
-
},
|
900
|
-
|
901
|
-
find: function(n) {
|
902
|
-
for (var i = 0; i < this.alignable.length; i += 2)
|
903
|
-
if (this.alignable[i] == n) return i
|
904
|
-
return -1
|
905
|
-
},
|
906
|
-
|
907
|
-
check: function(n, flag, pred) {
|
908
|
-
var found = this.find(n)
|
909
|
-
if (found == -1 || !(this.alignable[found + 1] & flag)) return
|
910
|
-
if (!pred.call(this, n)) {
|
911
|
-
this.signal()
|
912
|
-
var flags = this.alignable[found + 1] & ~flag
|
913
|
-
if (flags) this.alignable[found + 1] = flags
|
914
|
-
else this.alignable.splice(found, 2)
|
915
|
-
}
|
916
|
-
},
|
917
|
-
|
918
|
-
hasMarker: function(n) {
|
919
|
-
var handle = this.cm.getLineHandle(n)
|
920
|
-
if (handle.markedSpans) for (var i = 0; i < handle.markedSpans.length; i++)
|
921
|
-
if (handle.markedSpans[i].marker.collapsed && handle.markedSpans[i].to != null)
|
922
|
-
return true
|
923
|
-
return false
|
924
|
-
},
|
925
|
-
|
926
|
-
hasWidget: function(n) {
|
927
|
-
var handle = this.cm.getLineHandle(n)
|
928
|
-
if (handle.widgets) for (var i = 0; i < handle.widgets.length; i++)
|
929
|
-
if (!handle.widgets[i].above && !handle.widgets[i].mergeSpacer) return true
|
930
|
-
return false
|
931
|
-
},
|
932
|
-
|
933
|
-
hasWidgetBelow: function(n) {
|
934
|
-
if (n == this.cm.lastLine()) return false
|
935
|
-
var handle = this.cm.getLineHandle(n + 1)
|
936
|
-
if (handle.widgets) for (var i = 0; i < handle.widgets.length; i++)
|
937
|
-
if (handle.widgets[i].above && !handle.widgets[i].mergeSpacer) return true
|
938
|
-
return false
|
939
|
-
},
|
940
|
-
|
941
|
-
map: function(from, nBefore, nAfter) {
|
942
|
-
var diff = nAfter - nBefore, to = from + nBefore, widgetFrom = -1, widgetTo = -1
|
943
|
-
for (var i = 0; i < this.alignable.length; i += 2) {
|
944
|
-
var n = this.alignable[i]
|
945
|
-
if (n == from && (this.alignable[i + 1] & F_WIDGET_BELOW)) widgetFrom = i
|
946
|
-
if (n == to && (this.alignable[i + 1] & F_WIDGET_BELOW)) widgetTo = i
|
947
|
-
if (n <= from) continue
|
948
|
-
else if (n < to) this.alignable.splice(i--, 2)
|
949
|
-
else this.alignable[i] += diff
|
950
|
-
}
|
951
|
-
if (widgetFrom > -1) {
|
952
|
-
var flags = this.alignable[widgetFrom + 1]
|
953
|
-
if (flags == F_WIDGET_BELOW) this.alignable.splice(widgetFrom, 2)
|
954
|
-
else this.alignable[widgetFrom + 1] = flags & ~F_WIDGET_BELOW
|
955
|
-
}
|
956
|
-
if (widgetTo > -1 && nAfter)
|
957
|
-
this.set(from + nAfter, F_WIDGET_BELOW)
|
958
|
-
}
|
959
|
-
}
|
960
|
-
|
961
|
-
function posMin(a, b) { return (a.line - b.line || a.ch - b.ch) < 0 ? a : b; }
|
962
|
-
function posMax(a, b) { return (a.line - b.line || a.ch - b.ch) > 0 ? a : b; }
|
963
|
-
function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
|
964
|
-
|
965
|
-
function findPrevDiff(chunks, start, isOrig) {
|
966
|
-
for (var i = chunks.length - 1; i >= 0; i--) {
|
967
|
-
var chunk = chunks[i];
|
968
|
-
var to = (isOrig ? chunk.origTo : chunk.editTo) - 1;
|
969
|
-
if (to < start) return to;
|
970
|
-
}
|
971
|
-
}
|
972
|
-
|
973
|
-
function findNextDiff(chunks, start, isOrig) {
|
974
|
-
for (var i = 0; i < chunks.length; i++) {
|
975
|
-
var chunk = chunks[i];
|
976
|
-
var from = (isOrig ? chunk.origFrom : chunk.editFrom);
|
977
|
-
if (from > start) return from;
|
978
|
-
}
|
979
|
-
}
|
980
|
-
|
981
|
-
function goNearbyDiff(cm, dir) {
|
982
|
-
var found = null, views = cm.state.diffViews, line = cm.getCursor().line;
|
983
|
-
if (views) for (var i = 0; i < views.length; i++) {
|
984
|
-
var dv = views[i], isOrig = cm == dv.orig;
|
985
|
-
ensureDiff(dv);
|
986
|
-
var pos = dir < 0 ? findPrevDiff(dv.chunks, line, isOrig) : findNextDiff(dv.chunks, line, isOrig);
|
987
|
-
if (pos != null && (found == null || (dir < 0 ? pos > found : pos < found)))
|
988
|
-
found = pos;
|
989
|
-
}
|
990
|
-
if (found != null)
|
991
|
-
cm.setCursor(found, 0);
|
992
|
-
else
|
993
|
-
return CodeMirror.Pass;
|
994
|
-
}
|
995
|
-
|
996
|
-
CodeMirror.commands.goNextDiff = function(cm) {
|
997
|
-
return goNearbyDiff(cm, 1);
|
998
|
-
};
|
999
|
-
CodeMirror.commands.goPrevDiff = function(cm) {
|
1000
|
-
return goNearbyDiff(cm, -1);
|
1001
|
-
};
|
1002
|
-
});
|