From 4d6402f8a6e54a5dce72e2d0b745f8f8e725622d Mon Sep 17 00:00:00 2001 From: Izheil <33794458+Izheil@users.noreply.github.com> Date: Tue, 12 Apr 2022 05:52:57 +0200 Subject: [PATCH] Fix JS Loader issue --- .../MultiRowTab-scrollable-autohide.uc.js | 13 +- .../functions/MultiRowTab-scrollable.uc.js | 40 +- .../functions/MultiRowTabLiteforFx.uc.js | 13 +- .../Multirow & other functions/root/config.js | 28 +- .../root/defaults/pref/config-prefs.js | 2 +- .../Multirow & other functions/utils/boot.jsm | 14 - .../utils/userChrome.jsm | 86 +- .../utils/xPref.jsm | 2 +- .../utils/QNModManager/CodeMirror/.travis.yml | 5 - .../utils/QNModManager/CodeMirror/AUTHORS | 68 + .../QNModManager/CodeMirror/CHANGELOG.md | 264 +++- .../utils/QNModManager/CodeMirror/README.md | 3 +- .../CodeMirror/addon/display/panel.js | 10 +- .../CodeMirror/addon/display/placeholder.js | 15 + .../CodeMirror/addon/edit/closebrackets.js | 22 +- .../CodeMirror/addon/edit/closetag.js | 5 +- .../CodeMirror/addon/edit/continuelist.js | 4 +- .../CodeMirror/addon/edit/matchbrackets.js | 30 +- .../CodeMirror/addon/fold/brace-fold.js | 94 +- .../CodeMirror/addon/fold/foldcode.js | 10 +- .../CodeMirror/addon/hint/html-hint.js | 1 + .../CodeMirror/addon/hint/javascript-hint.js | 2 +- .../CodeMirror/addon/hint/show-hint.js | 80 +- .../CodeMirror/addon/hint/sql-hint.js | 6 +- .../CodeMirror/addon/hint/xml-hint.js | 4 +- .../CodeMirror/addon/lint/javascript-lint.js | 2 + .../CodeMirror/addon/lint/lint.css | 32 +- .../CodeMirror/addon/lint/lint.js | 84 +- .../CodeMirror/addon/merge/merge.js | 3 + .../CodeMirror/addon/mode/multiplex.js | 13 +- .../CodeMirror/addon/mode/multiplex_test.js | 16 + .../CodeMirror/addon/mode/simple.js | 4 +- .../addon/runmode/runmode-standalone.js | 3 +- .../CodeMirror/addon/runmode/runmode.js | 2 +- .../CodeMirror/addon/runmode/runmode.node.js | 2 +- .../CodeMirror/addon/search/jump-to-line.js | 5 +- .../addon/search/match-highlighter.js | 2 +- .../CodeMirror/addon/search/search.js | 48 +- .../CodeMirror/addon/search/searchcursor.js | 31 +- .../CodeMirror/addon/tern/tern.js | 39 +- .../CodeMirror/addon/wrap/hardwrap.js | 5 +- .../CodeMirror/demo/anywordhint.html | 24 +- .../CodeMirror/demo/closetag.html | 1 + .../CodeMirror/demo/complete.html | 4 +- .../QNModManager/CodeMirror/demo/lint.html | 4 +- .../CodeMirror/demo/matchhighlighter.html | 2 +- .../CodeMirror/demo/mustache.html | 2 +- .../CodeMirror/demo/simplemode.html | 2 +- .../QNModManager/CodeMirror/demo/tern.html | 20 +- .../QNModManager/CodeMirror/demo/theme.html | 4 + .../QNModManager/CodeMirror/demo/vim.html | 12 +- .../QNModManager/CodeMirror/doc/docs.css | 2 +- .../CodeMirror/doc/internals.html | 2 +- .../QNModManager/CodeMirror/doc/logos/4me.svg | 1 + .../CodeMirror/doc/logos/anvil.png | Bin 0 -> 9512 bytes .../CodeMirror/doc/logos/artcompiler.svg | 1 + .../CodeMirror/doc/logos/cargo.svg | 1 + .../CodeMirror/doc/logos/codepen.svg | 1 + .../CodeMirror/doc/logos/desmos.svg | 1 + .../CodeMirror/doc/logos/executeprogram.svg | 1 + .../CodeMirror/doc/logos/holmusk.svg | 1 + .../CodeMirror/doc/logos/jetbrains.svg | 1 + .../CodeMirror/doc/logos/observable.svg | 1 + .../CodeMirror/doc/logos/primo.svg | 1 + .../CodeMirror/doc/logos/prisma.svg | 1 + .../QNModManager/CodeMirror/doc/manual.html | 53 +- .../CodeMirror/doc/realworld.html | 14 +- .../QNModManager/CodeMirror/doc/releases.html | 200 ++- .../CodeMirror/doc/source_sans.woff | Bin 0 -> 29448 bytes .../CodeMirror/doc/upgrade_v2.2.html | 2 +- .../utils/QNModManager/CodeMirror/index.html | 33 +- .../QNModManager/CodeMirror/keymap/emacs.js | 394 ++++-- .../QNModManager/CodeMirror/keymap/sublime.js | 16 +- .../QNModManager/CodeMirror/keymap/vim.js | 654 ++++++---- .../CodeMirror/lib/codemirror.css | 23 +- .../QNModManager/CodeMirror/lib/codemirror.js | 201 ++- .../CodeMirror/mode/asn.1/asn.1.js | 2 +- .../CodeMirror/mode/clike/clike.js | 27 +- .../CodeMirror/mode/clike/index.html | 2 +- .../CodeMirror/mode/clojure/clojure.js | 4 +- .../CodeMirror/mode/cobol/cobol.js | 2 +- .../CodeMirror/mode/commonlisp/commonlisp.js | 1 + .../CodeMirror/mode/crystal/crystal.js | 12 +- .../QNModManager/CodeMirror/mode/css/css.js | 65 +- .../CodeMirror/mode/css/index.html | 6 + .../CodeMirror/mode/cypher/cypher.js | 5 +- .../QNModManager/CodeMirror/mode/dtd/dtd.js | 4 +- .../QNModManager/CodeMirror/mode/ebnf/ebnf.js | 14 +- .../CodeMirror/mode/erlang/erlang.js | 4 +- .../CodeMirror/mode/factor/factor.js | 4 +- .../CodeMirror/mode/factor/index.html | 2 +- .../CodeMirror/mode/fcl/index.html | 10 +- .../CodeMirror/mode/forth/index.html | 2 +- .../CodeMirror/mode/fortran/fortran.js | 2 +- .../QNModManager/CodeMirror/mode/gas/gas.js | 12 +- .../QNModManager/CodeMirror/mode/gfm/test.js | 2 +- .../QNModManager/CodeMirror/mode/haml/haml.js | 2 +- .../CodeMirror/mode/htmlembedded/index.html | 2 +- .../CodeMirror/mode/htmlmixed/htmlmixed.js | 5 +- .../QNModManager/CodeMirror/mode/idl/idl.js | 2 +- .../QNModManager/CodeMirror/mode/index.html | 1 + .../CodeMirror/mode/javascript/index.html | 6 +- .../CodeMirror/mode/javascript/javascript.js | 56 +- .../CodeMirror/mode/javascript/test.js | 8 +- .../QNModManager/CodeMirror/mode/jsx/jsx.js | 2 +- .../QNModManager/CodeMirror/mode/jsx/test.js | 7 + .../CodeMirror/mode/julia/julia.js | 95 +- .../QNModManager/CodeMirror/mode/lua/lua.js | 1 + .../CodeMirror/mode/markdown/index.html | 10 +- .../CodeMirror/mode/markdown/markdown.js | 8 +- .../CodeMirror/mode/markdown/test.js | 4 +- .../QNModManager/CodeMirror/mode/meta.js | 9 +- .../CodeMirror/mode/mllike/mllike.js | 2 +- .../CodeMirror/mode/modelica/modelica.js | 6 +- .../CodeMirror/mode/mscgen/mscgen.js | 8 +- .../CodeMirror/mode/mumps/mumps.js | 2 +- .../CodeMirror/mode/nginx/index.html | 4 +- .../QNModManager/CodeMirror/mode/nsis/nsis.js | 40 +- .../CodeMirror/mode/ntriples/index.html | 2 +- .../QNModManager/CodeMirror/mode/oz/oz.js | 4 +- .../CodeMirror/mode/pegjs/pegjs.js | 6 +- .../QNModManager/CodeMirror/mode/perl/perl.js | 13 +- .../QNModManager/CodeMirror/mode/php/php.js | 12 +- .../QNModManager/CodeMirror/mode/pug/pug.js | 2 +- .../CodeMirror/mode/puppet/puppet.js | 2 +- .../CodeMirror/mode/python/index.html | 2 +- .../CodeMirror/mode/python/python.js | 25 +- .../CodeMirror/mode/python/test.js | 32 +- .../utils/QNModManager/CodeMirror/mode/r/r.js | 4 +- .../QNModManager/CodeMirror/mode/rpm/rpm.js | 8 +- .../CodeMirror/mode/ruby/index.html | 2 +- .../QNModManager/CodeMirror/mode/ruby/ruby.js | 41 +- .../QNModManager/CodeMirror/mode/sass/sass.js | 9 +- .../CodeMirror/mode/scheme/scheme.js | 45 +- .../CodeMirror/mode/shell/shell.js | 16 + .../CodeMirror/mode/shell/test.js | 15 +- .../CodeMirror/mode/sieve/sieve.js | 2 +- .../QNModManager/CodeMirror/mode/soy/soy.js | 85 +- .../QNModManager/CodeMirror/mode/soy/test.js | 38 + .../CodeMirror/mode/sparql/sparql.js | 14 +- .../QNModManager/CodeMirror/mode/sql/sql.js | 18 +- .../CodeMirror/mode/stylus/stylus.js | 12 +- .../CodeMirror/mode/tiddlywiki/tiddlywiki.js | 2 +- .../CodeMirror/mode/vbscript/vbscript.js | 4 +- .../CodeMirror/mode/velocity/velocity.js | 3 +- .../CodeMirror/mode/verilog/test.js | 170 +++ .../CodeMirror/mode/verilog/verilog.js | 141 +- .../CodeMirror/mode/vue/index.html | 2 +- .../CodeMirror/mode/wast/index.html | 4 +- .../QNModManager/CodeMirror/mode/wast/test.js | 173 ++- .../QNModManager/CodeMirror/mode/wast/wast.js | 95 +- .../QNModManager/CodeMirror/mode/xml/xml.js | 22 +- .../mode/yaml-frontmatter/yaml-frontmatter.js | 30 +- .../QNModManager/CodeMirror/mode/yaml/yaml.js | 8 +- .../QNModManager/CodeMirror/package.json | 2 +- .../addon/runmode/codemirror-standalone.js | 2 + .../CodeMirror/src/display/Display.js | 4 + .../CodeMirror/src/display/focus.js | 9 +- .../CodeMirror/src/display/operations.js | 3 +- .../CodeMirror/src/display/scroll_events.js | 18 +- .../CodeMirror/src/display/scrollbars.js | 1 + .../CodeMirror/src/display/scrolling.js | 9 +- .../CodeMirror/src/display/selection.js | 21 +- .../CodeMirror/src/display/update_display.js | 3 + .../CodeMirror/src/display/update_line.js | 1 + .../CodeMirror/src/display/update_lines.js | 6 + .../CodeMirror/src/edit/CodeMirror.js | 6 +- .../CodeMirror/src/edit/commands.js | 2 +- .../QNModManager/CodeMirror/src/edit/main.js | 2 +- .../CodeMirror/src/edit/methods.js | 28 +- .../CodeMirror/src/edit/mouse_events.js | 11 +- .../CodeMirror/src/edit/options.js | 2 +- .../src/input/ContentEditableInput.js | 11 +- .../CodeMirror/src/input/TextareaInput.js | 1 + .../CodeMirror/src/input/input.js | 2 +- .../CodeMirror/src/input/keymap.js | 7 +- .../CodeMirror/src/line/line_data.js | 2 +- .../QNModManager/CodeMirror/src/line/spans.js | 12 +- .../src/measurement/position_measurement.js | 20 +- .../QNModManager/CodeMirror/src/model/Doc.js | 7 +- .../CodeMirror/src/model/document_data.js | 1 + .../CodeMirror/src/model/history.js | 6 +- .../CodeMirror/src/model/line_widget.js | 2 +- .../CodeMirror/src/model/mark_text.js | 2 +- .../CodeMirror/src/model/selection_updates.js | 2 +- .../CodeMirror/src/util/browser.js | 2 +- .../CodeMirror/test/emacs_test.js | 21 +- .../QNModManager/CodeMirror/test/lint.js | 3 +- .../QNModManager/CodeMirror/test/test.js | 8 +- .../QNModManager/CodeMirror/test/vim_test.js | 1160 ++++++++++------- .../QNModManager/CodeMirror/theme/abbott.css | 268 ++++ .../CodeMirror/theme/ayu-dark.css | 2 + .../CodeMirror/theme/ayu-mirage.css | 4 +- .../CodeMirror/theme/base16-dark.css | 2 + .../CodeMirror/theme/gruvbox-dark.css | 2 + .../QNModManager/CodeMirror/theme/juejin.css | 30 + .../CodeMirror/theme/material-ocean.css | 8 +- .../CodeMirror/theme/material-palenight.css | 8 +- .../CodeMirror/theme/material.css | 8 +- .../CodeMirror/theme/oceanic-next.css | 2 + .../CodeMirror/theme/solarized.css | 5 +- .../JS Loader/root/config.js | 26 +- .../root/defaults/pref/config-prefs.js | 2 +- .../JS Loader/utils/boot.jsm | 14 - .../JS Loader/utils/userChrome.jsm | 86 +- .../JS Loader/utils/xPref.jsm | 2 +- .../MultiRowTab-scrollable-autohide.uc.js | 13 +- .../MultiRowTab-scrollable.uc.js | 38 +- .../Multirow tabs/MultiRowTabLiteforFx.uc.js | 13 +- README.md | 10 +- 210 files changed, 4425 insertions(+), 1834 deletions(-) delete mode 100644 Installers/Multirow & other functions/utils/boot.jsm delete mode 100644 Mod manager/utils/QNModManager/CodeMirror/.travis.yml create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/4me.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/anvil.png create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/artcompiler.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/cargo.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/codepen.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/desmos.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/executeprogram.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/holmusk.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/jetbrains.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/observable.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/primo.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/logos/prisma.svg create mode 100644 Mod manager/utils/QNModManager/CodeMirror/doc/source_sans.woff create mode 100644 Mod manager/utils/QNModManager/CodeMirror/theme/abbott.css create mode 100644 Mod manager/utils/QNModManager/CodeMirror/theme/juejin.css delete mode 100644 Multirow and other functions/JS Loader/utils/boot.jsm diff --git a/Installers/Multirow & other functions/functions/MultiRowTab-scrollable-autohide.uc.js b/Installers/Multirow & other functions/functions/MultiRowTab-scrollable-autohide.uc.js index 6fe7bdc6..1ecb9b2c 100644 --- a/Installers/Multirow & other functions/functions/MultiRowTab-scrollable-autohide.uc.js +++ b/Installers/Multirow & other functions/functions/MultiRowTab-scrollable-autohide.uc.js @@ -3,8 +3,9 @@ // @namespace https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme // @description Multi-row tabs draggability fix with autohiding scrollbar // @include main -// @compatibility Firefox 70 to Firefox 94.0a1 (2021-09-14) +// @compatibility Firefox 70 to Firefox 101.0a1 (2022-04-08) // @author Alice0775, Endor8, TroudhuK, Izheil, Merci-chao +// @version 12/04/2022 05:40 Min/Max/Close buttons resizing fix // @version 22/01/2022 16:50 Tab sizing fixes // @version 02/11/2021 03:15 Made pinned tabs to not have forced Proton sizing // @version 15/09/2021 11:39 Added experimental support for tab sizing below 20px @@ -136,9 +137,13 @@ function zzzz_MultiRowTabLite() { --toolbarbutton-inner-padding: inherit !important; } - .titlebar-buttonbox .titlebar-button { - padding-top: 8px !important; - padding-bottom: 8px !important; + /* Sizing of the titlebar buttons */ + .titlebar-buttonbox { + height: var(--tab-min-height) !important; + } + + .titlebar-buttonbox-container { + display: block !important; } */ diff --git a/Installers/Multirow & other functions/functions/MultiRowTab-scrollable.uc.js b/Installers/Multirow & other functions/functions/MultiRowTab-scrollable.uc.js index 6506fa30..f1af9fc7 100644 --- a/Installers/Multirow & other functions/functions/MultiRowTab-scrollable.uc.js +++ b/Installers/Multirow & other functions/functions/MultiRowTab-scrollable.uc.js @@ -3,10 +3,9 @@ // @namespace https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme // @description Multi-row tabs draggability fix with scrollable rows // @include main -// @compatibility Firefox 70 to Firefox 94.0a1 (2021-09-14) +// @compatibility Firefox 70 to Firefox 101.0a1 (2022-04-08) // @author Alice0775, Endor8, TroudhuK, Izheil, Merci-chao -// @version 22/01/2022 16:50 Tab sizing fixes -// @version 02/11/2021 03:15 Made pinned tabs to not have forced Proton sizing +// @version 12/04/2022 05:40 Min/Max/Close buttons resizing fix // @version 15/09/2021 11:39 Added experimental support for tab sizing below 20px // @version 10/09/2021 09:49 Fixed regression of pinned tabs icon showing unaligned // @version 19/08/2021 03:15 Compatibility fix for FF91 @@ -122,36 +121,27 @@ function zzzz_MultiRowTabLite() { } /* These below control the padding of the new tab button and min/max/close buttons respectively. - YOU DON'T NEED TO CHANGE THESE unless you want to use values of --tab-min-height lower than 20px. - Before changing them, you need to UNCOMMENT the 2 rules below for them TO TAKE EFFECT. - - The first rule (#TabsToolbar) controls the padding around the "new tab" button. Make sure to always use "px" - as unit for it to work, even on 0 value. Reducing it will allow a lower limit on the tabs height. - - The second rule (.titlebar-buttonbox) has paddings control the padding of the min/max/close buttons. - Changing these are required if you want the tab bar to be smaller when having 1 row. */ + YOU DON'T NEED TO CHANGE THESE unless you want to use values of --tab-min-height lower than 20px. + Before changing them, you need to UNCOMMENT the 2 rules below for them TO TAKE EFFECT. */ /* #TabsToolbar { --toolbarbutton-inner-padding: inherit !important; } - .titlebar-buttonbox .titlebar-button { - padding-top: 8px !important; - padding-bottom: 8px !important; + /* Sizing of the titlebar buttons */ + .titlebar-buttonbox { + height: var(--tab-min-height) !important; } - */ - - /*-------- Don't edit past here unless you know what you are doing --------*/ - /* These 2 rules are a fix to make sure that tabs become smaller on smaller --tab-min-height values */ - .tabbrowser-tab { - max-height: calc(var(--tab-min-height) + var(--toolbarbutton-inner-padding)) !important; + .titlebar-buttonbox-container { + display: block !important; } - .toolbar-items {-moz-box-align: start !important} + */ + + /*-------- Don't edit past here unless you know what you are doing --------*/ - /* Common multirow code */ #navigator-toolbox:-moz-lwtheme { background-color: var(--toolbar-bgcolor) !important; } @@ -192,7 +182,7 @@ function zzzz_MultiRowTabLite() { /* A fix for pinned tabs triggering another row when only pinned tabs are shown in a row */ .tabbrowser-tab[pinned] { - max-height: calc(var(--tab-min-height) + 8px); + height: calc(var(--tab-min-height) + 8px) !important; } /* This fixes the new tab button overflowing to the new row alone */ @@ -243,6 +233,8 @@ function zzzz_MultiRowTabLite() { tabsHavePadding = true; } + console.log(getComputedStyle(tabBackground).getPropertyValue('--tab-block-margin').substring(0,1)) + // Here the FF71+ changes if (document.querySelector("#tabbrowser-tabs > arrowscrollbox").shadowRoot) { @@ -281,7 +273,7 @@ function zzzz_MultiRowTabLite() { `; // This is a fix for FF89+ (Proton) - if (document.documentElement.hasAttribute("proton") || tabsHavePadding) { + if (tabsHavePadding) { style.innerHTML += ` scrollbox { max-height: calc((var(--tab-min-height) + 8px) * var(--max-tab-rows)); diff --git a/Installers/Multirow & other functions/functions/MultiRowTabLiteforFx.uc.js b/Installers/Multirow & other functions/functions/MultiRowTabLiteforFx.uc.js index 482ddf1f..c43c1b7e 100644 --- a/Installers/Multirow & other functions/functions/MultiRowTabLiteforFx.uc.js +++ b/Installers/Multirow & other functions/functions/MultiRowTabLiteforFx.uc.js @@ -3,8 +3,9 @@ // @namespace https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme // @description Multi-row tabs draggability fix with unlimited rows // @include main -// @compatibility Firefox 70 to Firefox 94.0a1 (2021-09-14) +// @compatibility Firefox 70 to Firefox 101.0a1 (2022-04-08) // @author Alice0775, Endor8, TroudhuK, Izheil, Merci-chao +// @version 12/04/2022 05:40 Min/Max/Close buttons resizing fix // @version 22/01/2022 16:50 Tab sizing fixes // @version 02/11/2021 03:15 Made pinned tabs to not have forced Proton sizing // @version 15/09/2021 11:39 Added experimental support for tab sizing below 20px @@ -109,9 +110,13 @@ function zzzz_MultiRowTabLite() { --toolbarbutton-inner-padding: inherit !important; } - .titlebar-buttonbox .titlebar-button { - padding-top: 8px !important; - padding-bottom: 8px !important; + /* Sizing of the titlebar buttons */ + .titlebar-buttonbox { + height: var(--tab-min-height) !important; + } + + .titlebar-buttonbox-container { + display: block !important; } */ diff --git a/Installers/Multirow & other functions/root/config.js b/Installers/Multirow & other functions/root/config.js index 4980e5e1..69a2072e 100644 --- a/Installers/Multirow & other functions/root/config.js +++ b/Installers/Multirow & other functions/root/config.js @@ -1,8 +1,26 @@ // skip 1st line +lockPref('xpinstall.signatures.required', false); + +Object = Cu.getGlobalForObject(Cu).Object; +const { freeze } = Object; +Object.freeze = obj => { + if (Components.stack.caller.filename != 'resource://gre/modules/AppConstants.jsm') + return freeze(obj); + + obj.MOZ_REQUIRE_SIGNING = false; + Object.freeze = freeze; + return freeze(obj); +} + try { - - let Cu = Components.utils; - Cu.import('resource://gre/modules/osfile.jsm'); - Cu.import(OS.Path.toFileURI(OS.Constants.Path.profileDir)+ '/chrome/utils/boot.jsm'); + let cmanifest = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('UChrm', Ci.nsIFile); + cmanifest.append('utils'); + cmanifest.append('chrome.manifest'); + Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(cmanifest); -} catch(ex) {}; + Cu.import('chrome://userchromejs/content/BootstrapLoader.jsm'); +} catch (ex) {}; + +try { + Cu.import('chrome://userchromejs/content/userChrome.jsm'); +} catch (ex) {}; \ No newline at end of file diff --git a/Installers/Multirow & other functions/root/defaults/pref/config-prefs.js b/Installers/Multirow & other functions/root/defaults/pref/config-prefs.js index 57e8af3e..65ff8afe 100644 --- a/Installers/Multirow & other functions/root/defaults/pref/config-prefs.js +++ b/Installers/Multirow & other functions/root/defaults/pref/config-prefs.js @@ -1,3 +1,3 @@ pref("general.config.obscure_value", 0); pref("general.config.filename", "config.js"); -pref("general.config.sandbox_enabled", false); +pref("general.config.sandbox_enabled", false); \ No newline at end of file diff --git a/Installers/Multirow & other functions/utils/boot.jsm b/Installers/Multirow & other functions/utils/boot.jsm deleted file mode 100644 index e5516153..00000000 --- a/Installers/Multirow & other functions/utils/boot.jsm +++ /dev/null @@ -1,14 +0,0 @@ -let EXPORTED_SYMBOLS = []; - -let { - classes: Cc, - interfaces: Ci, - manager: Cm -} = Components; - -var cmanifest = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('UChrm', Ci.nsIFile); -cmanifest.append('utils'); -cmanifest.append('chrome.manifest'); -Cm.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(cmanifest); - -ChromeUtils.import('chrome://userchromejs/content/userChrome.jsm'); diff --git a/Installers/Multirow & other functions/utils/userChrome.jsm b/Installers/Multirow & other functions/utils/userChrome.jsm index 84ec226f..fde9f490 100644 --- a/Installers/Multirow & other functions/utils/userChrome.jsm +++ b/Installers/Multirow & other functions/utils/userChrome.jsm @@ -1,18 +1,26 @@ let EXPORTED_SYMBOLS = []; -const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm'); -const {xPref} = ChromeUtils.import('chrome://userchromejs/content/xPref.jsm'); - -let UC = {}; +const { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm'); +const { xPref } = ChromeUtils.import('chrome://userchromejs/content/xPref.jsm'); +const { Management } = ChromeUtils.import('resource://gre/modules/Extension.jsm'); +const { AppConstants } = ChromeUtils.import('resource://gre/modules/AppConstants.jsm'); + +let UC = { + webExts: new Map(), + sidebar: new Map() +}; let _uc = { ALWAYSEXECUTE: 'userChrome.uc.js', - BROWSERCHROME: 'chrome://browser/content/browser.xhtml', + BROWSERCHROME: AppConstants.MOZ_APP_NAME == 'thunderbird' ? 'chrome://messenger/content/messenger.xhtml' : 'chrome://browser/content/browser.xhtml', + BROWSERTYPE: AppConstants.MOZ_APP_NAME == 'thunderbird' ? 'mail:3pane' : 'navigator:browser', + BROWSERNAME: AppConstants.MOZ_APP_NAME.charAt(0).toUpperCase() + AppConstants.MOZ_APP_NAME.slice(1), PREF_ENABLED: 'userChromeJS.enabled', PREF_SCRIPTSDISABLED: 'userChromeJS.scriptsDisabled', - BASE_FILEURI: Services.io.getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler).getURLSpecFromDir(Services.dirsvc.get('UChrm', Ci.nsIFile)), chromedir: Services.dirsvc.get('UChrm', Ci.nsIFile), + scriptsDir: '', + sss: Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService), getScripts: function () { @@ -24,8 +32,7 @@ let _uc = { let fileURI = Services.io.newFileURI(file); if (/\.uc\.js$/i.test(file.leafName)) { _uc.getScriptData(file); - } - else if(/\.as\.css$/i.test(file.leafName)) { + } else if(/\.as\.css$/i.test(file.leafName)) { if(!sss.sheetRegistered(fileURI, sss.AGENT_SHEET)) sss.loadAndRegisterSheet(fileURI, sss.AGENT_SHEET); } @@ -55,9 +62,8 @@ let _uc = { return this.scripts[filename] = { filename: filename, file: aFile, - url: this.BASE_FILEURI + filename, + url: Services.io.getProtocolHandler('file').QueryInterface(Ci.nsIFileProtocolHandler).getURLSpecFromDir(this.chromedir) + filename, name: (header.match(/\/\/ @name\s+(.+)\s*$/im) || def)[1], - charset: (header.match(/\/\/ @charset\s+(.+)\s*$/im) || def)[1], description: (header.match(/\/\/ @description\s+(.+)\s*$/im) || def)[1], version: (header.match(/\/\/ @version\s+(.+)\s*$/im) || def)[1], author: (header.match(/\/\/ @author\s+(.+)\s*$/im) || def)[1], @@ -109,11 +115,8 @@ let _uc = { } try { - if (script.charset) { - Services.scriptloader.loadSubScript(script.url + '?' + script.file.lastModifiedTime, win, script.charset); - } else { - Services.scriptloader.loadSubScript(script.url + '?' + script.file.lastModifiedTime, win, 'UTF-8'); - } + Services.scriptloader.loadSubScript(script.url + '?' + script.file.lastModifiedTime, + script.onlyonce ? { window: win } : win); script.isRunning = true; if (script.startup) { eval(script.startup); @@ -122,12 +125,12 @@ let _uc = { this.everLoaded.push(script.id); } } catch (ex) { - this.error(script.filename, ex); + Cu.reportError(ex); } }, windows: function (fun, onlyBrowsers = true) { - let windows = Services.wm.getEnumerator(onlyBrowsers ? 'navigator:browser' : null); + let windows = Services.wm.getEnumerator(onlyBrowsers ? this.BROWSERTYPE : null); while (windows.hasMoreElements()) { let win = windows.getNext(); if (!win._uc) @@ -156,16 +159,6 @@ let _uc = { el.setAttribute(att, atts[att]); } return el - }, - - error: function (aMsg, err) { - let error = Cc['@mozilla.org/scripterror;1'].createInstance(Ci.nsIScriptError); - if (typeof err == 'object') { - error.init(aMsg + '\n' + err.name + ' : ' + err.message, err.fileName || null, null, err.lineNumber, null, 2, err.name); - } else { - error.init(aMsg + '\n' + err + '\n', null, null, null, null, 2, null); - } - Services.console.logMessage(error); } }; @@ -177,12 +170,7 @@ if (xPref.get(_uc.PREF_SCRIPTSDISABLED) === undefined) { xPref.set(_uc.PREF_SCRIPTSDISABLED, '', true); } -function UserChrome_js() { - _uc.getScripts(); - Services.obs.addObserver(this, 'chrome-document-global-created', false); -} - -UserChrome_js.prototype = { +let UserChrome_js = { observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); }, @@ -191,7 +179,14 @@ UserChrome_js.prototype = { let document = aEvent.originalTarget; let window = document.defaultView; let location = window.location; - if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) { + + if (!this.sharedWindowOpened && location.href == 'chrome://extensions/content/dummy.xhtml') { + this.sharedWindowOpened = true; + + Management.on('extension-browser-inserted', function (topic, browser) { + browser.messageManager.addMessageListener('Extension:ExtensionViewLoaded', this.messageListener.bind(this)); + }.bind(this)); + } else if (/^(chrome:(?!\/\/global\/content\/commonDialog\.x?html)|about:(?!blank))/i.test(location.href)) { window.UC = UC; window._uc = _uc; window.xPref = xPref; @@ -206,8 +201,27 @@ UserChrome_js.prototype = { _uc.loadScript(_uc.scripts[_uc.ALWAYSEXECUTE], window); } } + }, + + messageListener: function (msg) { + const browser = msg.target; + const { addonId } = browser._contentPrincipal; + + browser.messageManager.removeMessageListener('Extension:ExtensionViewLoaded', this.messageListener); + + if (browser.ownerGlobal.location.href == 'chrome://extensions/content/dummy.xhtml') { + UC.webExts.set(addonId, browser); + Services.obs.notifyObservers(null, 'UCJS:WebExtLoaded', addonId); + } else { + let win = browser.ownerGlobal.windowRoot.ownerGlobal; + UC.sidebar.get(addonId)?.set(win, browser) || UC.sidebar.set(addonId, new Map([[win, browser]])); + Services.obs.notifyObservers(win, 'UCJS:SidebarLoaded', addonId); + } } }; -if (!Services.appinfo.inSafeMode) - new UserChrome_js(); +if (!Services.appinfo.inSafeMode) { + _uc.chromedir.append(_uc.scriptsDir); + _uc.getScripts(); + Services.obs.addObserver(UserChrome_js, 'chrome-document-global-created', false); +} diff --git a/Installers/Multirow & other functions/utils/xPref.jsm b/Installers/Multirow & other functions/utils/xPref.jsm index 4bd35665..df07b7ba 100644 --- a/Installers/Multirow & other functions/utils/xPref.jsm +++ b/Installers/Multirow & other functions/utils/xPref.jsm @@ -38,7 +38,7 @@ var xPref = { switch (typeof value) { case 'string': - return sPrefs.setCharPref(prefPath, value) || value; + return sPrefs.setStringPref(prefPath, value) || value; case 'number': return sPrefs.setIntPref(prefPath, value) || value; case 'boolean': diff --git a/Mod manager/utils/QNModManager/CodeMirror/.travis.yml b/Mod manager/utils/QNModManager/CodeMirror/.travis.yml deleted file mode 100644 index 1dfeb819..00000000 --- a/Mod manager/utils/QNModManager/CodeMirror/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - stable -sudo: false -cache: npm diff --git a/Mod manager/utils/QNModManager/CodeMirror/AUTHORS b/Mod manager/utils/QNModManager/CodeMirror/AUTHORS index 3fa6199e..5ab9613a 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/AUTHORS +++ b/Mod manager/utils/QNModManager/CodeMirror/AUTHORS @@ -10,15 +10,18 @@ Abhishek Gahlot Adam Ahmed Adam King Adam Particka +Adam Wight adanlobato Adán Lobato Aditya Toshniwal Adrian Aichner Adrian Heine +Adrian Kunz Adrien Bertrand aeroson Ahmad Amireh Ahmad M. Zawawi +AHOHNMYC ahoward Ajin Abraham Akeksandr Motsjonov @@ -27,6 +30,7 @@ AlbertHilb Alberto González Palomo Alberto Pose Albert Xing +Alexander Marks Alexander Pavlov Alexander Schepanovski Alexander Shvets @@ -35,6 +39,7 @@ Alexandre Bique Alex Churchill alexey-k Alex Piggott +Alf Eaton Aliaksei Chapyzhenka Allen Sarkisyan Ami Fischman @@ -73,8 +78,10 @@ Anthony Dugois anthonygego Anthony Gégo Anthony Grimes +Anthony Stewart Anton Kovalyov antosarho +aoki ken Apollo Zhu AQNOUCH Mohammed Aram Shatakhtsyan @@ -112,6 +119,7 @@ Bernhard Sirlinger Bert Chang Bharad BigBlueHat +Billiam Billy Moon Bin Ni binny @@ -161,6 +169,7 @@ Chris Smith Christian Gruen Christian Oyarzun Christian Petrov +Christian Sonne christopherblaser Christopher Brown Christopher Kramer @@ -176,6 +185,7 @@ CodeBitt coderaiser Cole R Lawrence ComFreek +Cornelius Weig Cristian Prieto Curran Kelleher Curtis Gagliardi @@ -207,6 +217,7 @@ David Barnett David H. Bronke David Mignot David Pathakjee +David R. Myers David Rodrigues David Santana David Vázquez @@ -220,6 +231,7 @@ Dick Choi Diego Fernandez dignifiedquire Dimage Sapelkin +Dimitri Mitropoulos Dinindu D. Wanniarachchi dmaclach Dmitry Kiselyov @@ -242,6 +254,7 @@ edoroshenko edsharp ekhaled Elisée +Elmar Peise elpnt Emmanuel Schanzer Enam Mijbah Noor @@ -249,6 +262,7 @@ Eric Allam Eric Bogard Erik Demaine Erik Welander +erosman eustas Evan Minsk Fabien Dubosson @@ -259,6 +273,7 @@ Fauntleroy fbuchinger feizhang365 Felipe Lalanne +Felipe S. S. Schneider Felix Raab ficristo Filip Noetzel @@ -285,6 +300,7 @@ galambalazs Gary Sheng Gautam Mehta Gavin Douglas +Geist-zz gekkoe Geordie Hall George Stephanis @@ -324,6 +340,7 @@ Heanes Hector Oswaldo Caballero Hein Htat Hélio +Hendrik Erz Hendrik Wallbaum Henrik Haugbølle Herculano Campos @@ -332,10 +349,12 @@ Hiroyuki Makino hitsthings Hocdoc Howard +Howard Jing Hugues Malphettes Ian Beck Ian Davies Ian Dickinson +Ian Henderson ianhi Ian Rose Ian Wehrman @@ -348,16 +367,23 @@ ilvalle Ilya Kharlamov Ilya Zverev Ingo Richter +Intervue Irakli Gozalishvili +iteriani Ivan Kurnosov Ivoah Jack Douglas Jacob Lee Jaimin Jake Peyser +Jake Zimmerman +Jakob Kummerow Jakob Miland +Jakub Nowak +Jakub T. Jankiewicz Jakub Vrana Jakub Vrána +James Baicoianu James Campos James Cockshull James Howard @@ -400,6 +426,7 @@ jochenberger Jochen Berger Joel Einbinder joelpinheiro +Joe Predham joewalsh Johan Ask Johannes @@ -410,6 +437,7 @@ John Engler John Lees-Miller John Ryan John Snelson +johnspiegel John Van Der Loo Jon Ander Peñalba Jonas Döbertin @@ -417,12 +445,14 @@ Jonas Helfer Jonathan Dierksen Jonathan Hart Jonathan Malmaud +Jonathan Rascher Jon Gacnik jongalloway Jon Malmaud Jon Sangster Joo Joost-Wim Boekesteijn +José dBruxelles Joseph Pecoraro Josh Barnes Josh Cohen @@ -446,9 +476,11 @@ karevn Karol Kaushik Kulkarni Kayur Patel +Kazuhisa Ishizaka Kazuhito Hokamura kcwiakala Kees de Kooter +Keldan Chapman Kenan Christian Dimas Ken Newman ken restivo @@ -459,9 +491,11 @@ Kevin Muret Kevin Sawicki Kevin Ushey Kier Darby +Kim-Anh Tran Klaus Silveira Koh Zi Han, Cliff komakino +Konstantin Chernenko Konstantin Lopuhin koops Kris Ciccarello @@ -483,10 +517,12 @@ Leo Baschy Leonid Khachaturov Leon Sorokin Leonya Khachaturov +lexer2086 Liam Newman Libo Cannici Lior Goldberg Lior Shub +lishid LloydMilligan LM lochel @@ -499,6 +535,7 @@ Lucas Buchala Luciano Longo Luciano Santana Lu Fangjian +Łukasz Wielgus Luke Browning Luke Granger-Brown Luke Stagner @@ -513,6 +550,7 @@ Manuel Rego Casasnovas Marat Dreizin Marcel Gerber Marcelo Camargo +Marc Espín Marco Aurélio Marco Munizaga Marcus Bointon @@ -521,6 +559,7 @@ Marijn Haverbeke Mário Gonçalves Mario Pietsch Mark Anderson +Mark Boyes Mark Dalgleish Mark Hamstra Mark Lentczner @@ -534,10 +573,12 @@ Martin Hasoň Martin Hunt Martin Laine Martin Zagora +Masahiro MATAYOSHI Mason Malone Mateusz Paprocki Mathias Bynens mats cronqvist +Matt Diehl Matt Gaide Matthew Bauer Matthew Beale @@ -568,6 +609,7 @@ meshuamam Metatheos Micah Dubinko Michael +Michael Chirico Michael Goderbauer Michael Grey Michael Kaminsky @@ -590,11 +632,13 @@ Mike Ivanov Mike Kadin Mike Kobit Milan Szekely +MinJune Kim MinRK Miraculix87 misfo mkaminsky11 mloginov +mlsad3 Moritz Schubotz (physikerwelt) Moritz Schwörer Moshe Wajnberg @@ -603,8 +647,10 @@ ms mtaran-google Mu-An ✌️ Chiou Mu-An Chiou +Mykola Martynovets mzabuawala Narciso Jaramillo +nathanlesage Nathan Williams ndr Neil Anderson @@ -631,6 +677,7 @@ Nikolaj Kappler Nikolay Kostov nilp0inter Nils Knappmeier +Nina Pypchenko Nisarg Jhaveri nlwillia noragrossman @@ -638,6 +685,7 @@ Norman Rzepka Nouzbe Oleksandr Yakovenko Olivia Ytterbrink +Ondřej Mirtes Opender Singh opl- Oreoluwa Onatemowo @@ -675,19 +723,23 @@ Peter Flynn peterkroon Peter Kroon Peter László +Phil DeJarnett Philipp A Philipp Markovics Philip Stadermann Pi Delport Pierre Gerold Pieter Ouwerkerk +Piyush Pontus Melke prasanthj Prasanth J Prayag Verma prendota Prendota +ps173 Qiang Li +quiddity-wp Radek Piórkowski Rahul Rahul Anand @@ -717,9 +769,12 @@ Roberto Abdelkader Martínez Pérez robertop23 Roberto Vidal Robert Plummer +Roman Frolov Roman Janusz +Rongjian Zhang Rrandom Rrrandom +Ruslan Bekenev Ruslan Osmanov rvalavicius Ryan Pangrle @@ -727,6 +782,7 @@ Ryan Petrello Ryan Prior ryu-sato sabaca +Sachin Gupta Sam Lee Sam Rawlins Samuel Ainsworth @@ -748,6 +804,7 @@ Scott Aikin Scott Feeney Scott Goodhew Seb35 +Sebastian Ślepowroński Sebastian Wilzbach Sebastian Zaha Seren D @@ -768,7 +825,9 @@ Siamak Mokhtari Siddhartha Gunti silverwind Simon Edwards +Simon Huber sinkuu +Slava Rozhnev snasa soliton4 sonson @@ -778,6 +837,7 @@ srajanpaliwal Stanislav Oaserele stan-z Stas Kobzar +stasoid Stefan Borsje Steffen Beyer Steffen Bruchmann @@ -786,6 +846,7 @@ Stephane Moore Stephen Lavelle Steve Champagne Steve Hoover +Steven Yung Steve O'Hara stockiNail stoskov @@ -809,6 +870,7 @@ Thaddee Tyl thanasis TheHowl themrmax +Thiemo Kreuz think Thomas Brouard Thomas Dvornik @@ -818,6 +880,7 @@ Thomas Schmid Tim Alby Tim Baumann Tim Gates +Tim Nguyen Timothy Farrell Timothy Gu Timothy Hatcher @@ -835,6 +898,7 @@ Tom MacWright Tom McLaughlin Tony Jian tophf +Torben Bundt Torgeir Thoresen totalamd Travis Heppe @@ -863,7 +927,9 @@ Wes Cossick Wesley Wiser Weston Ruter Will Binns-Smith +Will Cassella Will Dean +Will Hernandez William Desportes William Jamieson William Stein @@ -873,6 +939,8 @@ wonderboyjon Wu Cheng-Han Xavier Mendez Yang Guo +Yash Singh +Yash-Singh1 Yassin N. Hassan YNH Webdev yoongu diff --git a/Mod manager/utils/QNModManager/CodeMirror/CHANGELOG.md b/Mod manager/utils/QNModManager/CodeMirror/CHANGELOG.md index 8e651ec7..2ccf2926 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/CHANGELOG.md +++ b/Mod manager/utils/QNModManager/CodeMirror/CHANGELOG.md @@ -1,3 +1,253 @@ +## 5.65.2 (2022-02-21) + +### Bug fixes + +[clike mode](https://codemirror.net/mode/clike/): Recognize triple quoted string in Java. + +[cypher mode](https://codemirror.net/mode/cypher/index.html): Fix handling of punctuation. + +## 5.65.1 (2022-01-20) + +### Bug fixes + +Fix miscalculation of vertical positions in lines that have both line widgets and replaced newlines. + +## 5.65.0 (2021-12-20) + +### Bug fixes + +brace-folding addon: Fix broken folding on lines with both braces and square brackets. + +### New features + +[vim bindings](https://codemirror.net/demo/vim.html): Support g0, g$, g. + +## 5.64.0 (2021-11-20) + +### Bug fixes + +Fix a crash that occurred in some situations with replacing marks across line breaks. + +Make sure native scrollbars reset their position when hidden and re-shown. + +### New features + +[vim bindings](https://codemirror.net/demo/vim.html): Support C-u to delete back a line. + +## 5.63.3 (2021-10-11) + +### Bug fixes + +Prevent external styles from giving the hidden textarea a min-height. + +Remove a stray autosave file that was part of the previous release. + +## 5.63.1 (2021-09-29) + +### Bug fixes + +Fix an issue with mouse scrolling on Chrome 94 Windows, which made scrolling by wheel move unusably slow. + +## 5.63.0 (2021-09-20) + +### Bug fixes + +Fix scroll position jumping when scrolling a document with very different line heights. + +[xml mode](https://codemirror.net/mode/xml/): Look up HTML element behavior in a case-insensitive way. + +### New features + +[vim bindings](https://codemirror.net/demo/vim.html): Support guu for case-changing. + +## 5.62.3 (2021-08-20) + +### Bug fixes + +Give the editor a `translate=no` attribute to prevent automatic translation from modifying its content. + +Give vim-style cursors a width that matches the character after them. + +[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Make buttons keyboard-accessible. + +[emacs bindings](https://codemirror.net/demo/emacs.html): Fix by-page scrolling keybindings, which were accidentally inverted. + +## 5.62.2 (2021-07-21) + +### Bug fixes + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Fix a regression that broke several addon options. + +## 5.62.1 (2021-07-20) + +### Bug fixes + +[vim bindings](https://codemirror.net/demo/vim.html): Make matching of upper-case characters more Unicode-aware. + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Prevent options passed to the addon itself from being given to the linter. + +[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Improve screen reader support. + +[search addon](https://codemirror.net/demo/search.html): Avoid using `innerHTML`. + +## 5.62.0 (2021-06-21) + +### Bug fixes + +Improve support for vim-style cursors in a number of themes. + +### New features + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Add support for highlighting lines with errors or warnings. + +## 5.61.1 (2021-05-20) + +### Bug fixes + +Fix a bug where changing the editor's document could confuse text-direction management. + +Fix a bug in horizontally scrolling the cursor into view. + +Optimize adding lots of marks in a single transaction. + +[simple mode addon](https://codemirror.net/demo/simplemode.html): Support regexps with a unicode flag. + +[javascript mode](https://codemirror.net/mode/javascript/index.html): Add support for TypeScript template string types, improve integration with JSX mode. + +## 5.61.0 (2021-04-20) + +### Bug fixes + +Improve support for being in a shadow DOM in contenteditable mode. + +Prevent line number from being read by screen readers. + +[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Fix a crash caused by a race condition. + +[javascript mode](https://codemirror.net/mode/javascript/): Improve scope tracking. + +### New features + +The library now emits an `"updateGutter"` event when the gutter width changes. + +[emacs bindings](https://codemirror.net/demo/emacs.html): Provide named commands for all bindings. + +## 5.60.0 (2021-03-20) + +### Bug fixes + +Fix autofocus feature in contenteditable mode. + +[simple mode addon](https://codemirror.net/demo/simplemode.html): Fix a null-dereference crash. + +[multiplex addon](https://codemirror.net/demo/multiplex.html): Make it possible to use `parseDelimiters` when both delimiters are the same. + +[julia mode](https://codemirror.net/mode/julia/): Fix a lockup bug. + +### New features + +`setSelections` now allows ranges to omit the `head` property when it is equal to `anchor`. + +[sublime bindings](https://codemirror.net/demo/sublime.html): Add support for reverse line sorting. + +## 5.59.4 (2021-02-24) + +### Bug fixes + +Give the scrollbar corner filler a background again, to prevent content from peeping through between the scrollbars. + +## 5.59.3 (2021-02-20) + +### Bug fixes + +Don't override the way zero-with non-joiners are rendered. + +Fix an issue where resetting the history cleared the `undoDepth` option's value. + +[vim bindings](https://codemirror.net/demo/vim.html): Fix substitute command when joining and splitting lines, fix global command when line number change, add support for `:vglobal`, properly treat caps lock as a modifier key. + +## 5.59.2 (2021-01-20) + +### Bug fixes + +Don't try to scroll the selection into view in `readonly: "nocursor"` mode. + +[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Fix a regression in the behavior of pressing enter between brackets. + +[javascript mode](https://codemirror.net/mode/javascript/): Fix an infinite loop on specific syntax errors in object types. + +various modes: Fix inefficient RegExp matching. + +## 5.59.1 (2020-12-31) + +### Bug fixes + +Fix an issue where some Chrome browsers were detected as iOS. + +## 5.59.0 (2020-12-20) + +### Bug fixes + +Fix platform detection on recent iPadOS. + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Don't show duplicate messages for a given line. + +[clojure mode](https://codemirror.net/mode/clojure/index.html): Fix regexp that matched in exponential time for some inputs. + +[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): Improve handling of words that are longer than the line length. + +[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Fix leaked event handler on disabling the addon. + +### New features + +[search addon](https://codemirror.net/demo/search.html): Make it possible to configure the search addon to show the dialog at the bottom of the editor. + +## 5.58.3 (2020-11-19) + +### Bug fixes + +Suppress quick-firing of blur-focus events when dragging and clicking on Internet Explorer. + +Fix the `insertAt` option to `addLineWidget` to actually allow the widget to be placed after all widgets for the line. + +[soy mode](https://codemirror.net/mode/soy/): Support `@Attribute` and element composition. + +[shell mode](https://codemirror.net/mode/shell/): Support heredoc quoting. + +## 5.58.2 (2020-10-23) + +### Bug fixes + +Fix a bug where horizontally scrolling the cursor into view sometimes failed with a non-fixed gutter. + +[julia mode](https://codemirror.net/mode/julia/): Fix an infinite recursion bug. + +## 5.58.1 (2020-09-23) + +### Bug fixes + +[placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder): Remove arrow function that ended up in the code. + +## 5.58.0 (2020-09-21) + +### Bug fixes + +Make backspace delete by code point, not glyph. + +Suppress flickering focus outline when clicking on scrollbars in Chrome. + +Fix a bug that prevented attributes added via `markText` from showing up unless the span also had some other styling. + +Suppress cut and paste context menu entries in readonly editors in Chrome. + +[placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder): Update placeholder visibility during composition. + +### New features + +Make it less cumbersome to style new lint message types. + +[vim bindings](https://codemirror.net/demo/vim.html): Support black hole register, `gn` and `gN` + ## 5.57.0 (2020-08-20) ### Bug fixes @@ -164,7 +414,7 @@ Make Shift-Delete to cut work on Firefox. [handlebars mode](https://codemirror.net/mode/handlebars/): Fix triple-brace support. -[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Support mathing `$` in reverse regexp search. +[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Support matching `$` in reverse regexp search. [panel addon](https://codemirror.net/doc/manual.html#addon_panel): Don't get confused by changing panel sizes. @@ -420,7 +670,7 @@ Add `hintWords` (basic completion) helper to [clojure](https://codemirror.net/mo [panel addon](https://codemirror.net/doc/manual.html#addon_panel): Fix problem where replacing the last remaining panel dropped the newly added panel. -[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): Fix an infinite loop when the indention is greater than the target column. +[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): Fix an infinite loop when the indentation is greater than the target column. [jinja2](https://codemirror.net/mode/jinja2/) and [markdown](https://codemirror.net/mode/markdown/) modes: Add comment metadata. @@ -808,7 +1058,7 @@ Add `role=presentation` to more DOM elements to improve screen reader support. [merge addon](https://codemirror.net/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust. -[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (differnet) block comment. +[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (different) block comment. [javascript mode](https://codemirror.net/mode/javascript/): Improve support for TypeScript syntax. @@ -926,7 +1176,7 @@ New event: [`optionChange`](https://codemirror.net/doc/manual.html#event_optionC Tapping/clicking the editor in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle) on Chrome now puts the cursor at the tapped position. -Fix various crashes and misbehaviors when reading composition events in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle). +Fix various crashes and misbehavior when reading composition events in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle). Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a ``. @@ -1261,7 +1511,7 @@ Fix a [bug](https://github.com/codemirror/CodeMirror/issues/3834) that caused ph * New modes: [Vue](https://codemirror.net/mode/vue/index.html), [Oz](https://codemirror.net/mode/oz/index.html), [MscGen](https://codemirror.net/mode/mscgen/index.html) (and dialects), [Closure Stylesheets](https://codemirror.net/mode/css/gss.html) * Implement [CommonMark](http://commonmark.org)-style flexible list indent and cross-line code spans in [Markdown](https://codemirror.net/mode/markdown/index.html) mode * Add a replace-all button to the [search addon](https://codemirror.net/doc/manual.html#addon_search), and make the persistent search dialog transparent when it obscures the match -* Handle `acync`/`await` and ocal and binary numbers in [JavaScript mode](https://codemirror.net/mode/javascript/index.html) +* Handle `async`/`await` and ocal and binary numbers in [JavaScript mode](https://codemirror.net/mode/javascript/index.html) * Fix various issues with the [Haxe mode](https://codemirror.net/mode/haxe/index.html) * Make the [closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets) select only the wrapped text when wrapping selection in brackets * Tokenize properties as properties in the [CoffeeScript mode](https://codemirror.net/mode/coffeescript/index.html) @@ -1748,7 +1998,7 @@ Emergency fix for a bug where an editor with line wrapping on IE will break when * Slightly incompatible API changes. Read [this](https://codemirror.net/doc/upgrade_v2.2.html). * New approach to [binding](https://codemirror.net/doc/manual.html#option_extraKeys) keys, support for [custom bindings](https://codemirror.net/doc/manual.html#option_keyMap). * Support for overwrite (insert). -* [Custom-width](https://codemirror.net/doc/manual.html#option_tabSize) and [stylable](https://codemirror.net/demo/visibletabs.html) tabs. +* [Custom-width](https://codemirror.net/doc/manual.html#option_tabSize) and [styleable](https://codemirror.net/demo/visibletabs.html) tabs. * Moved more code into [add-on scripts](https://codemirror.net/doc/manual.html#addons). * Support for sane vertical cursor movement in wrapped lines. * More reliable handling of editing [marked text](https://codemirror.net/doc/manual.html#markText). @@ -1762,7 +2012,7 @@ Fixes `TextMarker.clear`, which is broken in 2.17. ## 2.17.0 (2011-11-21) * Add support for [line wrapping](https://codemirror.net/doc/manual.html#option_lineWrapping) and [code folding](https://codemirror.net/doc/manual.html#hideLine). -* Add [Github-style Markdown](https://codemirror.net/mode/gfm/index.html) mode. +* Add [GitHub-style Markdown](https://codemirror.net/mode/gfm/index.html) mode. * Add [Monokai](https://codemirror.net/theme/monokai.css) and [Rubyblue](https://codemirror.net/theme/rubyblue.css) themes. * Add [`setBookmark`](https://codemirror.net/doc/manual.html#setBookmark) method. * Move some of the demo code into reusable components under [`lib/util`](https://codemirror.net/addon/). diff --git a/Mod manager/utils/QNModManager/CodeMirror/README.md b/Mod manager/utils/QNModManager/CodeMirror/README.md index 2a7b1f5e..39c24686 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/README.md +++ b/Mod manager/utils/QNModManager/CodeMirror/README.md @@ -1,8 +1,7 @@ # CodeMirror -[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror) +[![Build Status](https://github.com/codemirror/codemirror/workflows/main/badge.svg)](https://github.com/codemirror/codemirror/actions) [![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror) -[![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror) CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with over diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/display/panel.js b/Mod manager/utils/QNModManager/CodeMirror/addon/display/panel.js index 4c9f2c0f..29f7e0be 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/display/panel.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/display/panel.js @@ -76,7 +76,7 @@ }; function initPanels(cm) { - var wrap = cm.getWrapperElement(); + var wrap = cm.getWrapperElement() var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle; var height = parseInt(style.height); var info = cm.state.panels = { @@ -84,9 +84,10 @@ panels: [], wrapper: document.createElement("div") }; + var hasFocus = cm.hasFocus(), scrollPos = cm.getScrollInfo() wrap.parentNode.insertBefore(info.wrapper, wrap); - var hasFocus = cm.hasFocus(); info.wrapper.appendChild(wrap); + cm.scrollTo(scrollPos.left, scrollPos.top) if (hasFocus) cm.focus(); cm._setSize = cm.setSize; @@ -114,8 +115,11 @@ var info = cm.state.panels; cm.state.panels = null; - var wrap = cm.getWrapperElement(); + var wrap = cm.getWrapperElement() + var hasFocus = cm.hasFocus(), scrollPos = cm.getScrollInfo() info.wrapper.parentNode.replaceChild(wrap, info.wrapper); + cm.scrollTo(scrollPos.left, scrollPos.top) + if (hasFocus) cm.focus(); wrap.style.height = info.setHeight; cm.setSize = cm._setSize; cm.setSize(); diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/display/placeholder.js b/Mod manager/utils/QNModManager/CodeMirror/addon/display/placeholder.js index 4eabe3d9..cfb8341d 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/display/placeholder.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/display/placeholder.js @@ -15,11 +15,13 @@ cm.on("blur", onBlur); cm.on("change", onChange); cm.on("swapDoc", onChange); + CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() { onComposition(cm) }) onChange(cm); } else if (!val && prev) { cm.off("blur", onBlur); cm.off("change", onChange); cm.off("swapDoc", onChange); + CodeMirror.off(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose) clearPlaceholder(cm); var wrapper = cm.getWrapperElement(); wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); @@ -46,6 +48,19 @@ cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); } + function onComposition(cm) { + setTimeout(function() { + var empty = false + if (cm.lineCount() == 1) { + var input = cm.getInputField() + empty = input.nodeName == "TEXTAREA" ? !cm.getLine(0).length + : !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent) + } + if (empty) setPlaceholder(cm) + else clearPlaceholder(cm) + }, 20) + } + function onBlur(cm) { if (isEmpty(cm)) setPlaceholder(cm); } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closebrackets.js b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closebrackets.js index 4415c393..593d4439 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closebrackets.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closebrackets.js @@ -87,7 +87,7 @@ cm.operation(function() { var linesep = cm.lineSeparator() || "\n"; cm.replaceSelection(linesep + linesep, null); - cm.execCommand("goCharLeft"); + moveSel(cm, -1) ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { var line = ranges[i].head.line; @@ -97,6 +97,17 @@ }); } + function moveSel(cm, dir) { + var newRanges = [], ranges = cm.listSelections(), primary = 0 + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i] + if (range.head == cm.getCursor()) primary = i + var pos = range.head.ch || dir > 0 ? {line: range.head.line, ch: range.head.ch + dir} : {line: range.head.line - 1} + newRanges.push({anchor: pos, head: pos}) + } + cm.setSelections(newRanges, primary) + } + function contractSelection(sel) { var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0; return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)), @@ -153,10 +164,9 @@ var right = pos % 2 ? ch : pairs.charAt(pos + 1); cm.operation(function() { if (type == "skip") { - cm.execCommand("goCharRight"); + moveSel(cm, 1) } else if (type == "skipThree") { - for (var i = 0; i < 3; i++) - cm.execCommand("goCharRight"); + moveSel(cm, 3) } else if (type == "surround") { var sels = cm.getSelections(); for (var i = 0; i < sels.length; i++) @@ -169,10 +179,10 @@ } else if (type == "both") { cm.replaceSelection(left + right, null); cm.triggerElectric(left + right); - cm.execCommand("goCharLeft"); + moveSel(cm, -1) } else if (type == "addFour") { cm.replaceSelection(left + left + left + left, "before"); - cm.execCommand("goCharRight"); + moveSel(cm, 1) } }); } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closetag.js b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closetag.js index 8689765e..7c22a50e 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closetag.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/closetag.js @@ -128,9 +128,10 @@ replacement = head + "style"; } else { var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) - if (!context || (context.length && closingTagExists(cm, context, context[context.length - 1], pos))) + var top = context.length ? context[context.length - 1] : "" + if (!context || (context.length && closingTagExists(cm, context, top, pos))) return CodeMirror.Pass; - replacement = head + context[context.length - 1] + replacement = head + top } if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">"; replacements[i] = replacement; diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/continuelist.js b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/continuelist.js index 2e5625ad..d8b2e0e1 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/continuelist.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/continuelist.js @@ -24,7 +24,7 @@ // If we're not in Markdown mode, fall back to normal newlineAndIndent var eolState = cm.getStateAfter(pos.line); var inner = CodeMirror.innerMode(cm.getMode(), eolState); - if (inner.mode.name !== "markdown") { + if (inner.mode.name !== "markdown" && inner.mode.helperType !== "markdown") { cm.execCommand("newlineAndIndent"); return; } else { @@ -90,7 +90,7 @@ }); } else { if (startIndent.length > nextIndent.length) return; - // This doesn't run if the next line immediatley indents, as it is + // This doesn't run if the next line immediately indents, as it is // not clear of the users intention (new indented item or same level) if ((startIndent.length < nextIndent.length) && (lookAhead === 1)) return; skipCount += 1; diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/matchbrackets.js b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/matchbrackets.js index 2c47e070..43dc8840 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/edit/matchbrackets.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/edit/matchbrackets.js @@ -38,7 +38,7 @@ if (config && config.strict && (dir > 0) != (pos == where.ch)) return null; var style = cm.getTokenTypeAt(Pos(where.line, pos + 1)); - var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config); + var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style, config); if (found == null) return null; return {from: Pos(where.line, pos), to: found && found.pos, match: found && found.ch == match.charAt(0), forward: dir > 0}; @@ -67,7 +67,8 @@ if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0); for (; pos != end; pos += dir) { var ch = line.charAt(pos); - if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) { + if (re.test(ch) && (style === undefined || + (cm.getTokenTypeAt(Pos(lineNo, pos + 1)) || "") == (style || ""))) { var match = matching[ch]; if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch); else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch}; @@ -80,11 +81,12 @@ function matchBrackets(cm, autoclear, config) { // Disable brace matching in long lines, since it'll cause hugely slow updates - var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; + var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000, + highlightNonMatching = config && config.highlightNonMatching; var marks = [], ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config); - if (match && cm.getLine(match.from.line).length <= maxHighlightLen) { + if (match && (match.match || highlightNonMatching !== false) && cm.getLine(match.from.line).length <= maxHighlightLen) { var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style})); if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) @@ -94,7 +96,7 @@ if (marks.length) { // Kludge to work around the IE bug from issue #1193, where text - // input stops going to the textare whever this fires. + // input stops going to the textarea whenever this fires. if (ie_lt8 && cm.state.focused) cm.focus(); var clear = function() { @@ -117,25 +119,25 @@ }); } - CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { - function clear(cm) { - if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) { - cm.state.matchBrackets.currentlyHighlighted(); - cm.state.matchBrackets.currentlyHighlighted = null; - } + function clearHighlighted(cm) { + if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) { + cm.state.matchBrackets.currentlyHighlighted(); + cm.state.matchBrackets.currentlyHighlighted = null; } + } + CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { if (old && old != CodeMirror.Init) { cm.off("cursorActivity", doMatchBrackets); cm.off("focus", doMatchBrackets) - cm.off("blur", clear) - clear(cm); + cm.off("blur", clearHighlighted) + clearHighlighted(cm); } if (val) { cm.state.matchBrackets = typeof val == "object" ? val : {}; cm.on("cursorActivity", doMatchBrackets); cm.on("focus", doMatchBrackets) - cm.on("blur", clear) + cm.on("blur", clearHighlighted) } }); diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/fold/brace-fold.js b/Mod manager/utils/QNModManager/CodeMirror/addon/fold/brace-fold.js index 654d1fb6..28cb093f 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/fold/brace-fold.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/fold/brace-fold.js @@ -11,53 +11,67 @@ })(function(CodeMirror) { "use strict"; -CodeMirror.registerHelper("fold", "brace", function(cm, start) { - var line = start.line, lineText = cm.getLine(line); - var tokenType; +function bracketFolding(pairs) { + return function(cm, start) { + var line = start.line, lineText = cm.getLine(line); - function findOpening(openCh) { - for (var at = start.ch, pass = 0;;) { - var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1); - if (found == -1) { - if (pass == 1) break; - pass = 1; - at = lineText.length; - continue; + function findOpening(pair) { + var tokenType; + for (var at = start.ch, pass = 0;;) { + var found = at <= 0 ? -1 : lineText.lastIndexOf(pair[0], at - 1); + if (found == -1) { + if (pass == 1) break; + pass = 1; + at = lineText.length; + continue; + } + if (pass == 1 && found < start.ch) break; + tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); + if (!/^(comment|string)/.test(tokenType)) return {ch: found + 1, tokenType: tokenType, pair: pair}; + at = found - 1; } - if (pass == 1 && found < start.ch) break; - tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)); - if (!/^(comment|string)/.test(tokenType)) return found + 1; - at = found - 1; } - } - - var startToken = "{", endToken = "}", startCh = findOpening("{"); - if (startCh == null) { - startToken = "[", endToken = "]"; - startCh = findOpening("["); - } - if (startCh == null) return; - var count = 1, lastLine = cm.lastLine(), end, endCh; - outer: for (var i = line; i <= lastLine; ++i) { - var text = cm.getLine(i), pos = i == line ? startCh : 0; - for (;;) { - var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); - if (nextOpen < 0) nextOpen = text.length; - if (nextClose < 0) nextClose = text.length; - pos = Math.min(nextOpen, nextClose); - if (pos == text.length) break; - if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) { - if (pos == nextOpen) ++count; - else if (!--count) { end = i; endCh = pos; break outer; } + function findRange(found) { + var count = 1, lastLine = cm.lastLine(), end, startCh = found.ch, endCh + outer: for (var i = line; i <= lastLine; ++i) { + var text = cm.getLine(i), pos = i == line ? startCh : 0; + for (;;) { + var nextOpen = text.indexOf(found.pair[0], pos), nextClose = text.indexOf(found.pair[1], pos); + if (nextOpen < 0) nextOpen = text.length; + if (nextClose < 0) nextClose = text.length; + pos = Math.min(nextOpen, nextClose); + if (pos == text.length) break; + if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == found.tokenType) { + if (pos == nextOpen) ++count; + else if (!--count) { end = i; endCh = pos; break outer; } + } + ++pos; + } } - ++pos; + + if (end == null || line == end) return null + return {from: CodeMirror.Pos(line, startCh), + to: CodeMirror.Pos(end, endCh)}; + } + + var found = [] + for (var i = 0; i < pairs.length; i++) { + var open = findOpening(pairs[i]) + if (open) found.push(open) + } + found.sort(function(a, b) { return a.ch - b.ch }) + for (var i = 0; i < found.length; i++) { + var range = findRange(found[i]) + if (range) return range } + return null } - if (end == null || line == end) return; - return {from: CodeMirror.Pos(line, startCh), - to: CodeMirror.Pos(end, endCh)}; -}); +} + +CodeMirror.registerHelper("fold", "brace", bracketFolding([["{", "}"], ["[", "]"]])); + +CodeMirror.registerHelper("fold", "brace-paren", bracketFolding([["{", "}"], ["[", "]"], ["(", ")"]])); CodeMirror.registerHelper("fold", "import", function(cm, start) { function hasImport(line) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/fold/foldcode.js b/Mod manager/utils/QNModManager/CodeMirror/addon/fold/foldcode.js index 887df3fe..721bc087 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/fold/foldcode.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/fold/foldcode.js @@ -24,9 +24,11 @@ function getRange(allowFolded) { var range = finder(cm, pos); if (!range || range.to.line - range.from.line < minSize) return null; + if (force === "fold") return range; + var marks = cm.findMarksAt(range.from); for (var i = 0; i < marks.length; ++i) { - if (marks[i].__isFold && force !== "fold") { + if (marks[i].__isFold) { if (!allowFolded) return null; range.cleared = true; marks[i].clear(); @@ -99,18 +101,18 @@ cm.foldCode(cm.getCursor(), null, "fold"); }; CodeMirror.commands.unfold = function(cm) { - cm.foldCode(cm.getCursor(), null, "unfold"); + cm.foldCode(cm.getCursor(), { scanUp: false }, "unfold"); }; CodeMirror.commands.foldAll = function(cm) { cm.operation(function() { for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); + cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "fold"); }); }; CodeMirror.commands.unfoldAll = function(cm) { cm.operation(function() { for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); + cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "unfold"); }); }; diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/html-hint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/html-hint.js index d0cca4f6..9878eca6 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/html-hint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/html-hint.js @@ -98,6 +98,7 @@ dfn: s, dir: s, div: s, + dialog: { attrs: { open: null } }, dl: s, dt: s, em: s, diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/javascript-hint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/javascript-hint.js index 6d09e6b4..9f06b1b5 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/javascript-hint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/javascript-hint.js @@ -69,7 +69,7 @@ function getCoffeeScriptToken(editor, cur) { // This getToken, it is for coffeescript, imitates the behavior of // getTokenAt method in javascript.js, that is, returning "property" - // type and treat "." as indepenent token. + // type and treat "." as independent token. var token = editor.getTokenAt(cur); if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') { token.end = token.start; diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/show-hint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/show-hint.js index cd0d6a7b..2be2c716 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/show-hint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/show-hint.js @@ -1,6 +1,8 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE +// declare global: DOMRect + (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); @@ -59,8 +61,10 @@ this.startPos = this.cm.getCursor("start"); this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length; - var self = this; - cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); }); + if (this.options.updateOnCursorActivity) { + var self = this; + cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); }); + } } var requestAnimationFrame = window.requestAnimationFrame || function(fn) { @@ -73,7 +77,9 @@ if (!this.active()) return; this.cm.state.completionActive = null; this.tick = null; - this.cm.off("cursorActivity", this.activityFunc); + if (this.options.updateOnCursorActivity) { + this.cm.off("cursorActivity", this.activityFunc); + } if (this.widget && this.data) CodeMirror.signal(this.data, "close"); if (this.widget) this.widget.close(); @@ -94,8 +100,10 @@ completion.to || data.to, "complete"); CodeMirror.signal(data, "pick", completion); self.cm.scrollIntoView(); - }) - this.close(); + }); + if (this.options.closeOnPick) { + this.close(); + } }, cursorActivity: function() { @@ -216,6 +224,7 @@ } function Widget(completion, data) { + this.id = "cm-complete-" + Math.floor(Math.random(1e6)) this.completion = completion; this.data = data; this.picked = false; @@ -224,6 +233,9 @@ var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow; var hints = this.hints = ownerDocument.createElement("ul"); + hints.setAttribute("role", "listbox") + hints.setAttribute("aria-expanded", "true") + hints.id = this.id var theme = completion.cm.options.theme; hints.className = "CodeMirror-hints " + theme; this.selectedHint = data.selectedHint || 0; @@ -234,6 +246,9 @@ var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); if (cur.className != null) className = cur.className + " " + className; elt.className = className; + if (i == this.selectedHint) elt.setAttribute("aria-selected", "true") + elt.id = this.id + "-" + i + elt.setAttribute("role", "option") if (cur.render) cur.render(elt, data, cur); else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur))); elt.hintId = i; @@ -259,10 +274,18 @@ var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth); var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight); container.appendChild(hints); - var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH; - var scrolls = hints.scrollHeight > hints.clientHeight + 1 - var startScroll = cm.getScrollInfo(); + cm.getInputField().setAttribute("aria-autocomplete", "list") + cm.getInputField().setAttribute("aria-owns", this.id) + cm.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint) + + var box = completion.options.moveOnOverlap ? hints.getBoundingClientRect() : new DOMRect(); + var scrolls = completion.options.paddingForScrollbar ? hints.scrollHeight > hints.clientHeight + 1 : false; + + // Compute in the timeout to avoid reflow on init + var startScroll; + setTimeout(function() { startScroll = cm.getScrollInfo(); }); + var overlapY = box.bottom - winH; if (overlapY > 0) { var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top); if (curTop - height > 0) { // Fits above cursor @@ -280,6 +303,7 @@ } } var overlapX = box.right - winW; + if (scrolls) overlapX += cm.display.nativeBarWidth; if (overlapX > 0) { if (box.right - box.left > winW) { hints.style.width = (winW - 5) + "px"; @@ -308,6 +332,7 @@ cm.on("scroll", this.onScroll = function() { var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect(); + if (!startScroll) startScroll = cm.getScrollInfo(); var newTop = top + startScroll.top - curScroll.top; var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop); if (!below) point += hints.offsetHeight; @@ -332,7 +357,12 @@ CodeMirror.on(hints, "mousedown", function() { setTimeout(function(){cm.focus();}, 20); }); - this.scrollToActive() + + // The first hint doesn't need to be scrolled to on init + var selectedHintRange = this.getSelectedHintRange(); + if (selectedHintRange.from !== 0 || selectedHintRange.to !== 0) { + this.scrollToActive(); + } CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]); return true; @@ -342,8 +372,11 @@ close: function() { if (this.completion.widget != this) return; this.completion.widget = null; - this.hints.parentNode.removeChild(this.hints); + if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints); this.completion.cm.removeKeyMap(this.keyMap); + var input = this.completion.cm.getInputField() + input.removeAttribute("aria-activedescendant") + input.removeAttribute("aria-owns") var cm = this.completion.cm; if (this.completion.options.closeOnUnfocus) { @@ -371,17 +404,22 @@ i = avoidWrap ? 0 : this.data.list.length - 1; if (this.selectedHint == i) return; var node = this.hints.childNodes[this.selectedHint]; - if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + if (node) { + node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + node.removeAttribute("aria-selected") + } node = this.hints.childNodes[this.selectedHint = i]; node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; + node.setAttribute("aria-selected", "true") + this.completion.cm.getInputField().setAttribute("aria-activedescendant", node.id) this.scrollToActive() CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); }, scrollToActive: function() { - var margin = this.completion.options.scrollMargin || 0; - var node1 = this.hints.childNodes[Math.max(0, this.selectedHint - margin)]; - var node2 = this.hints.childNodes[Math.min(this.data.list.length - 1, this.selectedHint + margin)]; + var selectedHintRange = this.getSelectedHintRange(); + var node1 = this.hints.childNodes[selectedHintRange.from]; + var node2 = this.hints.childNodes[selectedHintRange.to]; var firstNode = this.hints.firstChild; if (node1.offsetTop < this.hints.scrollTop) this.hints.scrollTop = node1.offsetTop - firstNode.offsetTop; @@ -391,6 +429,14 @@ screenAmount: function() { return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1; + }, + + getSelectedHintRange: function() { + var margin = this.completion.options.scrollMargin || 0; + return { + from: Math.max(0, this.selectedHint - margin), + to: Math.min(this.data.list.length - 1, this.selectedHint + margin), + }; } }; @@ -468,11 +514,15 @@ completeSingle: true, alignWithWord: true, closeCharacters: /[\s()\[\]{};:>,]/, + closeOnPick: true, closeOnUnfocus: true, + updateOnCursorActivity: true, completeOnSingleClick: true, container: null, customKeys: null, - extraKeys: null + extraKeys: null, + paddingForScrollbar: true, + moveOnOverlap: true, }; CodeMirror.defineOption("hintOptions", null); diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/sql-hint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/sql-hint.js index de84707d..efdce813 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/sql-hint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/sql-hint.js @@ -97,7 +97,7 @@ if (name.charAt(0) == ".") { name = name.substr(1); } - // replace doublicated identifierQuotes with single identifierQuotes + // replace duplicated identifierQuotes with single identifierQuotes // and remove single identifierQuotes var nameParts = name.split(identifierQuote+identifierQuote); for (var i = 0; i < nameParts.length; i++) @@ -109,7 +109,7 @@ var nameParts = getText(name).split("."); for (var i = 0; i < nameParts.length; i++) nameParts[i] = identifierQuote + - // doublicate identifierQuotes + // duplicate identifierQuotes nameParts[i].replace(new RegExp(identifierQuote,"g"), identifierQuote+identifierQuote) + identifierQuote; var escaped = nameParts.join("."); @@ -187,7 +187,7 @@ function eachWord(lineText, f) { var words = lineText.split(/\s+/) for (var i = 0; i < words.length; i++) - if (words[i]) f(words[i].replace(/[,;]/g, '')) + if (words[i]) f(words[i].replace(/[`,;]/g, '')) } function findTableByAlias(alias, editor) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/xml-hint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/xml-hint.js index 543d19b6..2b315312 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/hint/xml-hint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/hint/xml-hint.js @@ -101,12 +101,12 @@ } replaceToken = true; } - function returnHintsFromAtValues(atValues) { + var returnHintsFromAtValues = function(atValues) { if (atValues) for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle)) result.push(quote + atValues[i] + quote); return returnHints(); - } + }; if (atValues && atValues.then) return atValues.then(returnHintsFromAtValues); return returnHintsFromAtValues(atValues); } else { // An attribute name diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/lint/javascript-lint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/lint/javascript-lint.js index cc132d7f..e5bc7523 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/lint/javascript-lint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/lint/javascript-lint.js @@ -1,6 +1,8 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE +// Depends on jshint.js from https://github.com/jshint/jshint + (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror")); diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.css b/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.css index f097cfe3..e1560db9 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.css +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.css @@ -25,22 +25,20 @@ -ms-transition: opacity .4s; } -.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { +.CodeMirror-lint-mark { background-position: left bottom; background-repeat: repeat-x; } -.CodeMirror-lint-mark-error { - background-image: - url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==") - ; -} - .CodeMirror-lint-mark-warning { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); } -.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { +.CodeMirror-lint-mark-error { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg=="); +} + +.CodeMirror-lint-marker { background-position: center center; background-repeat: no-repeat; cursor: pointer; @@ -51,23 +49,31 @@ position: relative; } -.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { +.CodeMirror-lint-message { padding-left: 18px; background-position: top left; background-repeat: no-repeat; } -.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { - background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); -} - .CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); } +.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); +} + .CodeMirror-lint-marker-multiple { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); background-repeat: no-repeat; background-position: right bottom; width: 100%; height: 100%; } + +.CodeMirror-lint-line-error { + background-color: rgba(183, 76, 81, 0.08); +} + +.CodeMirror-lint-line-warning { + background-color: rgba(255, 211, 0, 0.1); +} diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.js b/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.js index 5bc1af18..1613deb9 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/lint/lint.js @@ -11,6 +11,7 @@ })(function(CodeMirror) { "use strict"; var GUTTER_ID = "CodeMirror-lint-markers"; + var LINT_LINE_ID = "CodeMirror-lint-line-"; function showTooltip(cm, e, content) { var tt = document.createElement("div"); @@ -58,35 +59,60 @@ CodeMirror.on(node, "mouseout", hide); } - function LintState(cm, options, hasGutter) { + function LintState(cm, conf, hasGutter) { this.marked = []; - this.options = options; + if (conf instanceof Function) conf = {getAnnotations: conf}; + if (!conf || conf === true) conf = {}; + this.options = {}; + this.linterOptions = conf.options || {}; + for (var prop in defaults) this.options[prop] = defaults[prop]; + for (var prop in conf) { + if (defaults.hasOwnProperty(prop)) { + if (conf[prop] != null) this.options[prop] = conf[prop]; + } else if (!conf.options) { + this.linterOptions[prop] = conf[prop]; + } + } this.timeout = null; this.hasGutter = hasGutter; this.onMouseOver = function(e) { onMouseOver(cm, e); }; this.waitingFor = 0 } - function parseOptions(_cm, options) { - if (options instanceof Function) return {getAnnotations: options}; - if (!options || options === true) options = {}; - return options; + var defaults = { + highlightLines: false, + tooltips: true, + delay: 500, + lintOnChange: true, + getAnnotations: null, + async: false, + selfContain: null, + formatAnnotation: null, + onUpdateLinting: null } function clearMarks(cm) { var state = cm.state.lint; if (state.hasGutter) cm.clearGutter(GUTTER_ID); + if (state.options.highlightLines) clearErrorLines(cm); for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear(); state.marked.length = 0; } + function clearErrorLines(cm) { + cm.eachLine(function(line) { + var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass); + if (has) cm.removeLineClass(line, "wrap", has[0]); + }) + } + function makeMarker(cm, labels, severity, multiple, tooltips) { var marker = document.createElement("div"), inner = marker; - marker.className = "CodeMirror-lint-marker-" + severity; + marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity; if (multiple) { inner = marker.appendChild(document.createElement("div")); - inner.className = "CodeMirror-lint-marker-multiple"; + inner.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple"; } if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) { @@ -114,7 +140,7 @@ var severity = ann.severity; if (!severity) severity = "error"; var tip = document.createElement("div"); - tip.className = "CodeMirror-lint-message-" + severity; + tip.className = "CodeMirror-lint-message CodeMirror-lint-message-" + severity; if (typeof ann.messageHTML != 'undefined') { tip.innerHTML = ann.messageHTML; } else { @@ -123,7 +149,7 @@ return tip; } - function lintAsync(cm, getAnnotations, passOptions) { + function lintAsync(cm, getAnnotations) { var state = cm.state.lint var id = ++state.waitingFor function abort() { @@ -136,22 +162,23 @@ if (state.waitingFor != id) return if (arg2 && annotations instanceof CodeMirror) annotations = arg2 cm.operation(function() {updateLinting(cm, annotations)}) - }, passOptions, cm); + }, state.linterOptions, cm); } function startLinting(cm) { - var state = cm.state.lint, options = state.options; + var state = cm.state.lint; + if (!state) return; + var options = state.options; /* * Passing rules in `options` property prevents JSHint (and other linters) from complaining * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. */ - var passOptions = options.options || options; var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); if (!getAnnotations) return; if (options.async || getAnnotations.async) { - lintAsync(cm, getAnnotations, passOptions) + lintAsync(cm, getAnnotations) } else { - var annotations = getAnnotations(cm.getValue(), passOptions, cm); + var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm); if (!annotations) return; if (annotations.then) annotations.then(function(issues) { cm.operation(function() {updateLinting(cm, issues)}) @@ -161,8 +188,10 @@ } function updateLinting(cm, annotationsNotSorted) { + var state = cm.state.lint; + if (!state) return; + var options = state.options; clearMarks(cm); - var state = cm.state.lint, options = state.options; var annotations = groupByLine(annotationsNotSorted); @@ -170,6 +199,10 @@ var anns = annotations[line]; if (!anns) continue; + // filter out duplicate messages + var message = []; + anns = anns.filter(function(item) { return message.indexOf(item.message) > -1 ? false : message.push(item.message) }); + var maxSeverity = null; var tipLabel = state.hasGutter && document.createDocumentFragment(); @@ -183,14 +216,17 @@ if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann)); if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, { - className: "CodeMirror-lint-mark-" + severity, + className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + severity, __annotation: ann })); } - + // use original annotations[line] to show multiple messages if (state.hasGutter) - cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, anns.length > 1, - state.options.tooltips)); + cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1, + options.tooltips)); + + if (options.highlightLines) + cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity); } if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); } @@ -199,7 +235,7 @@ var state = cm.state.lint; if (!state) return; clearTimeout(state.timeout); - state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); + state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay); } function popupTooltips(cm, annotations, e) { @@ -239,8 +275,8 @@ if (val) { var gutters = cm.getOption("gutters"), hasLintGutter = false; for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true; - var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); - if (state.options.lintOnChange !== false) + var state = cm.state.lint = new LintState(cm, val, hasLintGutter); + if (state.options.lintOnChange) cm.on("change", onChange); if (state.options.tooltips != false && state.options.tooltips != "gutter") CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); @@ -250,6 +286,6 @@ }); CodeMirror.defineExtension("performLint", function() { - if (this.state.lint) startLinting(this); + startLinting(this); }); }); diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/merge/merge.js b/Mod manager/utils/QNModManager/CodeMirror/addon/merge/merge.js index 827edb71..7fd963f7 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/merge/merge.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/merge/merge.js @@ -508,6 +508,7 @@ copy.title = dv.edit.phrase(editOriginals ? "Push to left" : "Revert chunk"); copy.chunk = chunk; copy.style.top = (chunk.origTo > chunk.origFrom ? top : dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit) + "px"; + copy.setAttribute("role", "button"); if (editOriginals) { var topReverse = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit; @@ -518,6 +519,7 @@ origFrom: chunk.editFrom, origTo: chunk.editTo}; copyReverse.style.top = topReverse + "px"; dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px"; + copyReverse.setAttribute("role", "button"); } } } @@ -599,6 +601,7 @@ function buildGap(dv) { var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock"); + lock.setAttribute("role", "button"); var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap"); CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); }); var gapElts = [lockWrap]; diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex.js b/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex.js index 93fd9a5a..6140bc4f 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex.js @@ -12,7 +12,7 @@ "use strict"; CodeMirror.multiplexingMode = function(outer /*, others */) { - // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects + // Others should be {open, close, mode [, delimStyle] [, innerStyle] [, parseDelimiters]} objects var others = Array.prototype.slice.call(arguments, 1); function indexOf(string, pattern, from, returnEnd) { @@ -29,7 +29,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { return { outer: CodeMirror.startState(outer), innerActive: null, - inner: null + inner: null, + startingInner: false }; }, @@ -37,7 +38,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { return { outer: CodeMirror.copyState(outer, state.outer), innerActive: state.innerActive, - inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) + inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner), + startingInner: state.startingInner }; }, @@ -49,6 +51,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { var found = indexOf(oldContent, other.open, stream.pos); if (found == stream.pos) { if (!other.parseDelimiters) stream.match(other.open); + state.startingInner = !!other.parseDelimiters state.innerActive = other; // Get the outer indent, making sure to handle CodeMirror.Pass @@ -74,7 +77,8 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { state.innerActive = state.inner = null; return this.token(stream, state); } - var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1; + var found = curInner.close && !state.startingInner ? + indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1; if (found == stream.pos && !curInner.parseDelimiters) { stream.match(curInner.close); state.innerActive = state.inner = null; @@ -83,6 +87,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) { if (found > -1) stream.string = oldContent.slice(0, found); var innerToken = curInner.mode.token(stream, state.inner); if (found > -1) stream.string = oldContent; + else if (stream.pos > stream.start) state.startingInner = false if (found == stream.pos && curInner.parseDelimiters) state.innerActive = state.inner = null; diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex_test.js b/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex_test.js index c51cad45..85039886 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex_test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/mode/multiplex_test.js @@ -30,4 +30,20 @@ MT( "stexInsideMarkdown", "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]"); + + CodeMirror.defineMode("identical_delim_multiplex", function() { + return CodeMirror.multiplexingMode(CodeMirror.getMode({indentUnit: 2}, "javascript"), { + open: "#", + close: "#", + mode: CodeMirror.getMode({}, "markdown"), + parseDelimiters: true, + innerStyle: "q" + }); + }); + + var mode2 = CodeMirror.getMode({}, "identical_delim_multiplex"); + + test.mode("identical_delimiters_with_parseDelimiters", mode2, [ + "[keyword let] [def x] [operator =] [q #foo][q&em *bar*][q #];" + ], "multiplexing") })(); diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/mode/simple.js b/Mod manager/utils/QNModManager/CodeMirror/addon/mode/simple.js index 655f9914..0d8cbdeb 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/mode/simple.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/mode/simple.js @@ -68,6 +68,7 @@ var flags = ""; if (val instanceof RegExp) { if (val.ignoreCase) flags = "i"; + if (val.unicode) flags += "u" val = val.source; } else { val = String(val); @@ -137,10 +138,9 @@ var token = rule.token if (token && token.apply) token = token(matches) if (matches.length > 2 && rule.token && typeof rule.token != "string") { - state.pending = []; for (var j = 2; j < matches.length; j++) if (matches[j]) - state.pending.push({text: matches[j], token: rule.token[j - 1]}); + (state.pending || (state.pending = [])).push({text: matches[j], token: rule.token[j - 1]}); stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0)); return token[0]; } else if (token && token.join) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode-standalone.js b/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode-standalone.js index e71041c3..76cf3d75 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode-standalone.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode-standalone.js @@ -251,6 +251,7 @@ CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min; CodeMirror.splitLines = function(string) { return string.split(/\r?\n|\r/) }; + CodeMirror.countColumn = countColumn; CodeMirror.defaults = { indentUnit: 2 }; @@ -322,7 +323,7 @@ if (!stream.string && mode.blankLine) { mode.blankLine(state); } while (!stream.eol()) { var style = mode.token(stream, state); - callback(stream.current(), style, i, stream.start, state); + callback(stream.current(), style, i, stream.start, state, mode); stream.start = stream.pos; } } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.js b/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.js index 2cae6863..f5d58e24 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.js @@ -67,7 +67,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) { if (!stream.string && mode.blankLine) mode.blankLine(state); while (!stream.eol()) { var style = mode.token(stream, state); - callback(stream.current(), style, i, stream.start, state); + callback(stream.current(), style, i, stream.start, state, mode); stream.start = stream.pos; } } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.node.js b/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.node.js index 92cda61b..ddd255ab 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.node.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/runmode/runmode.node.js @@ -320,7 +320,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) { if (!stream.string && mode.blankLine) { mode.blankLine(state); } while (!stream.eol()) { var style = mode.token(stream, state); - callback(stream.current(), style, i, stream.start, state); + callback(stream.current(), style, i, stream.start, state, mode); stream.start = stream.pos; } } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/search/jump-to-line.js b/Mod manager/utils/QNModManager/CodeMirror/addon/search/jump-to-line.js index 1f3526d2..990c235e 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/search/jump-to-line.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/search/jump-to-line.js @@ -13,8 +13,11 @@ })(function(CodeMirror) { "use strict"; + // default search panel location + CodeMirror.defineOption("search", {bottom: false}); + function dialog(cm, text, shortText, deflt, f) { - if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true}); + if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true, bottom: cm.options.search.bottom}); else f(prompt(shortText, deflt)); } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/search/match-highlighter.js b/Mod manager/utils/QNModManager/CodeMirror/addon/search/match-highlighter.js index 3a4a7ded..9b181ebc 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/search/match-highlighter.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/search/match-highlighter.js @@ -16,7 +16,7 @@ // highlighted only if the selected text is a word. showToken, when enabled, // will cause the current token to be highlighted when nothing is selected. // delay is used to specify how much time to wait, in milliseconds, before -// highlighting the matches. If annotateScrollbar is enabled, the occurences +// highlighting the matches. If annotateScrollbar is enabled, the occurrences // will be highlighted on the scrollbar via the matchesonscrollbar addon. (function(mod) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/search/search.js b/Mod manager/utils/QNModManager/CodeMirror/addon/search/search.js index cecdd52e..24a0855e 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/search/search.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/search/search.js @@ -19,6 +19,9 @@ })(function(CodeMirror) { "use strict"; + // default search panel location + CodeMirror.defineOption("search", {bottom: false}); + function searchOverlay(query, caseInsensitive) { if (typeof query == "string") query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g"); @@ -63,12 +66,13 @@ selectValueOnOpen: true, closeOnEnter: false, onClose: function() { clearSearch(cm); }, - onKeyDown: onKeyDown + onKeyDown: onKeyDown, + bottom: cm.options.search.bottom }); } function dialog(cm, text, shortText, deflt, f) { - if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true}); + if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true, bottom: cm.options.search.bottom}); else f(prompt(shortText, deflt)); } @@ -185,18 +189,43 @@ if (state.annotate) { state.annotate.clear(); state.annotate = null; } });} + function el(tag, attrs) { + var element = tag ? document.createElement(tag) : document.createDocumentFragment(); + for (var key in attrs) { + element[key] = attrs[key]; + } + for (var i = 2; i < arguments.length; i++) { + var child = arguments[i] + element.appendChild(typeof child == "string" ? document.createTextNode(child) : child); + } + return element; + } function getQueryDialog(cm) { - return '' + cm.phrase("Search:") + ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; + return el("", null, + el("span", {className: "CodeMirror-search-label"}, cm.phrase("Search:")), " ", + el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ", + el("span", {style: "color: #888", className: "CodeMirror-search-hint"}, + cm.phrase("(Use /re/ syntax for regexp search)"))); } function getReplaceQueryDialog(cm) { - return ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; + return el("", null, " ", + el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ", + el("span", {style: "color: #888", className: "CodeMirror-search-hint"}, + cm.phrase("(Use /re/ syntax for regexp search)"))); } function getReplacementQueryDialog(cm) { - return '' + cm.phrase("With:") + ' '; + return el("", null, + el("span", {className: "CodeMirror-search-label"}, cm.phrase("With:")), " ", + el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"})); } function getDoReplaceConfirm(cm) { - return '' + cm.phrase("Replace?") + ' '; + return el("", null, + el("span", {className: "CodeMirror-search-label"}, cm.phrase("Replace?")), " ", + el("button", {}, cm.phrase("Yes")), " ", + el("button", {}, cm.phrase("No")), " ", + el("button", {}, cm.phrase("All")), " ", + el("button", {}, cm.phrase("Stop"))); } function replaceAll(cm, query, text) { @@ -213,8 +242,11 @@ function replace(cm, all) { if (cm.getOption("readOnly")) return; var query = cm.getSelection() || getSearchState(cm).lastQuery; - var dialogText = '' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + ''; - dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) { + var dialogText = all ? cm.phrase("Replace all:") : cm.phrase("Replace:") + var fragment = el("", null, + el("span", {className: "CodeMirror-search-label"}, dialogText), + getReplaceQueryDialog(cm)) + dialog(cm, fragment, dialogText, query, function(query) { if (!query) return; query = parseQuery(query); dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/search/searchcursor.js b/Mod manager/utils/QNModManager/CodeMirror/addon/search/searchcursor.js index d5869578..230017b7 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/search/searchcursor.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/search/searchcursor.js @@ -202,6 +202,7 @@ function SearchCursor(doc, query, pos, options) { this.atOccurrence = false + this.afterEmptyMatch = false this.doc = doc pos = pos ? doc.clipPos(pos) : Pos(0, 0) this.pos = {from: pos, to: pos} @@ -237,21 +238,29 @@ findPrevious: function() {return this.find(true)}, find: function(reverse) { - var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to)) - - // Implements weird auto-growing behavior on null-matches for - // backwards-compatibility with the vim code (unfortunately) - while (result && CodeMirror.cmpPos(result.from, result.to) == 0) { + var head = this.doc.clipPos(reverse ? this.pos.from : this.pos.to); + if (this.afterEmptyMatch && this.atOccurrence) { + // do not return the same 0 width match twice + head = Pos(head.line, head.ch) if (reverse) { - if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1) - else if (result.from.line == this.doc.firstLine()) result = null - else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1))) + head.ch--; + if (head.ch < 0) { + head.line--; + head.ch = (this.doc.getLine(head.line) || "").length; + } } else { - if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1) - else if (result.to.line == this.doc.lastLine()) result = null - else result = this.matches(reverse, Pos(result.to.line + 1, 0)) + head.ch++; + if (head.ch > (this.doc.getLine(head.line) || "").length) { + head.ch = 0; + head.line++; + } + } + if (CodeMirror.cmpPos(head, this.doc.clipPos(head)) != 0) { + return this.atOccurrence = false } } + var result = this.matches(reverse, head) + this.afterEmptyMatch = result && CodeMirror.cmpPos(result.from, result.to) == 0 if (result) { this.pos = result diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/tern/tern.js b/Mod manager/utils/QNModManager/CodeMirror/addon/tern/tern.js index 7be36818..a8837174 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/tern/tern.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/tern/tern.js @@ -231,8 +231,7 @@ var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc; if (content) { tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset, - node.getBoundingClientRect().top + window.pageYOffset, content, cm); - tooltip.className += " " + cls + "hint-doc"; + node.getBoundingClientRect().top + window.pageYOffset, content, cm, cls + "hint-doc"); } }); c(obj); @@ -637,12 +636,44 @@ } } - function makeTooltip(x, y, content, cm) { - var node = elt("div", cls + "tooltip", content); + function makeTooltip(x, y, content, cm, className) { + var node = elt("div", cls + "tooltip" + " " + (className || ""), content); node.style.left = x + "px"; node.style.top = y + "px"; var container = ((cm.options || {}).hintOptions || {}).container || document.body; container.appendChild(node); + + var pos = cm.cursorCoords(); + var winW = window.innerWidth; + var winH = window.innerHeight; + var box = node.getBoundingClientRect(); + var hints = document.querySelector(".CodeMirror-hints"); + var overlapY = box.bottom - winH; + var overlapX = box.right - winW; + + if (hints && overlapX > 0) { + node.style.left = 0; + var box = node.getBoundingClientRect(); + node.style.left = (x = x - hints.offsetWidth - box.width) + "px"; + overlapX = box.right - winW; + } + if (overlapY > 0) { + var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top); + if (curTop - height > 0) { // Fits above cursor + node.style.top = (pos.top - height) + "px"; + } else if (height > winH) { + node.style.height = (winH - 5) + "px"; + node.style.top = (pos.bottom - box.top) + "px"; + } + } + if (overlapX > 0) { + if (box.right - box.left > winW) { + node.style.width = (winW - 5) + "px"; + overlapX -= (box.right - box.left) - winW; + } + node.style.left = (x - overlapX) + "px"; + } + return node; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/addon/wrap/hardwrap.js b/Mod manager/utils/QNModManager/CodeMirror/addon/wrap/hardwrap.js index f194946c..516368c8 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/addon/wrap/hardwrap.js +++ b/Mod manager/utils/QNModManager/CodeMirror/addon/wrap/hardwrap.js @@ -35,7 +35,7 @@ for (; at > 0; --at) if (wrapOn.test(text.slice(at - 1, at + 1))) break; - if (at == 0 && !forceBreak) { + if (!forceBreak && at <= text.match(/^[ \t]*/)[0].length) { // didn't find a break point before column, in non-forceBreak mode try to // find one after 'column'. for (at = column + 1; at < text.length - 1; ++at) { @@ -91,7 +91,8 @@ } while (curLine.length > column) { var bp = findBreakPoint(curLine, column, wrapOn, killTrailing, forceBreak); - if (bp.from != bp.to || forceBreak) { + if (bp.from != bp.to || + forceBreak && leadingSpace !== curLine.slice(0, bp.to)) { changes.push({text: ["", leadingSpace], from: Pos(curNo, bp.from), to: Pos(curNo, bp.to)}); diff --git a/Mod manager/utils/QNModManager/CodeMirror/demo/anywordhint.html b/Mod manager/utils/QNModManager/CodeMirror/demo/anywordhint.html index 471b5bde..57df9a36 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/demo/anywordhint.html +++ b/Mod manager/utils/QNModManager/CodeMirror/demo/anywordhint.html @@ -8,7 +8,7 @@ - +
- Get the current version: 5.57.0.
- You can see the code,
+ Get the current version: 5.65.2.
+ You can see the code,
read the release notes,
or study the user manual.
@@ -192,16 +195,28 @@

Browser support

Sponsors

These companies support development of this project:

diff --git a/Mod manager/utils/QNModManager/CodeMirror/keymap/emacs.js b/Mod manager/utils/QNModManager/CodeMirror/keymap/emacs.js index fe4882eb..9e7ae60f 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/keymap/emacs.js +++ b/Mod manager/utils/QNModManager/CodeMirror/keymap/emacs.js @@ -11,6 +11,7 @@ })(function(CodeMirror) { "use strict"; + var cmds = CodeMirror.commands; var Pos = CodeMirror.Pos; function posEq(a, b) { return a.line == b.line && a.ch == b.ch; } @@ -30,7 +31,8 @@ var lastKill = null; - function kill(cm, from, to, ring, text) { + // Internal generic kill function, used by several mapped kill "family" functions. + function _kill(cm, from, to, ring, text) { if (text == null) text = cm.getRange(from, to); if (ring == "grow" && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen)) @@ -156,17 +158,17 @@ var i = selections.length; while (i--) { cursor = selections[i].head; - kill(cm, cursor, findEnd(cm, cursor, by, dir), ring); + _kill(cm, cursor, findEnd(cm, cursor, by, dir), ring); } } - function killRegion(cm, ring) { + function _killRegion(cm, ring) { if (cm.somethingSelected()) { var selections = cm.listSelections(), selection; var i = selections.length; while (i--) { selection = selections[i]; - kill(cm, selection.anchor, selection.head, ring); + _kill(cm, selection.anchor, selection.head, ring); } return true; } @@ -205,13 +207,6 @@ } } - function addPrefixMap(cm) { - cm.state.emacsPrefixMap = true; - cm.addKeyMap(prefixMap); - cm.on("keyHandled", maybeRemovePrefixMap); - cm.on("inputRead", maybeRemovePrefixMap); - } - function maybeRemovePrefixMap(cm, arg) { if (typeof arg == "string" && (/^\d$/.test(arg) || arg == "Ctrl-U")) return; cm.removeKeyMap(prefixMap); @@ -222,7 +217,7 @@ // Utilities - function setMark(cm) { + cmds.setMark = function (cm) { cm.setCursor(cm.getCursor()); cm.setExtending(!cm.getExtending()); cm.on("change", function() { cm.setExtending(false); }); @@ -233,9 +228,19 @@ cm.setCursor(cm.getCursor()); } + function makePrompt(msg) { + var fragment = document.createDocumentFragment(); + var input = document.createElement("input"); + input.setAttribute("type", "text"); + input.style.width = "10em"; + fragment.appendChild(document.createTextNode(msg + ": ")); + fragment.appendChild(input); + return fragment; + } + function getInput(cm, msg, f) { if (cm.openDialog) - cm.openDialog(msg + ": ", f, {bottom: true}); + cm.openDialog(makePrompt(msg), f, {bottom: true}); else f(prompt(msg, "")); } @@ -266,145 +271,266 @@ } } - function quit(cm) { + // Commands. Names should match emacs function names (albeit in camelCase) + // except where emacs function names collide with code mirror core commands. + + cmds.killRegion = function(cm) { + _kill(cm, cm.getCursor("start"), cm.getCursor("end"), true); + }; + + // Maps to emacs kill-line + cmds.killLineEmacs = repeated(function(cm) { + var start = cm.getCursor(), end = cm.clipPos(Pos(start.line)); + var text = cm.getRange(start, end); + if (!/\S/.test(text)) { + text += "\n"; + end = Pos(start.line + 1, 0); + } + _kill(cm, start, end, "grow", text); + }); + + cmds.killRingSave = function(cm) { + addToRing(cm.getSelection()); + clearMark(cm); + }; + + cmds.yank = function(cm) { + var start = cm.getCursor(); + cm.replaceRange(getFromRing(getPrefix(cm)), start, start, "paste"); + cm.setSelection(start, cm.getCursor()); + }; + + cmds.yankPop = function(cm) { + cm.replaceSelection(popFromRing(), "around", "paste"); + }; + + cmds.forwardChar = move(byChar, 1); + + cmds.backwardChar = move(byChar, -1) + + cmds.deleteChar = function(cm) { killTo(cm, byChar, 1, false); }; + + cmds.deleteForwardChar = function(cm) { + _killRegion(cm, false) || killTo(cm, byChar, 1, false); + }; + + cmds.deleteBackwardChar = function(cm) { + _killRegion(cm, false) || killTo(cm, byChar, -1, false); + }; + + cmds.forwardWord = move(byWord, 1); + + cmds.backwardWord = move(byWord, -1); + + cmds.killWord = function(cm) { killTo(cm, byWord, 1, "grow"); }; + + cmds.backwardKillWord = function(cm) { killTo(cm, byWord, -1, "grow"); }; + + cmds.nextLine = move(byLine, 1); + + cmds.previousLine = move(byLine, -1); + + cmds.scrollDownCommand = move(byPage, -1); + + cmds.scrollUpCommand = move(byPage, 1); + + cmds.backwardParagraph = move(byParagraph, -1); + + cmds.forwardParagraph = move(byParagraph, 1); + + cmds.backwardSentence = move(bySentence, -1); + + cmds.forwardSentence = move(bySentence, 1); + + cmds.killSentence = function(cm) { killTo(cm, bySentence, 1, "grow"); }; + + cmds.backwardKillSentence = function(cm) { + _kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), "grow"); + }; + + cmds.killSexp = function(cm) { killTo(cm, byExpr, 1, "grow"); }; + + cmds.backwardKillSexp = function(cm) { killTo(cm, byExpr, -1, "grow"); }; + + cmds.forwardSexp = move(byExpr, 1); + + cmds.backwardSexp = move(byExpr, -1); + + cmds.markSexp = function(cm) { + var cursor = cm.getCursor(); + cm.setSelection(findEnd(cm, cursor, byExpr, 1), cursor); + }; + + cmds.transposeSexps = function(cm) { + var leftStart = byExpr(cm, cm.getCursor(), -1); + var leftEnd = byExpr(cm, leftStart, 1); + var rightEnd = byExpr(cm, leftEnd, 1); + var rightStart = byExpr(cm, rightEnd, -1); + cm.replaceRange(cm.getRange(rightStart, rightEnd) + + cm.getRange(leftEnd, rightStart) + + cm.getRange(leftStart, leftEnd), leftStart, rightEnd); + }; + + cmds.backwardUpList = repeated(toEnclosingExpr); + + cmds.justOneSpace = function(cm) { + var pos = cm.getCursor(), from = pos.ch; + var to = pos.ch, text = cm.getLine(pos.line); + while (from && /\s/.test(text.charAt(from - 1))) --from; + while (to < text.length && /\s/.test(text.charAt(to))) ++to; + cm.replaceRange(" ", Pos(pos.line, from), Pos(pos.line, to)); + }; + + cmds.openLine = repeated(function(cm) { + cm.replaceSelection("\n", "start"); + }); + + // maps to emacs 'transpose-chars' + cmds.transposeCharsRepeatable = repeated(function(cm) { + cm.execCommand("transposeChars"); + }); + + cmds.capitalizeWord = repeated(function(cm) { + operateOnWord(cm, function(w) { + var letter = w.search(/\w/); + if (letter == -1) return w; + return w.slice(0, letter) + w.charAt(letter).toUpperCase() + + w.slice(letter + 1).toLowerCase(); + }); + }); + + cmds.upcaseWord = repeated(function(cm) { + operateOnWord(cm, function(w) { return w.toUpperCase(); }); + }); + + cmds.downcaseWord = repeated(function(cm) { + operateOnWord(cm, function(w) { return w.toLowerCase(); }); + }); + + // maps to emacs 'undo' + cmds.undoRepeatable = repeated("undo"); + + cmds.keyboardQuit = function(cm) { cm.execCommand("clearSearch"); clearMark(cm); } - CodeMirror.emacs = {kill: kill, killRegion: killRegion, repeated: repeated}; + cmds.newline = repeated(function(cm) { cm.replaceSelection("\n", "end"); }); - // Actual keymap + cmds.gotoLine = function(cm) { + var prefix = getPrefix(cm, true); + if (prefix != null && prefix > 0) return cm.setCursor(prefix - 1); - var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({ - "Ctrl-W": function(cm) {kill(cm, cm.getCursor("start"), cm.getCursor("end"), true);}, - "Ctrl-K": repeated(function(cm) { - var start = cm.getCursor(), end = cm.clipPos(Pos(start.line)); - var text = cm.getRange(start, end); - if (!/\S/.test(text)) { - text += "\n"; - end = Pos(start.line + 1, 0); - } - kill(cm, start, end, "grow", text); - }), - "Alt-W": function(cm) { - addToRing(cm.getSelection()); - clearMark(cm); - }, - "Ctrl-Y": function(cm) { - var start = cm.getCursor(); - cm.replaceRange(getFromRing(getPrefix(cm)), start, start, "paste"); - cm.setSelection(start, cm.getCursor()); - }, - "Alt-Y": function(cm) {cm.replaceSelection(popFromRing(), "around", "paste");}, - - "Ctrl-Space": setMark, "Ctrl-Shift-2": setMark, - - "Ctrl-F": move(byChar, 1), "Ctrl-B": move(byChar, -1), - "Right": move(byChar, 1), "Left": move(byChar, -1), - "Ctrl-D": function(cm) { killTo(cm, byChar, 1, false); }, - "Delete": function(cm) { killRegion(cm, false) || killTo(cm, byChar, 1, false); }, - "Ctrl-H": function(cm) { killTo(cm, byChar, -1, false); }, - "Backspace": function(cm) { killRegion(cm, false) || killTo(cm, byChar, -1, false); }, - - "Alt-F": move(byWord, 1), "Alt-B": move(byWord, -1), - "Alt-Right": move(byWord, 1), "Alt-Left": move(byWord, -1), - "Alt-D": function(cm) { killTo(cm, byWord, 1, "grow"); }, - "Alt-Backspace": function(cm) { killTo(cm, byWord, -1, "grow"); }, - - "Ctrl-N": move(byLine, 1), "Ctrl-P": move(byLine, -1), - "Down": move(byLine, 1), "Up": move(byLine, -1), - "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", - "End": "goLineEnd", "Home": "goLineStart", - - "Alt-V": move(byPage, -1), "Ctrl-V": move(byPage, 1), - "PageUp": move(byPage, -1), "PageDown": move(byPage, 1), - - "Ctrl-Up": move(byParagraph, -1), "Ctrl-Down": move(byParagraph, 1), - - "Alt-A": move(bySentence, -1), "Alt-E": move(bySentence, 1), - "Alt-K": function(cm) { killTo(cm, bySentence, 1, "grow"); }, - - "Ctrl-Alt-K": function(cm) { killTo(cm, byExpr, 1, "grow"); }, - "Ctrl-Alt-Backspace": function(cm) { killTo(cm, byExpr, -1, "grow"); }, - "Ctrl-Alt-F": move(byExpr, 1), "Ctrl-Alt-B": move(byExpr, -1, "grow"), - - "Shift-Ctrl-Alt-2": function(cm) { - var cursor = cm.getCursor(); - cm.setSelection(findEnd(cm, cursor, byExpr, 1), cursor); - }, - "Ctrl-Alt-T": function(cm) { - var leftStart = byExpr(cm, cm.getCursor(), -1), leftEnd = byExpr(cm, leftStart, 1); - var rightEnd = byExpr(cm, leftEnd, 1), rightStart = byExpr(cm, rightEnd, -1); - cm.replaceRange(cm.getRange(rightStart, rightEnd) + cm.getRange(leftEnd, rightStart) + - cm.getRange(leftStart, leftEnd), leftStart, rightEnd); - }, - "Ctrl-Alt-U": repeated(toEnclosingExpr), - - "Alt-Space": function(cm) { - var pos = cm.getCursor(), from = pos.ch, to = pos.ch, text = cm.getLine(pos.line); - while (from && /\s/.test(text.charAt(from - 1))) --from; - while (to < text.length && /\s/.test(text.charAt(to))) ++to; - cm.replaceRange(" ", Pos(pos.line, from), Pos(pos.line, to)); - }, - "Ctrl-O": repeated(function(cm) { cm.replaceSelection("\n", "start"); }), - "Ctrl-T": repeated(function(cm) { - cm.execCommand("transposeChars"); - }), - - "Alt-C": repeated(function(cm) { - operateOnWord(cm, function(w) { - var letter = w.search(/\w/); - if (letter == -1) return w; - return w.slice(0, letter) + w.charAt(letter).toUpperCase() + w.slice(letter + 1).toLowerCase(); - }); - }), - "Alt-U": repeated(function(cm) { - operateOnWord(cm, function(w) { return w.toUpperCase(); }); - }), - "Alt-L": repeated(function(cm) { - operateOnWord(cm, function(w) { return w.toLowerCase(); }); - }), + getInput(cm, "Goto line", function(str) { + var num; + if (str && !isNaN(num = Number(str)) && num == (num|0) && num > 0) + cm.setCursor(num - 1); + }); + }; - "Alt-;": "toggleComment", + cmds.indentRigidly = function(cm) { + cm.indentSelection(getPrefix(cm, true) || cm.getOption("indentUnit")); + }; + + cmds.exchangePointAndMark = function(cm) { + cm.setSelection(cm.getCursor("head"), cm.getCursor("anchor")); + }; + + cmds.quotedInsertTab = repeated("insertTab"); + + cmds.universalArgument = function addPrefixMap(cm) { + cm.state.emacsPrefixMap = true; + cm.addKeyMap(prefixMap); + cm.on("keyHandled", maybeRemovePrefixMap); + cm.on("inputRead", maybeRemovePrefixMap); + }; - "Ctrl-/": repeated("undo"), "Shift-Ctrl--": repeated("undo"), - "Ctrl-Z": repeated("undo"), "Cmd-Z": repeated("undo"), + CodeMirror.emacs = {kill: _kill, killRegion: _killRegion, repeated: repeated}; + + // Actual keymap + var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({ + "Ctrl-W": "killRegion", + "Ctrl-K": "killLineEmacs", + "Alt-W": "killRingSave", + "Ctrl-Y": "yank", + "Alt-Y": "yankPop", + "Ctrl-Space": "setMark", + "Ctrl-Shift-2": "setMark", + "Ctrl-F": "forwardChar", + "Ctrl-B": "backwardChar", + "Right": "forwardChar", + "Left": "backwardChar", + "Ctrl-D": "deleteChar", + "Delete": "deleteForwardChar", + "Ctrl-H": "deleteBackwardChar", + "Backspace": "deleteBackwardChar", + "Alt-F": "forwardWord", + "Alt-B": "backwardWord", + "Alt-Right": "forwardWord", + "Alt-Left": "backwardWord", + "Alt-D": "killWord", + "Alt-Backspace": "backwardKillWord", + "Ctrl-N": "nextLine", + "Ctrl-P": "previousLine", + "Down": "nextLine", + "Up": "previousLine", + "Ctrl-A": "goLineStart", + "Ctrl-E": "goLineEnd", + "End": "goLineEnd", + "Home": "goLineStart", + "Alt-V": "scrollDownCommand", + "Ctrl-V": "scrollUpCommand", + "PageUp": "scrollDownCommand", + "PageDown": "scrollUpCommand", + "Ctrl-Up": "backwardParagraph", + "Ctrl-Down": "forwardParagraph", + "Alt-{": "backwardParagraph", + "Alt-}": "forwardParagraph", + "Alt-A": "backwardSentence", + "Alt-E": "forwardSentence", + "Alt-K": "killSentence", + "Ctrl-X Delete": "backwardKillSentence", + "Ctrl-Alt-K": "killSexp", + "Ctrl-Alt-Backspace": "backwardKillSexp", + "Ctrl-Alt-F": "forwardSexp", + "Ctrl-Alt-B": "backwardSexp", + "Shift-Ctrl-Alt-2": "markSexp", + "Ctrl-Alt-T": "transposeSexps", + "Ctrl-Alt-U": "backwardUpList", + "Alt-Space": "justOneSpace", + "Ctrl-O": "openLine", + "Ctrl-T": "transposeCharsRepeatable", + "Alt-C": "capitalizeWord", + "Alt-U": "upcaseWord", + "Alt-L": "downcaseWord", + "Alt-;": "toggleComment", + "Ctrl-/": "undoRepeatable", + "Shift-Ctrl--": "undoRepeatable", + "Ctrl-Z": "undoRepeatable", + "Cmd-Z": "undoRepeatable", + "Ctrl-X U": "undoRepeatable", "Shift-Ctrl-Z": "redo", - "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", - "Ctrl-S": "findPersistentNext", "Ctrl-R": "findPersistentPrev", "Ctrl-G": quit, "Shift-Alt-5": "replace", + "Shift-Alt-,": "goDocStart", + "Shift-Alt-.": "goDocEnd", + "Ctrl-S": "findPersistentNext", + "Ctrl-R": "findPersistentPrev", + "Ctrl-G": "keyboardQuit", + "Shift-Alt-5": "replace", "Alt-/": "autocomplete", "Enter": "newlineAndIndent", - "Ctrl-J": repeated(function(cm) { cm.replaceSelection("\n", "end"); }), + "Ctrl-J": "newline", "Tab": "indentAuto", - - "Alt-G G": function(cm) { - var prefix = getPrefix(cm, true); - if (prefix != null && prefix > 0) return cm.setCursor(prefix - 1); - - getInput(cm, "Goto line", function(str) { - var num; - if (str && !isNaN(num = Number(str)) && num == (num|0) && num > 0) - cm.setCursor(num - 1); - }); - }, - - "Ctrl-X Tab": function(cm) { - cm.indentSelection(getPrefix(cm, true) || cm.getOption("indentUnit")); - }, - "Ctrl-X Ctrl-X": function(cm) { - cm.setSelection(cm.getCursor("head"), cm.getCursor("anchor")); - }, + "Alt-G G": "gotoLine", + "Ctrl-X Tab": "indentRigidly", + "Ctrl-X Ctrl-X": "exchangePointAndMark", "Ctrl-X Ctrl-S": "save", "Ctrl-X Ctrl-W": "save", "Ctrl-X S": "saveAll", "Ctrl-X F": "open", - "Ctrl-X U": repeated("undo"), "Ctrl-X K": "close", - "Ctrl-X Delete": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), "grow"); }, "Ctrl-X H": "selectAll", - - "Ctrl-Q Tab": repeated("insertTab"), - "Ctrl-U": addPrefixMap, + "Ctrl-Q Tab": "quotedInsertTab", + "Ctrl-U": "universalArgument", "fallthrough": "default" }); diff --git a/Mod manager/utils/QNModManager/CodeMirror/keymap/sublime.js b/Mod manager/utils/QNModManager/CodeMirror/keymap/sublime.js index 7edf172e..0c9a63e0 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/keymap/sublime.js +++ b/Mod manager/utils/QNModManager/CodeMirror/keymap/sublime.js @@ -339,7 +339,7 @@ }; - function sortLines(cm, caseSensitive) { + function sortLines(cm, caseSensitive, direction) { if (cm.isReadOnly()) return CodeMirror.Pass var ranges = cm.listSelections(), toSort = [], selected; for (var i = 0; i < ranges.length; i++) { @@ -361,12 +361,12 @@ var start = Pos(from, 0), end = Pos(to); var lines = cm.getRange(start, end, false); if (caseSensitive) - lines.sort(); + lines.sort(function(a, b) { return a < b ? -direction : a == b ? 0 : direction; }); else lines.sort(function(a, b) { var au = a.toUpperCase(), bu = b.toUpperCase(); if (au != bu) { a = au; b = bu; } - return a < b ? -1 : a == b ? 0 : 1; + return a < b ? -direction : a == b ? 0 : direction; }); cm.replaceRange(lines, start, end); if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)}); @@ -375,8 +375,10 @@ }); } - cmds.sortLines = function(cm) { sortLines(cm, true); }; - cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false); }; + cmds.sortLines = function(cm) { sortLines(cm, true, 1); }; + cmds.reverseSortLines = function(cm) { sortLines(cm, true, -1); }; + cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false, 1); }; + cmds.reverseSortLinesInsensitive = function(cm) { sortLines(cm, false, -1); }; cmds.nextBookmark = function(cm) { var marks = cm.state.sublimeBookmarks; @@ -609,7 +611,9 @@ "Cmd-J": "joinLines", "Shift-Cmd-D": "duplicateLine", "F5": "sortLines", + "Shift-F5": "reverseSortLines", "Cmd-F5": "sortLinesInsensitive", + "Shift-Cmd-F5": "reverseSortLinesInsensitive", "F2": "nextBookmark", "Shift-F2": "prevBookmark", "Cmd-F2": "toggleBookmark", @@ -671,7 +675,9 @@ "Ctrl-J": "joinLines", "Shift-Ctrl-D": "duplicateLine", "F9": "sortLines", + "Shift-F9": "reverseSortLines", "Ctrl-F9": "sortLinesInsensitive", + "Shift-Ctrl-F9": "reverseSortLinesInsensitive", "F2": "nextBookmark", "Shift-F2": "prevBookmark", "Ctrl-F2": "toggleBookmark", diff --git a/Mod manager/utils/QNModManager/CodeMirror/keymap/vim.js b/Mod manager/utils/QNModManager/CodeMirror/keymap/vim.js index 5a4860c6..b2da1c13 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/keymap/vim.js +++ b/Mod manager/utils/QNModManager/CodeMirror/keymap/vim.js @@ -8,7 +8,7 @@ * Supported Ex commands: * Refer to defaultExCommandMap below. * - * Registers: unnamed, -, a-z, A-Z, 0-9 + * Registers: unnamed, -, ., :, /, _, a-z, A-Z, 0-9 * (Does not respect the special case for number registers when delete * operator is made with these commands: %, (, ), , /, ?, n, N, {, } ) * TODO: Implement the remaining registers. @@ -44,6 +44,27 @@ })(function(CodeMirror) { 'use strict'; + var Pos = CodeMirror.Pos; + + function transformCursor(cm, range) { + var vim = cm.state.vim; + if (!vim || vim.insertMode) return range.head; + var head = vim.sel.head; + if (!head) return range.head; + + if (vim.visualBlock) { + if (range.head.line != head.line) { + return; + } + } + if (range.from() == range.anchor && !range.empty()) { + if (range.head.line == head.line && range.head.ch != head.ch) + return new Pos(range.head.line, range.head.ch - 1); + } + + return range.head; + } + var defaultKeymap = [ // Key to key mapping. This goes first to make it possible to override // existing mappings. @@ -51,6 +72,8 @@ { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'k' }, { keys: '', type: 'keyToKey', toKeys: 'j' }, + { keys: 'g', type: 'keyToKey', toKeys: 'gk' }, + { keys: 'g', type: 'keyToKey', toKeys: 'gj' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'}, { keys: '', type: 'keyToKey', toKeys: 'x', context: 'normal'}, @@ -73,6 +96,7 @@ { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' }, + { keys: '', type: 'keyToKey', toKeys: 'i', context: 'normal'}, { keys: '', type: 'action', action: 'toggleOverwrite', context: 'insert' }, // Motions { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, @@ -102,6 +126,9 @@ { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, + {keys: "g$", type: "motion", motion: "moveToEndOfDisplayLine"}, + {keys: "g^", type: "motion", motion: "moveToStartOfDisplayLine"}, + {keys: "g0", type: "motion", motion: "moveToStartOfDisplayLine"}, { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, @@ -141,6 +168,8 @@ { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, + { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true }}, + { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false }}, // Operator-Motion dual commands { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, @@ -152,6 +181,7 @@ { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'}, { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, + { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveToStartOfLine', context: 'insert' }, { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, //ignore C-w in normal mode { keys: '', type: 'idle', context: 'normal' }, @@ -242,11 +272,10 @@ { name: 'yank', shortName: 'y' }, { name: 'delmarks', shortName: 'delm' }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, + { name: 'vglobal', shortName: 'v' }, { name: 'global', shortName: 'g' } ]; - var Pos = CodeMirror.Pos; - var Vim = function() { function enterVimMode(cm) { cm.setOption('disableInput', true); @@ -262,15 +291,13 @@ cm.off('cursorActivity', onCursorActivity); CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); cm.state.vim = null; + if (highlightTimeout) clearTimeout(highlightTimeout); } function detachVimMap(cm, next) { if (this == CodeMirror.keyMap.vim) { + cm.options.$customCursor = null; CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); - if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) { - disableFatCursorMark(cm); - cm.getInputField().style.caretColor = ""; - } } if (!next || next.attach != attachVimMap) @@ -278,57 +305,15 @@ } function attachVimMap(cm, prev) { if (this == CodeMirror.keyMap.vim) { + if (cm.curOp) cm.curOp.selectionChanged = true; + cm.options.$customCursor = transformCursor; CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); - if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) { - enableFatCursorMark(cm); - cm.getInputField().style.caretColor = "transparent"; - } } if (!prev || prev.attach != attachVimMap) enterVimMode(cm); } - function updateFatCursorMark(cm) { - if (!cm.state.fatCursorMarks) return; - clearFatCursorMark(cm); - var ranges = cm.listSelections(), result = [] - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (range.empty()) { - var lineLength = cm.getLine(range.anchor.line).length; - if (range.anchor.ch < lineLength) { - result.push(cm.markText(range.anchor, Pos(range.anchor.line, range.anchor.ch + 1), - {className: "cm-fat-cursor-mark"})); - } else { - result.push(cm.markText(Pos(range.anchor.line, lineLength - 1), - Pos(range.anchor.line, lineLength), - {className: "cm-fat-cursor-mark"})); - } - } - } - cm.state.fatCursorMarks = result; - } - - function clearFatCursorMark(cm) { - var marks = cm.state.fatCursorMarks; - if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear(); - } - - function enableFatCursorMark(cm) { - cm.state.fatCursorMarks = []; - updateFatCursorMark(cm) - cm.on("cursorActivity", updateFatCursorMark) - } - - function disableFatCursorMark(cm) { - clearFatCursorMark(cm); - cm.off("cursorActivity", updateFatCursorMark); - // explicitly set fatCursorMarks to null because event listener above - // can be invoke after removing it, if off is called from operation - cm.state.fatCursorMarks = null; - } - // Deprecated, simply setting the keymap works again. CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { if (val && cm.getOption("keyMap") != "vim") @@ -344,14 +329,14 @@ if (!vimKey) { return false; } - var cmd = CodeMirror.Vim.findKey(cm, vimKey); + var cmd = vimApi.findKey(cm, vimKey); if (typeof cmd == 'function') { CodeMirror.signal(cm, 'vim-keypress', vimKey); } return cmd; } - var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; + var modifiers = {Shift:'S',Ctrl:'C',Alt:'A',Cmd:'D',Mod:'A',CapsLock:''}; var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del',Insert:'Ins'}; function cmKeyToVimKey(key) { if (key.charAt(0) == '\'') { @@ -416,7 +401,10 @@ var lowerCaseAlphabet = makeKeyRange(97, 26); var numbers = makeKeyRange(48, 10); var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); - var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); + var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '_', '/']); + var upperCaseChars; + try { upperCaseChars = new RegExp("^[\\p{Lu}]$", "u"); } + catch (_) { upperCaseChars = /^[A-Z]$/; } function isLine(cm, line) { return line >= cm.firstLine() && line <= cm.lastLine(); @@ -431,7 +419,7 @@ return numberRegex.test(k); } function isUpperCase(k) { - return (/^[A-Z]$/).test(k); + return upperCaseChars.test(k); } function isWhiteSpaceString(k) { return (/^\s*$/).test(k); @@ -655,7 +643,7 @@ this.latestRegister = registerName; if (cm.openDialog) { this.onRecordingDone = cm.openDialog( - '(recording)['+registerName+']', null, {bottom:true}); + document.createTextNode('(recording)['+registerName+']'), null, {bottom:true}); } this.isRecording = true; } @@ -685,8 +673,6 @@ // executed in between. lastMotion: null, marks: {}, - // Mark for rendering fake cursor for visual mode. - fakeCursor: null, insertMode: false, // Repeat count for changes made in insert mode, triggered by key // sequences like 3,i. Only exists when insertMode is true. @@ -735,7 +721,7 @@ // TODO: Convert keymap into dictionary format for fast lookup. }, // Testing hook, though it might be useful to expose the register - // controller anyways. + // controller anyway. getRegisterController: function() { return vimGlobalState.registerController; }, @@ -758,7 +744,7 @@ exCommandDispatcher.map(lhs, rhs, ctx); }, unmap: function(lhs, ctx) { - exCommandDispatcher.unmap(lhs, ctx); + return exCommandDispatcher.unmap(lhs, ctx); }, // Non-recursive map function. // NOTE: This will not create mappings to key maps that aren't present @@ -879,13 +865,17 @@ } function handleEsc() { if (key == '') { - // Clear input state and get back to normal mode. - clearInputState(cm); if (vim.visualMode) { + // Get back to normal mode. exitVisualMode(cm); } else if (vim.insertMode) { + // Get back to normal mode. exitInsertMode(cm); + } else { + // We're already in normal mode. Let '' be handled normally. + return; } + clearInputState(cm); return true; } } @@ -898,7 +888,7 @@ match = (/<\w+-.+?>|<\w+>|./).exec(keys); key = match[0]; keys = keys.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'mapping'); + vimApi.handleKey(cm, key, 'mapping'); } } @@ -945,7 +935,12 @@ if (!keysMatcher) { clearInputState(cm); return false; } var context = vim.visualMode ? 'visual' : 'normal'; - var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); + var mainKey = keysMatcher[2] || keysMatcher[1]; + if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) { + // multikey operators act linewise by repeating only the last character + mainKey = vim.inputState.operatorShortcut; + } + var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { return true; } @@ -981,7 +976,7 @@ // clear VIM state in case it's in a bad state. cm.state.vim = undefined; maybeInitVimState(cm); - if (!CodeMirror.Vim.suppressErrorLogging) { + if (!vimApi.suppressErrorLogging) { console['log'](e); } throw e; @@ -1128,6 +1123,8 @@ } RegisterController.prototype = { pushText: function(registerName, operator, text, linewise, blockwise) { + // The black hole register, "_, means delete/yank to nowhere. + if (registerName === '_') return; if (linewise && text.charAt(text.length - 1) !== '\n'){ text += '\n'; } @@ -1303,6 +1300,9 @@ } inputState.operator = command.operator; inputState.operatorArgs = copyArgs(command.operatorArgs); + if (command.keys.length > 1) { + inputState.operatorShortcut = command.keys; + } if (command.exitVisualBlock) { vim.visualBlock = false; updateCmSelection(cm); @@ -1446,7 +1446,7 @@ showPrompt(cm, { onClose: onPromptClose, prefix: promptPrefix, - desc: searchPromptDesc, + desc: '(JavaScript regexp)', onKeyUp: onPromptKeyUp, onKeyDown: onPromptKeyDown }); @@ -1574,7 +1574,7 @@ motionArgs.repeat = repeat; clearInputState(cm); if (motion) { - var motionResult = motions[motion](cm, origHead, motionArgs, vim); + var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState); vim.lastMotion = motions[motion]; if (!motionResult) { return; @@ -1631,17 +1631,17 @@ var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); if (lastSel.visualLine) { // Linewise Visual mode: The same number of lines. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } else if (lastSel.visualBlock) { // Blockwise Visual mode: The same number of lines and columns. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); } else if (lastSel.head.line == lastSel.anchor.line) { // Normal Visual mode within one line: The same number of characters. - newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset); } else { // Normal Visual mode with several lines: The same number of lines, in the // last line the same number of characters as in the last line the last time. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } vim.visualMode = true; vim.visualLine = lastSel.visualLine; @@ -1681,7 +1681,7 @@ ranges[i].head.ch = lineLength(cm, ranges[i].head.line); } } else if (mode == 'line') { - ranges[0].head = Pos(ranges[0].head.line + 1, 0); + ranges[0].head = new Pos(ranges[0].head.line + 1, 0); } } } else { @@ -1743,22 +1743,22 @@ var motions = { moveToTopLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToMiddleLine: function(cm) { var range = getUserVisibleLines(cm); var line = Math.floor((range.top + range.bottom) * 0.5); - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToBottomLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, expandToLine: function(_cm, head, motionArgs) { // Expands forward to end of line, and then to next line if repeat is // >1. Does not handle backward motion! var cur = head; - return Pos(cur.line + motionArgs.repeat - 1, Infinity); + return new Pos(cur.line + motionArgs.repeat - 1, Infinity); }, findNext: function(cm, _head, motionArgs) { var state = getSearchState(cm); @@ -1772,6 +1772,87 @@ highlightSearchMatches(cm, query); return findNext(cm, prev/** prev */, query, motionArgs.repeat); }, + /** + * Find and select the next occurrence of the search query. If the cursor is currently + * within a match, then find and select the current match. Otherwise, find the next occurrence in the + * appropriate direction. + * + * This differs from `findNext` in the following ways: + * + * 1. Instead of only returning the "from", this returns a "from", "to" range. + * 2. If the cursor is currently inside a search match, this selects the current match + * instead of the next match. + * 3. If there is no associated operator, this will turn on visual mode. + */ + findAndSelectNextInclusive: function(cm, _head, motionArgs, vim, prevInputState) { + var state = getSearchState(cm); + var query = state.getQuery(); + + if (!query) { + return; + } + + var prev = !motionArgs.forward; + prev = (state.isReversed()) ? !prev : prev; + + // next: [from, to] | null + var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim); + + // No matches. + if (!next) { + return; + } + + // If there's an operator that will be executed, return the selection. + if (prevInputState.operator) { + return next; + } + + // At this point, we know that there is no accompanying operator -- let's + // deal with visual mode in order to select an appropriate match. + + var from = next[0]; + // For whatever reason, when we use the "to" as returned by searchcursor.js directly, + // the resulting selection is extended by 1 char. Let's shrink it so that only the + // match is selected. + var to = new Pos(next[1].line, next[1].ch - 1); + + if (vim.visualMode) { + // If we were in visualLine or visualBlock mode, get out of it. + if (vim.visualLine || vim.visualBlock) { + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); + } + + // If we're currently in visual mode, we should extend the selection to include + // the search result. + var anchor = vim.sel.anchor; + if (anchor) { + if (state.isReversed()) { + if (motionArgs.forward) { + return [anchor, from]; + } + + return [anchor, to]; + } else { + if (motionArgs.forward) { + return [anchor, to]; + } + + return [anchor, from]; + } + } + } else { + // Let's turn visual mode on. + vim.visualMode = true; + vim.visualLine = false; + vim.visualBlock = false; + CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""}); + } + + return prev ? [to, from] : [from, to]; + }, goToMark: function(cm, _head, motionArgs, vim) { var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter); if (pos) { @@ -1783,8 +1864,8 @@ if (vim.visualBlock && motionArgs.sameLine) { var sel = vim.sel; return [ - clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), - clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) + clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)), + clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch)) ]; } else { return ([vim.sel.head, vim.sel.anchor]); @@ -1824,7 +1905,7 @@ // Vim places the cursor on the first non-whitespace character of // the line if there is one, else it places the cursor at the end // of the line, regardless of whether a mark was found. - best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); + best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); } return best; }, @@ -1832,7 +1913,7 @@ var cur = head; var repeat = motionArgs.repeat; var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; - return Pos(cur.line, ch); + return new Pos(cur.line, ch); }, moveByLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -1867,15 +1948,15 @@ // move to previous/next line is triggered. if (line < first && cur.line == first){ return this.moveToStartOfLine(cm, head, motionArgs, vim); - }else if (line > last && cur.line == last){ - return this.moveToEol(cm, head, motionArgs, vim, true); + } else if (line > last && cur.line == last){ + return moveToEol(cm, head, motionArgs, vim, true); } if (motionArgs.toFirstChar){ endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); vim.lastHPos = endCh; } - vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; - return Pos(line, endCh); + vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left; + return new Pos(line, endCh); }, moveByDisplayLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -1897,7 +1978,7 @@ var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; var res = cm.coordsChar(goalCoords, 'div'); } else { - var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); + var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div'); resCoords.left = vim.lastHSPos; res = cm.coordsChar(resCoords, 'div'); } @@ -1970,22 +2051,14 @@ vim.lastHSPos = cm.charCoords(head,'div').left; return moveToColumn(cm, repeat); }, - moveToEol: function(cm, head, motionArgs, vim, keepHPos) { - var cur = head; - var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); - var end=cm.clipPos(retval); - end.ch--; - if (!keepHPos) { - vim.lastHPos = Infinity; - vim.lastHSPos = cm.charCoords(end,'div').left; - } - return retval; + moveToEol: function(cm, head, motionArgs, vim) { + return moveToEol(cm, head, motionArgs, vim, false); }, moveToFirstNonWhiteSpaceCharacter: function(cm, head) { // Go to the start of the line where the text begins, or the end for // whitespace-only lines var cursor = head; - return Pos(cursor.line, + return new Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); }, moveToMatchedSymbol: function(cm, head) { @@ -1997,7 +2070,7 @@ for (; ch < lineText.length; ch++) { symbol = lineText.charAt(ch); if (symbol && isMatchableSymbol(symbol)) { - var style = cm.getTokenTypeAt(Pos(line, ch + 1)); + var style = cm.getTokenTypeAt(new Pos(line, ch + 1)); if (style !== "string" && style !== "comment") { break; } @@ -2006,23 +2079,33 @@ if (ch < lineText.length) { // Only include angle brackets in analysis if they are being matched. var re = (ch === '<' || ch === '>') ? /[(){}[\]<>]/ : /[(){}[\]]/; - var matched = cm.findMatchingBracket(Pos(line, ch), {bracketRegex: re}); + var matched = cm.findMatchingBracket(new Pos(line, ch), {bracketRegex: re}); return matched.to; } else { return cursor; } }, moveToStartOfLine: function(_cm, head) { - return Pos(head.line, 0); + return new Pos(head.line, 0); }, moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); if (motionArgs.repeatIsExplicit) { lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); } - return Pos(lineNum, + return new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); }, + moveToStartOfDisplayLine: function(cm) { + cm.execCommand("goLineLeft"); + return cm.getCursor(); + }, + moveToEndOfDisplayLine: function(cm) { + cm.execCommand("goLineRight"); + var head = cm.getCursor(); + if (head.sticky == "before") head.ch--; + return head; + }, textObjectManipulation: function(cm, head, motionArgs, vim) { // TODO: lots of possible exceptions that can be thrown here. Try da( // outside of a () block. @@ -2183,7 +2266,7 @@ if (anchor.line == cm.firstLine()) { anchor.ch = 0; } else { - anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); + anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); } } text = cm.getRange(anchor, head); @@ -2196,7 +2279,7 @@ text = cm.getSelection(); var replacement = fillArray('', ranges.length); cm.replaceSelections(replacement); - finalHead = ranges[0].anchor; + finalHead = cursorMin(ranges[0].head, ranges[0].anchor); } vimGlobalState.registerController.pushText( args.registerName, 'delete', text, @@ -2330,7 +2413,7 @@ }, scrollToCursor: function(cm, actionArgs) { var lineNum = cm.getCursor().line; - var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); + var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; var lineHeight = charCoords.bottom - y; @@ -2382,9 +2465,9 @@ var head = actionArgs.head || cm.getCursor('head'); var height = cm.listSelections().length; if (insertAt == 'eol') { - head = Pos(head.line, lineLength(cm, head.line)); + head = new Pos(head.line, lineLength(cm, head.line)); } else if (insertAt == 'bol') { - head = Pos(head.line, 0); + head = new Pos(head.line, 0); } else if (insertAt == 'charAfter') { head = offsetCursor(head, 0, 1); } else if (insertAt == 'firstNonBlank') { @@ -2396,10 +2479,10 @@ if (sel.head.line < sel.anchor.line) { head = sel.head; } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch)); height = Math.abs(sel.head.line - sel.anchor.line) + 1; @@ -2411,12 +2494,12 @@ if (sel.head.line >= sel.anchor.line) { head = offsetCursor(sel.head, 0, 1); } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), - Math.max(sel.head.ch + 1, sel.anchor.ch)); + Math.max(sel.head.ch, sel.anchor.ch) + 1); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'inplace') { @@ -2460,7 +2543,7 @@ vim.visualLine = !!actionArgs.linewise; vim.visualBlock = !!actionArgs.blockwise; head = clipCursorToContent( - cm, Pos(anchor.line, anchor.ch + repeat - 1)); + cm, new Pos(anchor.line, anchor.ch + repeat - 1)); vim.sel = { anchor: anchor, head: head @@ -2523,13 +2606,13 @@ // Repeat is the number of lines to join. Minimum 2 lines. var repeat = Math.max(actionArgs.repeat, 2); curStart = cm.getCursor(); - curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, + curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1, Infinity)); } var finalCh = 0; for (var i = curStart.line; i < curEnd.line; i++) { finalCh = lineLength(cm, curStart.line); - var tmp = Pos(curStart.line + 1, + var tmp = new Pos(curStart.line + 1, lineLength(cm, curStart.line + 1)); var text = cm.getRange(curStart, tmp); text = actionArgs.keepSpaces @@ -2537,7 +2620,7 @@ : text.replace(/\n\s*/g, ' '); cm.replaceRange(text, curStart, tmp); } - var curFinalPos = Pos(curStart.line, finalCh); + var curFinalPos = new Pos(curStart.line, finalCh); if (vim.visualMode) { exitVisualMode(cm, false); } @@ -2548,7 +2631,7 @@ var insertAt = copyCursor(cm.getCursor()); if (insertAt.line === cm.firstLine() && !actionArgs.after) { // Special case for inserting newline before start of document. - cm.replaceRange('\n', Pos(cm.firstLine(), 0)); + cm.replaceRange('\n', new Pos(cm.firstLine(), 0)); cm.setCursor(cm.firstLine(), 0); } else { insertAt.line = (actionArgs.after) ? insertAt.line : @@ -2649,7 +2732,7 @@ // first delete the selected text cm.replaceSelections(emptyStrings); // Set new selections as per the block length of the yanked text - selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); + selectionEnd = new Pos(selectionStart.line + text.length-1, selectionStart.ch); cm.setCursor(selectionStart); selectBlock(cm, selectionEnd); cm.replaceSelections(text); @@ -2676,7 +2759,7 @@ for (var i = 0; i < text.length; i++) { var line = cur.line+i; if (line > cm.lastLine()) { - cm.replaceRange('\n', Pos(line, 0)); + cm.replaceRange('\n', new Pos(line, 0)); } var lastCh = lineLength(cm, line); if (lastCh < cur.ch) { @@ -2684,18 +2767,18 @@ } } cm.setCursor(cur); - selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); + selectBlock(cm, new Pos(cur.line + text.length-1, cur.ch)); cm.replaceSelections(text); curPosFinal = cur; } else { cm.replaceRange(text, cur); // Now fine tune the cursor to where we want it. if (linewise && actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); } else if (linewise && !actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); } else if (!linewise && actionArgs.after) { @@ -2743,7 +2826,7 @@ if (replaceTo > line.length) { replaceTo=line.length; } - curEnd = Pos(curStart.line, replaceTo); + curEnd = new Pos(curStart.line, replaceTo); } if (replaceWith=='\n') { if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); @@ -2799,13 +2882,13 @@ } else { numberStr = baseStr + zeroPadding + numberStr; } - var from = Pos(cur.line, start); - var to = Pos(cur.line, end); + var from = new Pos(cur.line, start); + var to = new Pos(cur.line, end); cm.replaceRange(numberStr, from, to); } else { return; } - cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); + cm.setCursor(new Pos(cur.line, start + numberStr.length - 1)); }, repeatLastEdit: function(cm, actionArgs, vim) { var lastEditInputState = vim.lastEditInputState; @@ -2842,7 +2925,7 @@ var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak; var ch = Math.min(Math.max(0, cur.ch), maxCh); - return Pos(line, ch); + return new Pos(line, ch); } function copyArgs(args) { var ret = {}; @@ -2858,7 +2941,7 @@ offsetCh = offsetLine.ch; offsetLine = offsetLine.line; } - return Pos(cur.line + offsetLine, cur.ch + offsetCh); + return new Pos(cur.line + offsetLine, cur.ch + offsetCh); } function commandMatches(keys, keyMap, context, inputState) { // Partial matches are not applied. They inform the key handler @@ -2918,7 +3001,7 @@ }; } function copyCursor(cur) { - return Pos(cur.line, cur.ch); + return new Pos(cur.line, cur.ch); } function cursorEqual(cur1, cur2) { return cur1.ch == cur2.ch && cur1.line == cur2.line; @@ -2965,7 +3048,7 @@ function extendLineToColumn(cm, lineNum, column) { var endCh = lineLength(cm, lineNum); var spaces = new Array(column-endCh+1).join(' '); - cm.setCursor(Pos(lineNum, endCh)); + cm.setCursor(new Pos(lineNum, endCh)); cm.replaceRange(spaces, cm.getCursor()); } // This functions selects a rectangular block @@ -3046,13 +3129,13 @@ if (block) { var width = block.width; var height = block.height; - selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); + selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width); var selections = []; // selectBlock creates a 'proper' rectangular block. // We do not want that in all cases, so we manually set selections. for (var i = selectionStart.line; i < selectionEnd.line; i++) { - var anchor = Pos(i, selectionStart.ch); - var head = Pos(i, selectionEnd.ch); + var anchor = new Pos(i, selectionStart.ch); + var head = new Pos(i, selectionEnd.ch); var range = {anchor: anchor, head: head}; selections.push(range); } @@ -3064,8 +3147,8 @@ var ch = end.ch - start.ch; selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; if (lastSelection.visualLine) { - selectionStart = Pos(selectionStart.line, 0); - selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); + selectionStart = new Pos(selectionStart.line, 0); + selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); } cm.setSelection(selectionStart, selectionEnd); } @@ -3114,7 +3197,7 @@ head = cursorMax(head, end); head = offsetCursor(head, 0, -1); if (head.ch == -1 && head.line != cm.firstLine()) { - head = Pos(head.line - 1, lineLength(cm, head.line - 1)); + head = new Pos(head.line - 1, lineLength(cm, head.line - 1)); } } return [anchor, head]; @@ -3130,7 +3213,6 @@ vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; var cmSel = makeCmSelection(cm, sel, mode); cm.setSelections(cmSel.ranges, cmSel.primary); - updateFakeCursor(cm); } function makeCmSelection(cm, sel, mode, exclusive) { var head = copyCursor(sel.head); @@ -3163,16 +3245,18 @@ }; } else if (mode == 'block') { var top = Math.min(anchor.line, head.line), - left = Math.min(anchor.ch, head.ch), + fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), - right = Math.max(anchor.ch, head.ch) + 1; + toCh = head.ch; + if (fromCh < toCh) { toCh += 1 } + else { fromCh += 1 }; var height = bottom - top + 1; var primary = head.line == top ? 0 : height - 1; var ranges = []; for (var i = 0; i < height; i++) { ranges.push({ - anchor: Pos(top + i, left), - head: Pos(top + i, right) + anchor: new Pos(top + i, fromCh), + head: new Pos(top + i, toCh) }); } return { @@ -3206,7 +3290,6 @@ vim.visualLine = false; vim.visualBlock = false; if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - clearFakeCursor(vim); } // Remove any trailing newlines from the selection. For @@ -3294,7 +3377,7 @@ if (!start) { start = wordStart; } } } - return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; + return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) }; } /** @@ -3406,7 +3489,7 @@ }, isComplete: function(state) { if (state.nextCh === '#') { - var token = state.lineText.match(/#(\w+)/)[1]; + var token = state.lineText.match(/^#(\w+)/)[1]; if (token === 'endif') { if (state.forward && state.depth === 0) { return true; @@ -3468,7 +3551,7 @@ } } if (state.nextCh || state.curMoveThrough) { - return Pos(line, state.index); + return new Pos(line, state.index); } return cur; } @@ -3580,7 +3663,7 @@ break; } words.push(word); - cur = Pos(word.line, forward ? (word.to - 1) : word.from); + cur = new Pos(word.line, forward ? (word.to - 1) : word.from); } var shortCircuit = words.length != repeat; var firstWord = words[0]; @@ -3591,22 +3674,34 @@ // We did not start in the middle of a word. Discard the extra word at the end. lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } else if (forward && wordEnd) { - return Pos(lastWord.line, lastWord.to - 1); + return new Pos(lastWord.line, lastWord.to - 1); } else if (!forward && wordEnd) { // ge if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { // We did not start in the middle of a word. Discard the extra word at the end. lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.to); + return new Pos(lastWord.line, lastWord.to); } else { // b - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } } + function moveToEol(cm, head, motionArgs, vim, keepHPos) { + var cur = head; + var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity); + var end=cm.clipPos(retval); + end.ch--; + if (!keepHPos) { + vim.lastHPos = Infinity; + vim.lastHSPos = cm.charCoords(end,'div').left; + } + return retval; + } + function moveToCharacter(cm, repeat, forward, character) { var cur = cm.getCursor(); var start = cur.ch; @@ -3619,14 +3714,14 @@ } start = idx; } - return Pos(cm.getCursor().line, idx); + return new Pos(cm.getCursor().line, idx); } function moveToColumn(cm, repeat) { // repeat is always >= 1, so repeat - 1 always corresponds // to the column we want to go to. var line = cm.getCursor().line; - return clipCursorToContent(cm, Pos(line, repeat - 1)); + return clipCursorToContent(cm, new Pos(line, repeat - 1)); } function updateMark(cm, vim, markName, pos) { @@ -3878,7 +3973,7 @@ repeat--; } - return Pos(curr_index.ln, curr_index.pos); + return new Pos(curr_index.ln, curr_index.pos); } // TODO: perhaps this finagling of start and end positions belongs @@ -3901,8 +3996,8 @@ // cursor is on a matching open bracket. var offset = curChar === openSym ? 1 : 0; - start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); - end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); + start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); + end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); if (!start || !end) { return { start: cur, end: cur }; @@ -3983,8 +4078,8 @@ } return { - start: Pos(cur.line, start), - end: Pos(cur.line, end) + start: new Pos(cur.line, start), + end: new Pos(cur.line, end) }; } @@ -4021,16 +4116,6 @@ var vim = cm.state.vim; return vim.searchState_ || (vim.searchState_ = new SearchState()); } - function dialog(cm, template, shortText, onClose, options) { - if (cm.openDialog) { - cm.openDialog(template, onClose, { bottom: true, value: options.value, - onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, - selectValueOnOpen: false}); - } - else { - onClose(prompt(shortText, '')); - } - } function splitBySlash(argString) { return splitBySeparator(argString, '/'); } @@ -4214,31 +4299,69 @@ ignoreCase = (/^[^A-Z]*$/).test(regexPart); } var regexp = new RegExp(regexPart, - (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + (ignoreCase || forceIgnoreCase) ? 'im' : 'm'); return regexp; } - function showConfirm(cm, text) { + + /** + * dom - Document Object Manipulator + * Usage: + * dom(''|[, ...{|<$styles>}||'']) + * Examples: + * dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'})) + * dom(document.head, dom('script', 'alert("hello!")')) + * Not supported: + * dom('p', ['arrays are objects'], Error('objects specify attributes')) + */ + function dom(n) { + if (typeof n === 'string') n = document.createElement(n); + for (var a, i = 1; i < arguments.length; i++) { + if (!(a = arguments[i])) continue; + if (typeof a !== 'object') a = document.createTextNode(a); + if (a.nodeType) n.appendChild(a); + else for (var key in a) { + if (!Object.prototype.hasOwnProperty.call(a, key)) continue; + if (key[0] === '$') n.style[key.slice(1)] = a[key]; + else n.setAttribute(key, a[key]); + } + } + return n; + } + + function showConfirm(cm, template) { + var pre = dom('pre', {$color: 'red', class: 'cm-vim-message'}, template); if (cm.openNotification) { - cm.openNotification('' + text + '', - {bottom: true, duration: 5000}); + cm.openNotification(pre, {bottom: true, duration: 5000}); } else { - alert(text); + alert(pre.innerText); } } + function makePrompt(prefix, desc) { - var raw = '' + - (prefix || "") + ''; - if (desc) - raw += ' ' + desc + ''; - return raw; + return dom(document.createDocumentFragment(), + dom('span', {$fontFamily: 'monospace', $whiteSpace: 'pre'}, + prefix, + dom('input', {type: 'text', autocorrect: 'off', + autocapitalize: 'off', spellcheck: 'false'})), + desc && dom('span', {$color: '#888'}, desc)); } - var searchPromptDesc = '(Javascript regexp)'; + function showPrompt(cm, options) { - var shortText = (options.prefix || '') + ' ' + (options.desc || ''); - var prompt = makePrompt(options.prefix, options.desc); - dialog(cm, prompt, shortText, options.onClose, options); + var template = makePrompt(options.prefix, options.desc); + if (cm.openDialog) { + cm.openDialog(template, options.onClose, { + onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, + bottom: true, selectValueOnOpen: false, value: options.value + }); + } + else { + var shortText = ''; + if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent; + if (options.desc) shortText += " " + options.desc; + options.onClose(prompt(shortText, '')); + } } + function regexEqual(r1, r2) { if (r1 instanceof RegExp && r2 instanceof RegExp) { var props = ['global', 'multiline', 'ignoreCase', 'source']; @@ -4309,6 +4432,7 @@ function highlightSearchMatches(cm, query) { clearTimeout(highlightTimeout); highlightTimeout = setTimeout(function() { + if (!cm.state.vim) return; var searchState = getSearchState(cm); var overlay = searchState.getOverlay(); if (!overlay || query != overlay.query) { @@ -4334,12 +4458,19 @@ var cursor = cm.getSearchCursor(query, pos); for (var i = 0; i < repeat; i++) { var found = cursor.find(prev); - if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } + if (i == 0 && found && cursorEqual(cursor.from(), pos)) { + var lastEndPos = prev ? cursor.from() : cursor.to(); + found = cursor.find(prev); + if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) { + if (cm.getLine(lastEndPos.line).length == lastEndPos.ch) + found = cursor.find(prev); + } + } if (!found) { // SearchCursor may have returned null because it hit EOF, wrap // around and try again. cursor = cm.getSearchCursor(query, - (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } @@ -4348,6 +4479,42 @@ return cursor.from(); }); } + /** + * Pretty much the same as `findNext`, except for the following differences: + * + * 1. Before starting the search, move to the previous search. This way if our cursor is + * already inside a match, we should return the current match. + * 2. Rather than only returning the cursor's from, we return the cursor's from and to as a tuple. + */ + function findNextFromAndToInclusive(cm, prev, query, repeat, vim) { + if (repeat === undefined) { repeat = 1; } + return cm.operation(function() { + var pos = cm.getCursor(); + var cursor = cm.getSearchCursor(query, pos); + + // Go back one result to ensure that if the cursor is currently a match, we keep it. + var found = cursor.find(!prev); + + // If we haven't moved, go back one more (similar to if i==0 logic in findNext). + if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) { + cursor.find(!prev); + } + + for (var i = 0; i < repeat; i++) { + found = cursor.find(prev); + if (!found) { + // SearchCursor may have returned null because it hit EOF, wrap + // around and try again. + cursor = cm.getSearchCursor(query, + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); + if (!cursor.find(prev)) { + return; + } + } + } + return [cursor.from(), cursor.to()]; + }); + } function clearSearchHighlight(cm) { var state = getSearchState(cm); cm.removeOverlay(getSearchState(cm).getOverlay()); @@ -4376,7 +4543,7 @@ if (start instanceof Array) { return inArray(pos, start); } else { - if (end) { + if (typeof end == 'number') { return (pos >= start && pos <= end); } else { return pos == start; @@ -4395,7 +4562,7 @@ function getMarkPos(cm, vim, markName) { if (markName == '\'' || markName == '`') { - return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0); + return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0); } else if (markName == '.') { return getLastEditPos(cm); } @@ -4439,7 +4606,7 @@ try { this.parseInput_(cm, inputStream, params); } catch(e) { - showConfirm(cm, e); + showConfirm(cm, e.toString()); throw e; } var command; @@ -4460,7 +4627,7 @@ if (command.type == 'exToKey') { // Handle Ex to Key mapping. for (var i = 0; i < command.toKeys.length; i++) { - CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); + vimApi.handleKey(cm, command.toKeys[i], 'mapping'); } return; } else if (command.type == 'exToEx') { @@ -4483,7 +4650,7 @@ params.callback(); } } catch(e) { - showConfirm(cm, e); + showConfirm(cm, e.toString()); throw e; } }, @@ -4635,7 +4802,7 @@ var commandName = lhs.substring(1); if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { delete this.commandMap_[commandName]; - return; + return true; } } else { // Key to Ex or key to key mapping @@ -4644,11 +4811,10 @@ if (keys == defaultKeymap[i].keys && defaultKeymap[i].context === ctx) { defaultKeymap.splice(i, 1); - return; + return true; } } } - throw Error('No such mapping.'); } }; @@ -4675,13 +4841,11 @@ vmap: function(cm, params) { this.map(cm, params, 'visual'); }, unmap: function(cm, params, ctx) { var mapArgs = params.args; - if (!mapArgs || mapArgs.length < 1) { + if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) { if (cm) { showConfirm(cm, 'No such mapping: ' + params.input); } - return; } - exCommandDispatcher.unmap(mapArgs[0], ctx); }, move: function(cm, params) { commandDispatcher.processCommand(cm, cm.state.vim, { @@ -4755,12 +4919,12 @@ registers: function(cm, params) { var regArgs = params.args; var registers = vimGlobalState.registerController.registers; - var regInfo = '----------Registers----------

'; + var regInfo = '----------Registers----------\n\n'; if (!regArgs) { for (var registerName in registers) { var text = registers[registerName].toString(); if (text.length) { - regInfo += '"' + registerName + ' ' + text + '
'; + regInfo += '"' + registerName + ' ' + text + '\n' } } } else { @@ -4772,7 +4936,7 @@ continue; } var register = registers[registerName] || new Register(); - regInfo += '"' + registerName + ' ' + register.toString() + '
'; + regInfo += '"' + registerName + ' ' + register.toString() + '\n' } } showConfirm(cm, regInfo); @@ -4809,8 +4973,8 @@ var lineStart = params.line || cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); if (lineStart == lineEnd) { return; } - var curStart = Pos(lineStart, 0); - var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); + var curStart = new Pos(lineStart, 0); + var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd)); var text = cm.getRange(curStart, curEnd).split('\n'); var numberRegex = pattern ? pattern : (number == 'decimal') ? /(-?)([\d]+)/ : @@ -4867,6 +5031,10 @@ } cm.replaceRange(text.join('\n'), curStart, curEnd); }, + vglobal: function(cm, params) { + // global inspects params.commandName + this.global(cm, params); + }, global: function(cm, params) { // a global command is of the form // :[range]g/pattern/[cmd] @@ -4876,6 +5044,7 @@ showConfirm(cm, 'Regular Expression missing from global'); return; } + var inverted = params.commandName[0] === 'v'; // range is specified here var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); @@ -4900,28 +5069,33 @@ // now that we have the regexPart, search for regex matches in the // specified range of lines var query = getSearchState(cm).getQuery(); - var matchedLines = [], content = ''; + var matchedLines = []; for (var i = lineStart; i <= lineEnd; i++) { - var matched = query.test(cm.getLine(i)); - if (matched) { - matchedLines.push(i+1); - content+= cm.getLine(i) + '
'; + var line = cm.getLineHandle(i); + var matched = query.test(line.text); + if (matched !== inverted) { + matchedLines.push(cmd ? line : line.text); } } // if there is no [cmd], just display the list of matched lines if (!cmd) { - showConfirm(cm, content); + showConfirm(cm, matchedLines.join('\n')); return; } var index = 0; var nextCommand = function() { if (index < matchedLines.length) { - var command = matchedLines[index] + cmd; + var line = matchedLines[index++]; + var lineNum = cm.getLineNumber(line); + if (lineNum == null) { + nextCommand(); + return; + } + var command = (lineNum + 1) + cmd; exCommandDispatcher.processCommand(cm, command, { callback: nextCommand }); } - index++; }; nextCommand(); }, @@ -4941,10 +5115,6 @@ regexPart = new RegExp(regexPart).source; //normalize not escaped characters } replacePart = tokens[1]; - if (regexPart && regexPart[regexPart.length - 1] === '$') { - regexPart = regexPart.slice(0, regexPart.length - 1) + '\\n'; - replacePart = replacePart ? replacePart + '\n' : '\n'; - } if (replacePart !== undefined) { if (getOption('pcre')) { replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&")); @@ -4972,11 +5142,9 @@ if (flagsPart) { if (flagsPart.indexOf('c') != -1) { confirm = true; - flagsPart.replace('c', ''); } if (flagsPart.indexOf('g') != -1) { global = true; - flagsPart.replace('g', ''); } if (getOption('pcre')) { regexPart = regexPart + '/' + flagsPart; @@ -5012,7 +5180,7 @@ lineStart = lineEnd; lineEnd = lineStart + count - 1; } - var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); + var startPos = clipCursorToContent(cm, new Pos(lineStart, 0)); var cursor = cm.getSearchCursor(query, startPos); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); }, @@ -5109,7 +5277,7 @@ * @param {Cursor} lineEnd Line to stop replacing at. * @param {RegExp} query Query for performing matches with. * @param {string} replaceWith Text to replace matches with. May contain $1, - * $2, etc for replacing captured groups using Javascript replace. + * $2, etc for replacing captured groups using JavaScript replace. * @param {function()} callback A callback for when the replace is done. */ function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, @@ -5117,7 +5285,7 @@ // Set up all the functions. cm.state.vim.exMode = true; var done = false; - var lastPos = searchCursor.from(); + var lastPos, modifiedLineNumber, joined; function replaceAll() { cm.operation(function() { while (!done) { @@ -5130,14 +5298,26 @@ function replace() { var text = cm.getRange(searchCursor.from(), searchCursor.to()); var newText = text.replace(query, replaceWith); + var unmodifiedLineNumber = searchCursor.to().line; searchCursor.replace(newText); + modifiedLineNumber = searchCursor.to().line; + lineEnd += modifiedLineNumber - unmodifiedLineNumber; + joined = modifiedLineNumber < unmodifiedLineNumber; + } + function findNextValidMatch() { + var lastMatchTo = lastPos && copyCursor(searchCursor.to()); + var match = searchCursor.findNext(); + if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) { + match = searchCursor.findNext(); + } + return match; } function next() { // The below only loops to skip over multiple occurrences on the same // line when 'global' is not true. - while(searchCursor.findNext() && + while(findNextValidMatch() && isInRange(searchCursor.from(), lineStart, lineEnd)) { - if (!global && lastPos && searchCursor.from().line == lastPos.line) { + if (!global && searchCursor.from().line == modifiedLineNumber && !joined) { continue; } cm.scrollIntoView(searchCursor.from(), 30); @@ -5202,7 +5382,7 @@ return; } showPrompt(cm, { - prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', + prefix: dom('span', 'replace with ', dom('strong', replaceWith), ' (y/n/a/q/l)'), onKeyDown: onPromptKeyDown }); } @@ -5300,7 +5480,7 @@ match = (/<\w+-.+?>|<\w+>|./).exec(text); key = match[0]; text = text.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'macro'); + vimApi.handleKey(cm, key, 'macro'); if (vim.insertMode) { var changes = register.insertModeChanges[imc++].changes; vimGlobalState.macroModeState.lastInsertModeChanges.changes = @@ -5395,38 +5575,6 @@ } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); } - if (vim.visualMode) { - updateFakeCursor(cm); - } - } - /** - * Keeps track of a fake cursor to support visual mode cursor behavior. - */ - function updateFakeCursor(cm) { - var className = 'cm-animate-fat-cursor'; - var vim = cm.state.vim; - var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); - var to = offsetCursor(from, 0, 1); - clearFakeCursor(vim); - // In visual mode, the cursor may be positioned over EOL. - if (from.ch == cm.getLine(from.line).length) { - var widget = document.createElement("span"); - widget.textContent = "\u00a0"; - widget.className = className; - vim.fakeCursorBookmark = cm.setBookmark(from, {widget: widget}); - } else { - vim.fakeCursor = cm.markText(from, to, {className: className}); - } - } - function clearFakeCursor(vim) { - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - vim.fakeCursor = null; - } - if (vim.fakeCursorBookmark) { - vim.fakeCursorBookmark.clear(); - vim.fakeCursorBookmark = null; - } } function handleExternalSelection(cm, vim) { var anchor = cm.getCursor('anchor'); @@ -5568,12 +5716,12 @@ if (change instanceof InsertModeKey) { CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); } else if (typeof change == "string") { - var cur = cm.getCursor(); - cm.replaceRange(change, cur, cur); + cm.replaceSelection(change); } else { var start = cm.getCursor(); var end = offsetCursor(start, 0, change[0].length); cm.replaceRange(change[0], start, end); + cm.setCursor(end); } } } diff --git a/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.css b/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.css index 56896500..f4d5718a 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.css +++ b/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.css @@ -60,20 +60,13 @@ .cm-fat-cursor div.CodeMirror-cursors { z-index: 1; } -.cm-fat-cursor-mark { - background-color: rgba(20, 255, 20, 0.5); - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; -} -.cm-animate-fat-cursor { - width: auto; - border: 0; - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; - background-color: #7e7; -} +.cm-fat-cursor .CodeMirror-line::selection, +.cm-fat-cursor .CodeMirror-line > span::selection, +.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; } +.cm-fat-cursor .CodeMirror-line::-moz-selection, +.cm-fat-cursor .CodeMirror-line > span::-moz-selection, +.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; } +.cm-fat-cursor { caret-color: transparent; } @-moz-keyframes blink { 0% {} 50% { background-color: transparent; } @@ -171,6 +164,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} height: 100%; outline: none; /* Prevent dragging from highlighting the element */ position: relative; + z-index: 0; } .CodeMirror-sizer { position: relative; @@ -184,6 +178,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} position: absolute; z-index: 6; display: none; + outline: none; } .CodeMirror-vscrollbar { right: 0; top: 0; diff --git a/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.js b/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.js index 7cee4096..193d445b 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.js +++ b/Mod manager/utils/QNModManager/CodeMirror/lib/codemirror.js @@ -32,7 +32,7 @@ var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); var phantom = /PhantomJS/.test(userAgent); - var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent); + var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2); var android = /Android/.test(userAgent); // This is woefully incomplete. Suggestions for alternative methods welcome. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); @@ -1311,6 +1311,7 @@ if (span.marker == marker) { return span } } } } + // Remove a span from an array, returning undefined if no spans are // left (we don't store arrays for lines without spans). function removeMarkedSpan(spans, span) { @@ -1319,9 +1320,16 @@ { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } return r } + // Add a span to a line. - function addMarkedSpan(line, span) { - line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; + function addMarkedSpan(line, span, op) { + var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet)); + if (inThisOp && inThisOp.has(line.markedSpans)) { + line.markedSpans.push(span); + } else { + line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; + if (inThisOp) { inThisOp.add(line.markedSpans); } + } span.marker.attachLine(line); } @@ -1841,7 +1849,7 @@ } } builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32; - if (style || startStyle || endStyle || mustWrap || css) { + if (style || startStyle || endStyle || mustWrap || css || attributes) { var fullStyle = style || ""; if (startStyle) { fullStyle += startStyle; } if (endStyle) { fullStyle += endStyle; } @@ -2186,6 +2194,7 @@ if (cm.options.lineNumbers || markers) { var wrap$1 = ensureLineWrapped(lineView); var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")); + gutterWrap.setAttribute("aria-hidden", "true"); cm.display.input.setUneditable(gutterWrap); wrap$1.insertBefore(gutterWrap, lineView.text); if (lineView.line.gutterClass) @@ -2342,12 +2351,14 @@ function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } - for (var i = 0; i < lineView.rest.length; i++) - { if (lineView.rest[i] == line) - { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } - for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) - { if (lineNo(lineView.rest[i$1]) > lineN) - { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + if (lineView.rest) { + for (var i = 0; i < lineView.rest.length; i++) + { if (lineView.rest[i] == line) + { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } + for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) + { if (lineNo(lineView.rest[i$1]) > lineN) + { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + } } // Render a line into the hidden node display.externalMeasured. Used @@ -2574,9 +2585,11 @@ } function widgetTopHeight(lineObj) { + var ref = visualLine(lineObj); + var widgets = ref.widgets; var height = 0; - if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) - { height += widgetHeight(lineObj.widgets[i]); } } } + if (widgets) { for (var i = 0; i < widgets.length; ++i) { if (widgets[i].above) + { height += widgetHeight(widgets[i]); } } } return height } @@ -3141,13 +3154,19 @@ var curFragment = result.cursors = document.createDocumentFragment(); var selFragment = result.selection = document.createDocumentFragment(); + var customCursor = cm.options.$customCursor; + if (customCursor) { primary = true; } for (var i = 0; i < doc.sel.ranges.length; i++) { if (!primary && i == doc.sel.primIndex) { continue } var range = doc.sel.ranges[i]; if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } var collapsed = range.empty(); - if (collapsed || cm.options.showCursorWhenSelecting) - { drawSelectionCursor(cm, range.head, curFragment); } + if (customCursor) { + var head = customCursor(cm, range); + if (head) { drawSelectionCursor(cm, head, curFragment); } + } else if (collapsed || cm.options.showCursorWhenSelecting) { + drawSelectionCursor(cm, range.head, curFragment); + } if (!collapsed) { drawSelectionRange(cm, range, selFragment); } } @@ -3163,6 +3182,12 @@ cursor.style.top = pos.top + "px"; cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; + if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) { + var charPos = charCoords(cm, head, "div", null, null); + var width = charPos.right - charPos.left; + cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px"; + } + if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); @@ -3276,26 +3301,31 @@ var on = true; display.cursorDiv.style.visibility = ""; if (cm.options.cursorBlinkRate > 0) - { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; }, - cm.options.cursorBlinkRate); } + { display.blinker = setInterval(function () { + if (!cm.hasFocus()) { onBlur(cm); } + display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; + }, cm.options.cursorBlinkRate); } else if (cm.options.cursorBlinkRate < 0) { display.cursorDiv.style.visibility = "hidden"; } } function ensureFocus(cm) { - if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); } + if (!cm.hasFocus()) { + cm.display.input.focus(); + if (!cm.state.focused) { onFocus(cm); } + } } function delayBlurEvent(cm) { cm.state.delayingBlurEvent = true; setTimeout(function () { if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; - onBlur(cm); + if (cm.state.focused) { onBlur(cm); } } }, 100); } function onFocus(cm, e) { - if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; } + if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; } if (cm.options.readOnly == "nocursor") { return } if (!cm.state.focused) { @@ -3330,10 +3360,14 @@ function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; + var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top); + var oldHeight = display.lineDiv.getBoundingClientRect().top; + var mustScroll = 0; for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], wrapping = cm.options.lineWrapping; var height = (void 0), width = 0; if (cur.hidden) { continue } + oldHeight += cur.line.height; if (ie && ie_version < 8) { var bot = cur.node.offsetTop + cur.node.offsetHeight; height = bot - prevBottom; @@ -3348,6 +3382,7 @@ } var diff = cur.line.height - height; if (diff > .005 || diff < -.005) { + if (oldHeight < viewTop) { mustScroll -= diff; } updateLineHeight(cur.line, height); updateWidgetHeight(cur.line); if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) @@ -3362,6 +3397,7 @@ } } } + if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; } } // Read and store the height of line widgets associated with the @@ -3425,8 +3461,8 @@ // Set pos and end to the cursor positions around the character pos sticks to // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch // If pos == Pos(_, 0, "before"), pos and end are unchanged - pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos; end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos; + pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos; } for (var limit = 0; limit < 5; limit++) { var changed = false; @@ -3477,14 +3513,15 @@ if (newTop != screentop) { result.scrollTop = newTop; } } - var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft; - var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0); + var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth; + var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace; + var screenw = displayWidth(cm) - display.gutters.offsetWidth; var tooWide = rect.right - rect.left > screenw; if (tooWide) { rect.right = rect.left + screenw; } if (rect.left < 10) { result.scrollLeft = 0; } else if (rect.left < screenleft) - { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); } + { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); } else if (rect.right > screenw + screenleft - 3) { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; } return result @@ -3621,6 +3658,7 @@ this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; } else { + this.vert.scrollTop = 0; this.vert.style.display = ""; this.vert.firstChild.style.height = "0"; } @@ -3776,7 +3814,8 @@ scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet scrollToPos: null, // Used to scroll to a specific position focus: false, - id: ++nextOpId // Unique ID + id: ++nextOpId, // Unique ID + markArrays: null // Used by addMarkedSpan }; pushOperation(cm.curOp); } @@ -4229,6 +4268,8 @@ function updateGutterSpace(display) { var width = display.gutters.offsetWidth; display.sizer.style.marginLeft = width + "px"; + // Send an event to consumers responding to changes in gutter width. + signalLater(display, "gutterChanged", display); } function setDocumentHeight(cm, measure) { @@ -4368,6 +4409,10 @@ // The element in which the editor lives. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); + // This attribute is respected by automatic translation systems such as Google Translate, + // and may also be respected by tools used by human translators. + d.wrapper.setAttribute('translate', 'no'); + // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; } @@ -4465,6 +4510,12 @@ function onScrollWheel(cm, e) { var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; + var pixelsPerUnit = wheelPixelsPerUnit; + if (e.deltaMode === 0) { + dx = e.deltaX; + dy = e.deltaY; + pixelsPerUnit = 1; + } var display = cm.display, scroll = display.scroller; // Quit if there's nothing to scroll here @@ -4493,10 +4544,10 @@ // estimated pixels/delta value, we just handle horizontal // scrolling entirely here. It'll be slightly off from native, but // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dx && !gecko && !presto && pixelsPerUnit != null) { if (dy && canScrollY) - { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); } - setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); + { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); } + setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit)); // Only prevent default scrolling if vertical scrolling is // actually possible. Otherwise, it causes vertical scroll // jitter on OSX trackpads when deltaX is small and deltaY @@ -4509,15 +4560,15 @@ // 'Project' the visible viewport to cover the area that is being // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - var pixels = dy * wheelPixelsPerUnit; + if (dy && pixelsPerUnit != null) { + var pixels = dy * pixelsPerUnit; var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; if (pixels < 0) { top = Math.max(0, top + pixels - 50); } else { bot = Math.min(cm.doc.height, bot + pixels + 50); } updateDisplaySimple(cm, {top: top, bottom: bot}); } - if (wheelSamples < 20) { + if (wheelSamples < 20 && e.deltaMode !== 0) { if (display.wheelStartX == null) { display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; display.wheelDX = dx; display.wheelDY = dy; @@ -4776,6 +4827,7 @@ estimateLineHeights(cm); loadMode(cm); setDirectionClass(cm); + cm.options.direction = doc.direction; if (!cm.options.lineWrapping) { findMaxLine(cm); } cm.options.mode = doc.modeOption; regChange(cm); @@ -4792,19 +4844,19 @@ }); } - function History(startGen) { + function History(prev) { // Arrays of change events and selections. Doing something adds an // event to done and clears undo. Undoing moves events from done // to undone, redoing moves them in the other direction. this.done = []; this.undone = []; - this.undoDepth = Infinity; + this.undoDepth = prev ? prev.undoDepth : Infinity; // Used to track when changes can be merged into a single undo // event this.lastModTime = this.lastSelTime = 0; this.lastOp = this.lastSelOp = null; this.lastOrigin = this.lastSelOrigin = null; // Used by the isClean() method - this.generation = this.maxGeneration = startGen || 1; + this.generation = this.maxGeneration = prev ? prev.maxGeneration : 1; } // Create a history change event from an updateDoc-style change @@ -5109,7 +5161,7 @@ (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1); setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true)); - if (!(options && options.scroll === false) && doc.cm) + if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor") { ensureCursorVisible(doc.cm); } } @@ -5766,7 +5818,7 @@ changeLine(doc, handle, "widget", function (line) { var widgets = line.widgets || (line.widgets = []); if (widget.insertAt == null) { widgets.push(widget); } - else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); } + else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); } widget.line = line; if (cm && !lineIsHidden(doc, line)) { var aboveVisible = heightAtLine(line) < doc.scrollTop; @@ -5952,7 +6004,7 @@ if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } addMarkedSpan(line, new MarkedSpan(marker, curLine == from.line ? from.ch : null, - curLine == to.line ? to.ch : null)); + curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp); ++curLine; }); // lineIsHidden depends on the presence of the spans, so needs a second pass @@ -6124,6 +6176,7 @@ getRange: function(from, to, lineSep) { var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); if (lineSep === false) { return lines } + if (lineSep === '') { return lines.join('') } return lines.join(lineSep || this.lineSeparator()) }, @@ -6175,7 +6228,7 @@ var out = []; for (var i = 0; i < ranges.length; i++) { out[i] = new Range(clipPos(this, ranges[i].anchor), - clipPos(this, ranges[i].head)); } + clipPos(this, ranges[i].head || ranges[i].anchor)); } if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); } setSelection(this, normalizeSelection(this.cm, out, primary), options); }), @@ -6238,7 +6291,7 @@ clearHistory: function() { var this$1 = this; - this.history = new History(this.history.maxGeneration); + this.history = new History(this.history); linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true); }, @@ -6259,7 +6312,7 @@ undone: copyHistoryArray(this.history.undone)} }, setHistory: function(histData) { - var hist = this.history = new History(this.history.maxGeneration); + var hist = this.history = new History(this.history); hist.done = copyHistoryArray(histData.done.slice(0), null, true); hist.undone = copyHistoryArray(histData.undone.slice(0), null, true); }, @@ -6678,10 +6731,9 @@ // Very basic readline/emacs-style bindings, which are standard on Mac. keyMap.emacsy = { "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", - "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", - "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", - "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", - "Ctrl-O": "openLine" + "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", + "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", + "Ctrl-T": "transposeChars", "Ctrl-O": "openLine" }; keyMap.macDefault = { "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", @@ -7002,7 +7054,7 @@ goGroupRight: function (cm) { return cm.moveH(1, "group"); }, goGroupLeft: function (cm) { return cm.moveH(-1, "group"); }, goWordRight: function (cm) { return cm.moveH(1, "word"); }, - delCharBefore: function (cm) { return cm.deleteH(-1, "char"); }, + delCharBefore: function (cm) { return cm.deleteH(-1, "codepoint"); }, delCharAfter: function (cm) { return cm.deleteH(1, "char"); }, delWordBefore: function (cm) { return cm.deleteH(-1, "word"); }, delWordAfter: function (cm) { return cm.deleteH(1, "word"); }, @@ -7375,6 +7427,10 @@ var dragEnd = operation(cm, function (e) { if (webkit) { display.scroller.draggable = false; } cm.state.draggingText = false; + if (cm.state.delayingBlurEvent) { + if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; } + else { delayBlurEvent(cm); } + } off(display.wrapper.ownerDocument, "mouseup", dragEnd); off(display.wrapper.ownerDocument, "mousemove", mouseMove); off(display.scroller, "dragstart", dragStart); @@ -7398,15 +7454,15 @@ if (webkit) { display.scroller.draggable = true; } cm.state.draggingText = dragEnd; dragEnd.copy = !behavior.moveOnDrag; - // IE's approach to draggable - if (display.scroller.dragDrop) { display.scroller.dragDrop(); } on(display.wrapper.ownerDocument, "mouseup", dragEnd); on(display.wrapper.ownerDocument, "mousemove", mouseMove); on(display.scroller, "dragstart", dragStart); on(display.scroller, "drop", dragEnd); - delayBlurEvent(cm); + cm.state.delayingBlurEvent = true; setTimeout(function () { return display.input.focus(); }, 20); + // IE's approach to draggable + if (display.scroller.dragDrop) { display.scroller.dragDrop(); } } function rangeForUnit(cm, pos, unit) { @@ -7419,6 +7475,7 @@ // Normal selection, as opposed to text dragging. function leftButtonSelect(cm, event, start, behavior) { + if (ie) { delayBlurEvent(cm); } var display = cm.display, doc = cm.doc; e_preventDefault(event); @@ -7697,7 +7754,7 @@ for (var i = newBreaks.length - 1; i >= 0; i--) { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } }); - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { + option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); if (old != Init) { cm.refresh(); } }); @@ -7877,7 +7934,9 @@ attachDoc(this, doc); if ((options.autofocus && !mobile) || this.hasFocus()) - { setTimeout(bind(onFocus, this), 20); } + { setTimeout(function () { + if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); } + }, 20); } else { onBlur(this); } @@ -8186,7 +8245,7 @@ } function hiddenTextarea() { - var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); + var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"); var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); // The textarea is kept positioned near the cursor to prevent the // fact that it'll be scrolled into view on input from scrolling @@ -8640,14 +8699,14 @@ } // Used for horizontal relative motion. Dir is -1 or 1 (left or - // right), unit can be "char", "column" (like char, but doesn't - // cross line boundaries), "word" (across next word), or "group" (to - // the start of next group of word or non-word-non-whitespace - // chars). The visually param controls whether, in right-to-left - // text, direction 1 means to move towards the next index in the - // string, or towards the character to the right of the current - // position. The resulting position will have a hitSide=true - // property if it reached the end of the document. + // right), unit can be "codepoint", "char", "column" (like char, but + // doesn't cross line boundaries), "word" (across next word), or + // "group" (to the start of next group of word or + // non-word-non-whitespace chars). The visually param controls + // whether, in right-to-left text, direction 1 means to move towards + // the next index in the string, or towards the character to the right + // of the current position. The resulting position will have a + // hitSide=true property if it reached the end of the document. function findPosH(doc, pos, dir, unit, visually) { var oldPos = pos; var origDir = dir; @@ -8661,7 +8720,15 @@ } function moveOnce(boundToLine) { var next; - if (visually) { + if (unit == "codepoint") { + var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1)); + if (isNaN(ch)) { + next = null; + } else { + var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF; + next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir); + } + } else if (visually) { next = moveVisually(doc.cm, lineObj, pos, dir); } else { next = moveLogically(lineObj, pos, dir); @@ -8677,7 +8744,7 @@ return true } - if (unit == "char") { + if (unit == "char" || unit == "codepoint") { moveOnce(); } else if (unit == "column") { moveOnce(true); @@ -8745,6 +8812,7 @@ var input = this, cm = input.cm; var div = input.div = display.lineDiv; + div.contentEditable = true; disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize); function belongsToInput(e) { @@ -8811,7 +8879,7 @@ var kludge = hiddenTextarea(), te = kludge.firstChild; cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); te.value = lastCopied.text.join("\n"); - var hadFocus = document.activeElement; + var hadFocus = activeElt(); selectInput(te); setTimeout(function () { cm.display.lineSpace.removeChild(kludge); @@ -8834,7 +8902,7 @@ ContentEditableInput.prototype.prepareSelection = function () { var result = prepareSelection(this.cm, false); - result.focus = document.activeElement == this.div; + result.focus = activeElt() == this.div; return result }; @@ -8930,7 +8998,7 @@ ContentEditableInput.prototype.focus = function () { if (this.cm.options.readOnly != "nocursor") { - if (!this.selectionInEditor() || document.activeElement != this.div) + if (!this.selectionInEditor() || activeElt() != this.div) { this.showSelection(this.prepareSelection(), true); } this.div.focus(); } @@ -8941,9 +9009,11 @@ ContentEditableInput.prototype.supportsTouch = function () { return true }; ContentEditableInput.prototype.receivedFocus = function () { + var this$1 = this; + var input = this; if (this.selectionInEditor()) - { this.pollSelection(); } + { setTimeout(function () { return this$1.pollSelection(); }, 20); } else { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } @@ -9621,6 +9691,7 @@ TextareaInput.prototype.readOnlyChanged = function (val) { if (!val) { this.reset(); } this.textarea.disabled = val == "nocursor"; + this.textarea.readOnly = !!val; }; TextareaInput.prototype.setUneditable = function () {}; @@ -9771,7 +9842,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.57.0"; + CodeMirror.version = "5.65.2"; return CodeMirror; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/asn.1/asn.1.js b/Mod manager/utils/QNModManager/CodeMirror/mode/asn.1/asn.1.js index d3ecb087..df1330b6 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/asn.1/asn.1.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/asn.1/asn.1.js @@ -190,7 +190,7 @@ " NetworkAddress BITS BMPString TimeStamp TimeTicks" + " TruthValue RowStatus DisplayString GeneralString" + " GraphicString IA5String NumericString" + - " PrintableString SnmpAdminAtring TeletexString" + + " PrintableString SnmpAdminString TeletexString" + " UTF8String VideotexString VisibleString StringStore" + " ISO646String T61String UniversalString Unsigned32" + " Integer32 Gauge Gauge32 Counter Counter32 Counter64"), diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/clike/clike.js b/Mod manager/utils/QNModManager/CodeMirror/mode/clike/clike.js index 37da2ec9..863992d8 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/clike/clike.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/clike/clike.js @@ -82,15 +82,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { state.tokenize = tokenString(ch); return state.tokenize(stream, state); } - if (isPunctuationChar.test(ch)) { - curPunc = ch; - return null; - } if (numberStart.test(ch)) { stream.backUp(1) if (stream.match(number)) return "number" stream.next() } + if (isPunctuationChar.test(ch)) { + curPunc = ch; + return null; + } if (ch == "/") { if (stream.eat("*")) { state.tokenize = tokenComment; @@ -350,8 +350,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { function cpp11StringHook(stream, state) { stream.backUp(1); // Raw strings. - if (stream.match(/(R|u8R|uR|UR|LR)/)) { - var match = stream.match(/"([^\s\\()]{0,16})\(/); + if (stream.match(/^(?:R|u8R|uR|UR|LR)/)) { + var match = stream.match(/^"([^\s\\()]{0,16})\(/); if (!match) { return false; } @@ -360,8 +360,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { return tokenRawString(stream, state); } // Unicode strings/chars. - if (stream.match(/(u8|u|U|L)/)) { - if (stream.match(/["']/, /* eat */ false)) { + if (stream.match(/^(?:u8|u|U|L)/)) { + if (stream.match(/^["']/, /* eat */ false)) { return "string"; } return false; @@ -484,7 +484,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "instanceof interface native new package private protected public " + "return static strictfp super switch synchronized this throw throws transient " + "try volatile while @interface"), - types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " + + types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float " + "Integer Long Number Object Short String StringBuffer StringBuilder Void"), blockKeywords: words("catch class do else finally for if switch try while"), defKeywords: words("class interface enum @interface"), @@ -498,6 +498,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { stream.eatWhile(/[\w\$_]/); return "meta"; + }, + '"': function(stream, state) { + if (!stream.match('""\n')) return false; + state.tokenize = tokenTripleString; + return state.tokenize(stream, state); } }, modeProps: {fold: ["brace", "import"]} @@ -659,7 +664,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "file import where by get set abstract enum open inner override private public internal " + "protected catch finally out final vararg reified dynamic companion constructor init " + "sealed field property receiver param sparam lateinit data inline noinline tailrec " + - "external annotation crossinline const operator infix suspend actual expect setparam" + "external annotation crossinline const operator infix suspend actual expect setparam value" ), types: words( /* package java.lang */ @@ -749,7 +754,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " + "gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " + "gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " + - "gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose " + + "gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose " + "gl_ProjectionMatrixInverseTranspose " + "gl_ModelViewProjectionMatrixInverseTranspose " + "gl_TextureMatrixInverseTranspose " + diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/clike/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/clike/index.html index 0cfae214..b1c88190 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/clike/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/clike/index.html @@ -148,7 +148,7 @@

Objective-C example

*/ #import "MyClass.h" -#import +#import @import BFrameworkModule; NS_ENUM(SomeValues) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/clojure/clojure.js b/Mod manager/utils/QNModManager/CodeMirror/mode/clojure/clojure.js index 25d308ab..0b9d6acc 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/clojure/clojure.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/clojure/clojure.js @@ -160,10 +160,10 @@ CodeMirror.defineMode("clojure", function (options) { var numberLiteral = /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/; var characterLiteral = /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/; - // simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*/ + // simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*/ // simple-symbol := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/ // qualified-symbol := ((<.>)*)? - var qualifiedSymbol = /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/; + var qualifiedSymbol = /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/; function base(stream, state) { if (stream.eatSpace() || stream.eat(",")) return ["space", null]; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/cobol/cobol.js b/Mod manager/utils/QNModManager/CodeMirror/mode/cobol/cobol.js index 275857b4..a7aeafa0 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/cobol/cobol.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/cobol/cobol.js @@ -195,7 +195,7 @@ CodeMirror.defineMode("cobol", function () { case "string": // multi-line string parsing mode var next = false; while ((next = stream.next()) != null) { - if (next == "\"" || next == "\'") { + if ((next == "\"" || next == "\'") && !stream.match(/['"]/, false)) { state.mode = false; break; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/commonlisp/commonlisp.js b/Mod manager/utils/QNModManager/CodeMirror/mode/commonlisp/commonlisp.js index 52abbb25..e8528a9c 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/commonlisp/commonlisp.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/commonlisp/commonlisp.js @@ -114,6 +114,7 @@ CodeMirror.defineMode("commonlisp", function (config) { closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;", + fold: "brace-paren", blockCommentStart: "#|", blockCommentEnd: "|#" }; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/crystal/crystal.js b/Mod manager/utils/QNModManager/CodeMirror/mode/crystal/crystal.js index 5c601c6a..5dae5032 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/crystal/crystal.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/crystal/crystal.js @@ -164,10 +164,10 @@ } else { if(delim = stream.match(/^%([^\w\s=])/)) { delim = delim[1]; - } else if (stream.match(/^%[a-zA-Z0-9_\u009F-\uFFFF]*/)) { + } else if (stream.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/)) { // Macro variables return "meta"; - } else { + } else if (stream.eat('%')) { // '%' operator return "operator"; } @@ -194,17 +194,17 @@ // Numbers if (stream.eat("0")) { if (stream.eat("x")) { - stream.match(/^[0-9a-fA-F]+/); + stream.match(/^[0-9a-fA-F_]+/); } else if (stream.eat("o")) { - stream.match(/^[0-7]+/); + stream.match(/^[0-7_]+/); } else if (stream.eat("b")) { - stream.match(/^[01]+/); + stream.match(/^[01_]+/); } return "number"; } if (stream.eat(/^\d/)) { - stream.match(/^\d*(?:\.\d+)?(?:[eE][+-]?\d+)?/); + stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/); return "number"; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/css/css.js b/Mod manager/utils/QNModManager/CodeMirror/mode/css/css.js index 77ca0c10..503c48c2 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/css/css.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/css/css.js @@ -29,7 +29,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) { valueKeywords = parserConfig.valueKeywords || {}, allowNested = parserConfig.allowNested, lineComment = parserConfig.lineComment, - supportsAtComponent = parserConfig.supportsAtComponent === true; + supportsAtComponent = parserConfig.supportsAtComponent === true, + highlightNonStandardPropertyKeywords = config.highlightNonStandardPropertyKeywords !== false; var type, override; function ret(style, tp) { type = tp; return style; } @@ -77,8 +78,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) { return ret("qualifier", "qualifier"); } else if (/[:;{}\[\]\(\)]/.test(ch)) { return ret(null, ch); - } else if (stream.match(/[\w-.]+(?=\()/)) { - if (/^(url(-prefix)?|domain|regexp)$/.test(stream.current().toLowerCase())) { + } else if (stream.match(/^[\w-.]+(?=\()/)) { + if (/^(url(-prefix)?|domain|regexp)$/i.test(stream.current())) { state.tokenize = tokenParenthesized; } return ret("variable callee", "variable"); @@ -107,7 +108,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { function tokenParenthesized(stream, state) { stream.next(); // Must be '(' - if (!stream.match(/\s*[\"\')]/, false)) + if (!stream.match(/^\s*[\"\')]/, false)) state.tokenize = tokenString(")"); else state.tokenize = null; @@ -197,7 +198,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { override = "property"; return "maybeprop"; } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) { - override = "string-2"; + override = highlightNonStandardPropertyKeywords ? "string-2" : "property"; return "maybeprop"; } else if (allowNested) { override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag"; @@ -291,7 +292,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { else if (propertyKeywords.hasOwnProperty(word)) override = "property"; else if (nonStandardPropertyKeywords.hasOwnProperty(word)) - override = "string-2"; + override = highlightNonStandardPropertyKeywords ? "string-2" : "property"; else if (valueKeywords.hasOwnProperty(word)) override = "atom"; else if (colorKeywords.hasOwnProperty(word)) @@ -442,13 +443,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "monochrome", "min-monochrome", "max-monochrome", "resolution", "min-resolution", "max-resolution", "scan", "grid", "orientation", "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", - "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme" + "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme", + "dynamic-range", "video-dynamic-range" ], mediaFeatures = keySet(mediaFeatures_); var mediaValueKeywords_ = [ "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "interlace", "progressive", - "dark", "light" + "dark", "light", + "standard", "high" ], mediaValueKeywords = keySet(mediaValueKeywords_); var propertyKeywords_ = [ @@ -481,7 +484,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "cue-before", "cursor", "direction", "display", "dominant-baseline", "drop-initial-after-adjust", "drop-initial-after-align", "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size", - "drop-initial-value", "elevation", "empty-cells", "fit", "fit-position", + "drop-initial-value", "elevation", "empty-cells", "fit", "fit-content", "fit-position", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into", "font", "font-family", "font-feature-settings", "font-kerning", @@ -563,7 +566,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { ], propertyKeywords = keySet(propertyKeywords_); var nonStandardPropertyKeywords_ = [ - "border-block", "border-block-color", "border-block-end", + "accent-color", "aspect-ratio", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-style", "border-block-width", @@ -571,9 +574,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", - "border-inline-style", "border-inline-width", "margin-block", + "border-inline-style", "border-inline-width", "content-visibility", "margin-block", "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end", - "margin-inline-start", "padding-block", "padding-block-end", + "margin-inline-start", "overflow-anchor", "overscroll-behavior", "padding-block", "padding-block-end", "padding-block-start", "padding-inline", "padding-inline-end", "padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color", "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", @@ -597,16 +600,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", - "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", + "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", - "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", - "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", + "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", + "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", - "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", - "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", + "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", + "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", @@ -616,7 +619,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", - "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", + "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen" ], colorKeywords = keySet(colorKeywords_); @@ -627,21 +630,21 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary", - "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", - "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", + "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box", + "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", - "compact", "condensed", "contain", "content", "contents", - "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", - "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", + "compact", "condensed", "conic-gradient", "contain", "content", "contents", + "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop", + "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", - "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", + "dotted", "double", "down", "drop-shadow", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", @@ -651,10 +654,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", - "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", + "forwards", "from", "geometricPrecision", "georgian", "grayscale", "graytext", "grid", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", "help", "hidden", "hide", "higher", "highlight", "highlighttext", - "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", + "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "hue-rotate", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", @@ -684,15 +687,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", - "relative", "repeat", "repeating-linear-gradient", - "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", + "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", + "repeating-conic-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", - "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", + "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end", - "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", + "semi-condensed", "semi-expanded", "separate", "sepia", "serif", "show", "sidama", "simp-chinese-formal", "simp-chinese-informal", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", @@ -780,7 +783,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { } }, ":": function(stream) { - if (stream.match(/\s*\{/, false)) + if (stream.match(/^\s*\{/, false)) return [null, null] return false; }, diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/css/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/css/index.html index 6588c408..42b327ca 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/css/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/css/index.html @@ -68,6 +68,12 @@

CSS mode

}); +

CSS mode supports this option:

+ +
highlightNonStandardPropertyKeywords: boolean
+
Whether to highlight non-standard CSS property keywords such as margin-inline or zoom (default: true).
+
+

MIME types defined: text/css, text/x-scss (demo), text/x-less (demo).

Parsing/Highlighting Tests: normal, verbose.

diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/cypher/cypher.js b/Mod manager/utils/QNModManager/CodeMirror/mode/cypher/cypher.js index aa76eb9e..6203d599 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/cypher/cypher.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/cypher/cypher.js @@ -19,13 +19,14 @@ CodeMirror.defineMode("cypher", function(config) { var tokenBase = function(stream/*, state*/) { + curPunc = null var ch = stream.next(); if (ch ==='"') { - stream.match(/.*?"/); + stream.match(/^[^"]*"/); return "string"; } if (ch === "'") { - stream.match(/.*?'/); + stream.match(/^[^']*'/); return "string"; } if (/[{}\(\),\.;\[\]]/.test(ch)) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/dtd/dtd.js b/Mod manager/utils/QNModManager/CodeMirror/mode/dtd/dtd.js index 74b8c6bd..1bff91cb 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/dtd/dtd.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/dtd/dtd.js @@ -34,7 +34,7 @@ CodeMirror.defineMode("dtd", function(config) { state.tokenize = inBlock("meta", "?>"); return ret("meta", ch); } else if (ch == "#" && stream.eatWhile(/[\w]/)) return ret("atom", "tag"); - else if (ch == "|") return ret("keyword", "seperator"); + else if (ch == "|") return ret("keyword", "separator"); else if (ch.match(/[\(\)\[\]\-\.,\+\?>]/)) return ret(null, ch);//if(ch === ">") return ret(null, "endtag"); else else if (ch.match(/[\[\]]/)) return ret("rule", ch); else if (ch == "\"" || ch == "'") { @@ -112,7 +112,7 @@ CodeMirror.defineMode("dtd", function(config) { indent: function(state, textAfter) { var n = state.stack.length; - if( textAfter.match(/\]\s+|\]/) )n=n-1; + if( textAfter.charAt(0) === ']' )n--; else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){ if(textAfter.substr(0,1) === "<") {} else if( type == "doindent" && textAfter.length > 1 ) {} diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/ebnf/ebnf.js b/Mod manager/utils/QNModManager/CodeMirror/mode/ebnf/ebnf.js index 238bbe23..d8fb3f3a 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/ebnf/ebnf.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/ebnf/ebnf.js @@ -41,10 +41,10 @@ state.stringType = stream.peek(); stream.next(); // Skip quote state.stack.unshift(stateType._string); - } else if (stream.match(/^\/\*/)) { //comments starting with /* + } else if (stream.match('/*')) { //comments starting with /* state.stack.unshift(stateType.comment); state.commentType = commentType.slash; - } else if (stream.match(/^\(\*/)) { //comments starting with (* + } else if (stream.match('(*')) { //comments starting with (* state.stack.unshift(stateType.comment); state.commentType = commentType.parenthesis; } @@ -69,10 +69,10 @@ case stateType.comment: while (state.stack[0] === stateType.comment && !stream.eol()) { - if (state.commentType === commentType.slash && stream.match(/\*\//)) { + if (state.commentType === commentType.slash && stream.match('*/')) { state.stack.shift(); // Clear flag state.commentType = null; - } else if (state.commentType === commentType.parenthesis && stream.match(/\*\)/)) { + } else if (state.commentType === commentType.parenthesis && stream.match('*)')) { state.stack.shift(); // Clear flag state.commentType = null; } else { @@ -83,7 +83,7 @@ case stateType.characterClass: while (state.stack[0] === stateType.characterClass && !stream.eol()) { - if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) { + if (!(stream.match(/^[^\]\\]+/) || stream.match('.'))) { state.stack.shift(); } } @@ -168,10 +168,10 @@ } } - if (stream.match(/^\/\//)) { + if (stream.match('//')) { stream.skipToEnd(); return "comment"; - } else if (stream.match(/return/)) { + } else if (stream.match('return')) { return "operator"; } else if (stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)) { if (stream.match(/(?=[\(.])/)) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/erlang/erlang.js b/Mod manager/utils/QNModManager/CodeMirror/mode/erlang/erlang.js index f0541bb9..d827296f 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/erlang/erlang.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/erlang/erlang.js @@ -339,8 +339,8 @@ CodeMirror.defineMode("erlang", function(cmCfg) { } function lookahead(stream) { - var m = stream.match(/([\n\s]+|%[^\n]*\n)*(.)/,false); - return m ? m.pop() : ""; + var m = stream.match(/^\s*([^\s%])/, false) + return m ? m[1] : ""; } function is_member(element,list) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/factor/factor.js b/Mod manager/utils/QNModManager/CodeMirror/mode/factor/factor.js index 7108278c..d3f7d499 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/factor/factor.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/factor/factor.js @@ -16,7 +16,7 @@ "use strict"; CodeMirror.defineSimpleMode("factor", { - // The start state contains the rules that are intially used + // The start state contains the rules that are initially used start: [ // comments {regex: /#?!.*/, token: "comment"}, @@ -77,7 +77,7 @@ // specific to simple modes. meta: { dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"], - lineComment: [ "!", "#!" ] + lineComment: "!" } }); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/factor/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/factor/index.html index 574d402d..6a77230d 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/factor/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/factor/index.html @@ -70,7 +70,7 @@

Factor mode

});

-

Simple mode that handles Factor Syntax (Factor on WikiPedia).

+

Simple mode that handles Factor Syntax (Factor on Wikipedia).

MIME types defined: text/x-factor.

diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/fcl/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/fcl/index.html index e51fa166..9194dfdd 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/fcl/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/fcl/index.html @@ -61,7 +61,7 @@

FCL mode

END_FUZZIFY DEFUZZIFY ProbabilityAccess - TERM hight := 1; + TERM height := 1; TERM medium := 0.5; TERM low := 0; ACCU: MAX; @@ -70,7 +70,7 @@

FCL mode

END_DEFUZZIFY DEFUZZIFY ProbabilityDistribution - TERM hight := 1; + TERM height := 1; TERM medium := 0.5; TERM low := 0; ACCU: MAX; @@ -80,14 +80,14 @@

FCL mode

RULEBLOCK No1 AND : MIN; - RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS hight; - RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS hight; + RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS height; + RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS height; RULE 3 : IF TimeDay IS inside AND ApplicateHost IS few THEN ProbabilityAccess IS low; END_RULEBLOCK RULEBLOCK No2 AND : MIN; - RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS hight; + RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS height; END_RULEBLOCK END_FUNCTION_BLOCK diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/forth/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/forth/index.html index c6f0b5c5..6b6477ca 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/forth/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/forth/index.html @@ -68,7 +68,7 @@

Forth mode

}); -

Simple mode that handle Forth-Syntax (Forth on WikiPedia).

+

Simple mode that handle Forth-Syntax (Forth on Wikipedia).

MIME types defined: text/x-forth.

diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/fortran/fortran.js b/Mod manager/utils/QNModManager/CodeMirror/mode/fortran/fortran.js index 85bacc42..c33cf63e 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/fortran/fortran.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/fortran/fortran.js @@ -112,7 +112,7 @@ CodeMirror.defineMode("fortran", function() { "c_short", "c_signed_char", "c_size_t", "character", "complex", "double", "integer", "logical", "real"]); var isOperatorChar = /[+\-*&=<>\/\:]/; - var litOperator = new RegExp("(\.and\.|\.or\.|\.eq\.|\.lt\.|\.le\.|\.gt\.|\.ge\.|\.ne\.|\.not\.|\.eqv\.|\.neqv\.)", "i"); + var litOperator = /^\.(and|or|eq|lt|le|gt|ge|ne|not|eqv|neqv)\./i; function tokenBase(stream, state) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/gas/gas.js b/Mod manager/utils/QNModManager/CodeMirror/mode/gas/gas.js index e34d7a7b..016dc29d 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/gas/gas.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/gas/gas.js @@ -144,18 +144,26 @@ CodeMirror.defineMode("gas", function(_config, parserConfig) { function x86(_parserConfig) { lineCommentStartSymbol = "#"; + registers.al = "variable"; + registers.ah = "variable"; registers.ax = "variable"; registers.eax = "variable-2"; registers.rax = "variable-3"; + registers.bl = "variable"; + registers.bh = "variable"; registers.bx = "variable"; registers.ebx = "variable-2"; registers.rbx = "variable-3"; + registers.cl = "variable"; + registers.ch = "variable"; registers.cx = "variable"; registers.ecx = "variable-2"; registers.rcx = "variable-3"; + registers.dl = "variable"; + registers.dh = "variable"; registers.dx = "variable"; registers.edx = "variable-2"; registers.rdx = "variable-3"; @@ -302,11 +310,11 @@ CodeMirror.defineMode("gas", function(_config, parserConfig) { } if (ch === '{') { - return "braket"; + return "bracket"; } if (ch === '}') { - return "braket"; + return "bracket"; } if (/\d/.test(ch)) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/gfm/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/gfm/test.js index d933896a..e2002879 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/gfm/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/gfm/test.js @@ -92,7 +92,7 @@ "[em *foo ][em&link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]"); MT("wordSHA", - "ask for feedbac") + "ask for feedback") MT("num", "foo [link #1] bar"); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/haml/haml.js b/Mod manager/utils/QNModManager/CodeMirror/mode/haml/haml.js index 3c8f505e..d941d974 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/haml/haml.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/haml/haml.js @@ -72,7 +72,7 @@ } } - // donot handle --> as valid ruby, make it HTML close comment instead + // do not handle --> as valid ruby, make it HTML close comment instead if (state.startOfLine && !stream.match("-->", false) && (ch == "=" || ch == "-" )) { state.tokenize = ruby; return state.tokenize(stream, state); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/htmlembedded/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/htmlembedded/index.html index b1cafde9..d17afec8 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/htmlembedded/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/htmlembedded/index.html @@ -55,6 +55,6 @@

Html Embedded Scripts mode

JavaScript, CSS and XML.
Other dependencies include those of the scripting language chosen.

MIME types defined: application/x-aspx (ASP.NET), - application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages) + application/x-ejs (Embedded JavaScript), application/x-jsp (JavaServer Pages) and application/x-erb

diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/htmlmixed/htmlmixed.js b/Mod manager/utils/QNModManager/CodeMirror/mode/htmlmixed/htmlmixed.js index 8341ac82..af313817 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/htmlmixed/htmlmixed.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/htmlmixed/htmlmixed.js @@ -50,7 +50,7 @@ } function getTagRegexp(tagName, anchored) { - return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i"); + return new RegExp((anchored ? "^" : "") + "<\/\\s*" + tagName + "\\s*>", "i"); } function addTags(from, to) { @@ -74,7 +74,8 @@ name: "xml", htmlMode: true, multilineTagIndentFactor: parserConfig.multilineTagIndentFactor, - multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag + multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag, + allowMissingTagName: parserConfig.allowMissingTagName, }); var tags = {}; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/idl/idl.js b/Mod manager/utils/QNModManager/CodeMirror/mode/idl/idl.js index 168761cd..37302bb9 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/idl/idl.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/idl/idl.js @@ -62,7 +62,7 @@ 'empty', 'enable_sysrtn', 'eof', 'eos', 'erase', 'erf', 'erfc', 'erfcx', 'erode', 'errorplot', 'errplot', 'estimator_filter', 'execute', 'exit', 'exp', - 'expand', 'expand_path', 'expint', 'extrac', 'extract_slice', + 'expand', 'expand_path', 'expint', 'extract', 'extract_slice', 'f_cvf', 'f_pdf', 'factorial', 'fft', 'file_basename', 'file_chmod', 'file_copy', 'file_delete', 'file_dirname', 'file_expand_path', 'file_gunzip', 'file_gzip', 'file_info', diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/index.html index 858ba127..51205ddc 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/index.html @@ -153,6 +153,7 @@

Language modes

  • VHDL
  • Vue.js app
  • Web IDL
  • +
  • WebAssembly Text Format
  • XML/HTML
  • XQuery
  • Yacas
  • diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/index.html index d1f7f68e..2b6cede8 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/index.html @@ -99,6 +99,10 @@

    JavaScript mode

  • typescript which will activate additional syntax highlighting and some other things for TypeScript code (demo).
  • +
  • trackScope can be set to false to turn off + tracking of local variables. This will prevent locals from + getting the "variable-2" token type, and will + break completion of locals with javascript-hint.
  • statementIndent which (given a number) will determine the amount of indentation to use for statements continued on a new line.
  • @@ -110,5 +114,5 @@

    JavaScript mode

    -

    MIME types defined: text/javascript, application/json, application/ld+json, text/typescript, application/typescript.

    +

    MIME types defined: text/javascript, application/javascript, application/x-javascript, text/ecmascript, application/ecmascript, application/json, application/x-json, application/manifest+json, application/ld+json, text/typescript, application/typescript.

    diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/javascript.js b/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/javascript.js index 9c751d23..7cfee313 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/javascript.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/javascript.js @@ -16,6 +16,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var statementIndent = parserConfig.statementIndent; var jsonldMode = parserConfig.jsonld; var jsonMode = parserConfig.json || jsonldMode; + var trackScope = parserConfig.trackScope !== false var isTS = parserConfig.typescript; var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; @@ -111,7 +112,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (ch != ">" || !state.lexical || state.lexical.type != ">") { if (stream.eat("=")) { if (ch == "!" || ch == "=") stream.eat("=") - } else if (/[<>*+\-]/.test(ch)) { + } else if (/[<>*+\-|&?]/.test(ch)) { stream.eat(ch) if (ch == ">") stream.eat(ch) } @@ -126,7 +127,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var kw = keywords[word] return ret(kw.type, kw.style, word) } - if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false)) + if (word == "async" && stream.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/, false)) return ret("async", "keyword", word) } return ret("variable", "variable", word) @@ -218,7 +219,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { // Parser - var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true}; + var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, + "regexp": true, "this": true, "import": true, "jsonld-keyword": true}; function JSLexical(indented, column, type, align, prev, info) { this.indented = indented; @@ -230,6 +232,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } function inScope(state, varname) { + if (!trackScope) return false for (var v = state.localVars; v; v = v.next) if (v.name == varname) return true; for (var cx = state.context; cx; cx = cx.prev) { @@ -276,6 +279,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function register(varname) { var state = cx.state; cx.marked = "def"; + if (!trackScope) return if (state.context) { if (state.lexical.info == "var" && state.context && state.context.block) { // FIXME function decls are also not block scoped @@ -326,6 +330,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { cx.state.context = new Context(cx.state.context, cx.state.localVars, true) cx.state.localVars = null } + pushcontext.lex = pushblockcontext.lex = true function popcontext() { cx.state.localVars = cx.state.context.vars cx.state.context = cx.state.context.prev @@ -375,7 +380,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); } if (type == "function") return cont(functiondef); - if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); + if (type == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex); if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword" return cont(pushlex("form", type == "class" ? type : value), className, poplex) @@ -441,7 +446,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "{") return contCommasep(objprop, "}", null, maybeop); if (type == "quasi") return pass(quasi, maybeop); if (type == "new") return cont(maybeTarget(noComma)); - if (type == "import") return cont(expression); return cont(); } function maybeexpression(type) { @@ -479,7 +483,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function quasi(type, value) { if (type != "quasi") return pass(); if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); + return cont(maybeexpression, continueQuasi); } function continueQuasi(type) { if (type == "}") { @@ -605,7 +609,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } } function typeexpr(type, value) { - if (value == "keyof" || value == "typeof" || value == "infer") { + if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") { cx.marked = "keyword" return cont(value == "typeof" ? expressionNoComma : typeexpr) } @@ -616,13 +620,19 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (value == "|" || value == "&") return cont(typeexpr) if (type == "string" || type == "number" || type == "atom") return cont(afterType); if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType) - if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType) + if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType) if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType) if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr) + if (type == "quasi") { return pass(quasiType, afterType); } } function maybeReturnType(type) { if (type == "=>") return cont(typeexpr) } + function typeprops(type) { + if (type.match(/[\}\)\]]/)) return cont() + if (type == "," || type == ";") return cont(typeprops) + return pass(typeprop, typeprops) + } function typeprop(type, value) { if (type == "variable" || cx.style == "keyword") { cx.marked = "property" @@ -635,6 +645,20 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop) } else if (type == "(") { return pass(functiondecl, typeprop) + } else if (!type.match(/[;\}\)\],]/)) { + return cont() + } + } + function quasiType(type, value) { + if (type != "quasi") return pass(); + if (value.slice(value.length - 2) != "${") return cont(quasiType); + return cont(typeexpr, continueQuasiType); + } + function continueQuasiType(type) { + if (type == "}") { + cx.marked = "string-2"; + cx.state.tokenize = tokenQuasi; + return cont(quasiType); } } function typearg(type, value) { @@ -776,6 +800,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (value == "@") return cont(expression, classBody) } function classfield(type, value) { + if (value == "!") return cont(classfield) if (value == "?") return cont(classfield) if (type == ":") return cont(typeexpr, maybeAssign) if (value == "=") return cont(expressionNoComma) @@ -795,6 +820,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function afterImport(type) { if (type == "string") return cont(); if (type == "(") return pass(expression); + if (type == ".") return pass(maybeoperatorComma); return pass(importSpec, maybeMoreImports, maybeFrom); } function importSpec(type, value) { @@ -868,14 +894,14 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { }, indent: function(state, textAfter) { - if (state.tokenize == tokenComment) return CodeMirror.Pass; + if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass; if (state.tokenize != tokenBase) return 0; var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top // Kludge to prevent 'maybelse' from blocking lexical scope pops if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { var c = state.cc[i]; if (c == poplex) lexical = lexical.prev; - else if (c != maybeelse) break; + else if (c != maybeelse && c != popcontext) break; } while ((lexical.type == "stat" || lexical.type == "form") && (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) && @@ -912,8 +938,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { expressionAllowed: expressionAllowed, skipExpression: function(state) { - var top = state.cc[state.cc.length - 1] - if (top == expression || top == expressionNoComma) state.cc.pop() + parseJS(state, "atom", "atom", "true", new CodeMirror.StringStream("", 2, null)) } }; }); @@ -925,9 +950,10 @@ CodeMirror.defineMIME("text/ecmascript", "javascript"); CodeMirror.defineMIME("application/javascript", "javascript"); CodeMirror.defineMIME("application/x-javascript", "javascript"); CodeMirror.defineMIME("application/ecmascript", "javascript"); -CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); -CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); -CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); +CodeMirror.defineMIME("application/json", { name: "javascript", json: true }); +CodeMirror.defineMIME("application/x-json", { name: "javascript", json: true }); +CodeMirror.defineMIME("application/manifest+json", { name: "javascript", json: true }) +CodeMirror.defineMIME("application/ld+json", { name: "javascript", jsonld: true }); CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/test.js index ffff05f5..e7303020 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/javascript/test.js @@ -164,9 +164,9 @@ MT("indent_for", "[keyword for] ([keyword var] [def i] [operator =] [number 0];", - " [variable i] [operator <] [number 100];", - " [variable i][operator ++])", - " [variable doSomething]([variable i]);", + " [variable-2 i] [operator <] [number 100];", + " [variable-2 i][operator ++])", + " [variable doSomething]([variable-2 i]);", "[keyword debugger];"); MT("indent_c_style", @@ -252,7 +252,7 @@ MT("async_object", "[keyword let] [def obj] [operator =] { [property async]: [atom false] };"); - // async be highlighet as keyword and foo as def, but it requires potentially expensive look-ahead. See #4173 + // async be highlighted as keyword and foo as def, but it requires potentially expensive look-ahead. See #4173 MT("async_object_function", "[keyword let] [def obj] [operator =] { [property async] [property foo]([def args]) { [keyword return] [atom true]; } };"); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/jsx.js b/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/jsx.js index 889d3fe5..beea3b91 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/jsx.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/jsx.js @@ -104,9 +104,9 @@ function jsToken(stream, state, cx) { if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) { - jsMode.skipExpression(cx.state) state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")), xmlMode, 0, state.context) + jsMode.skipExpression(cx.state) return null } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/test.js index 5ecd5a8b..b47a3521 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/jsx/test.js @@ -73,6 +73,13 @@ MT("tag_attribute", "([bracket&tag <][tag foo] [attribute bar]=[bracket&tag <][tag foo][bracket&tag />/>][operator ++])") + MT("in_array", + "[[", + " [bracket&tag <][tag Something][bracket&tag />],", + " [string-2 `${][variable x][string-2 }`],", + " [variable y]", + "]]") + var ts_mode = CodeMirror.getMode({indentUnit: 2}, "text/typescript-jsx") function TS(name) { test.mode(name, ts_mode, Array.prototype.slice.call(arguments, 1)) } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/julia/julia.js b/Mod manager/utils/QNModManager/CodeMirror/mode/julia/julia.js index f1d2cd5c..cb0d69c8 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/julia/julia.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/julia/julia.js @@ -12,9 +12,10 @@ "use strict"; CodeMirror.defineMode("julia", function(config, parserConf) { - function wordRegexp(words, end) { + function wordRegexp(words, end, pre) { + if (typeof pre === "undefined") { pre = ""; } if (typeof end === "undefined") { end = "\\b"; } - return new RegExp("^((" + words.join(")|(") + "))" + end); + return new RegExp("^" + pre + "((" + words.join(")|(") + "))" + end); } var octChar = "\\\\[0-7]{1,3}"; @@ -22,13 +23,18 @@ CodeMirror.defineMode("julia", function(config, parserConf) { var sChar = "\\\\[abefnrtv0%?'\"\\\\]"; var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])"; + var asciiOperatorsList = [ + "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/", + "\\.{2,3}", "[\\.\\\\%*+\\-<>!\\/^|&]=?", "\\?", "\\$", "~", ":" + ]; var operators = parserConf.operators || wordRegexp([ - "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/", - "[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", - "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", - "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", - "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", - "\\b(in|isa)\\b(?!\.?\\()"], ""); + "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/", + "[\\\\%*+\\-<>!\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", + "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", + "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", + "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", + "\\b(in|isa)\\b(?!\.?\\()" + ], ""); var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/; @@ -57,10 +63,13 @@ CodeMirror.defineMode("julia", function(config, parserConf) { var keywords = wordRegexp(keywordsList); var builtins = wordRegexp(builtinsList); - var macro = /^@[_A-Za-z][\w]*/; + var macro = /^@[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/; + var macroOperators = wordRegexp(asciiOperatorsList, "", "@"); + var symbolOperators = wordRegexp(asciiOperatorsList, "", ":"); + function inArray(state) { return (state.nestedArrays > 0); } @@ -80,7 +89,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { // tokenizers function tokenBase(stream, state) { // Handle multiline comments - if (stream.match(/^#=/, false)) { + if (stream.match('#=', false)) { state.tokenize = tokenComment; return state.tokenize(stream, state); } @@ -141,10 +150,10 @@ CodeMirror.defineMode("julia", function(config, parserConf) { } if (inArray(state)) { - if (state.lastToken == "end" && stream.match(/^:/)) { + if (state.lastToken == "end" && stream.match(':')) { return "operator"; } - if (stream.match(/^end/)) { + if (stream.match('end')) { return "number"; } } @@ -165,8 +174,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { } // Handle symbols - if (!leavingExpr && stream.match(symbol) || - stream.match(/:([<>]:|<<=?|>>>?=?|->|\/\/|\.{2,3}|[\.\\%*+\-<>!\/^|&]=?|[~\?\$])/)) { + if (!leavingExpr && (stream.match(symbol) || stream.match(symbolOperators))) { return "builtin"; } @@ -201,7 +209,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { } // Handle Chars - if (stream.match(/^'/)) { + if (stream.match('\'')) { state.tokenize = tokenChar; return state.tokenize(stream, state); } @@ -212,7 +220,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { return state.tokenize(stream, state); } - if (stream.match(macro)) { + if (stream.match(macro) || stream.match(macroOperators)) { return "meta"; } @@ -241,10 +249,6 @@ CodeMirror.defineMode("julia", function(config, parserConf) { state.isDefinition = false; return "def"; } - if (stream.match(/^({[^}]*})*\(/, false)) { - state.tokenize = tokenCallOrDef; - return state.tokenize(stream, state); - } state.leavingExpr = true; return "variable"; } @@ -254,49 +258,11 @@ CodeMirror.defineMode("julia", function(config, parserConf) { return "error"; } - function tokenCallOrDef(stream, state) { - var match = stream.match(/^(\(\s*)/); - if (match) { - if (state.firstParenPos < 0) - state.firstParenPos = state.scopes.length; - state.scopes.push('('); - state.charsAdvanced += match[1].length; - } - if (currentScope(state) == '(' && stream.match(/^\)/)) { - state.scopes.pop(); - state.charsAdvanced += 1; - if (state.scopes.length <= state.firstParenPos) { - var isDefinition = stream.match(/^(\s*where\s+[^\s=]+)*\s*?=(?!=)/, false); - stream.backUp(state.charsAdvanced); - state.firstParenPos = -1; - state.charsAdvanced = 0; - state.tokenize = tokenBase; - if (isDefinition) - return "def"; - return "builtin"; - } - } - // Unfortunately javascript does not support multiline strings, so we have - // to undo anything done upto here if a function call or definition splits - // over two or more lines. - if (stream.match(/^$/g, false)) { - stream.backUp(state.charsAdvanced); - while (state.scopes.length > state.firstParenPos) - state.scopes.pop(); - state.firstParenPos = -1; - state.charsAdvanced = 0; - state.tokenize = tokenBase; - return "builtin"; - } - state.charsAdvanced += stream.match(/^([^()]*)/)[1].length; - return state.tokenize(stream, state); - } - function tokenAnnotation(stream, state) { - stream.match(/.*?(?=,|;|{|}|\(|\)|=|$|\s)/); - if (stream.match(/^{/)) { + stream.match(/.*?(?=[,;{}()=\s]|$)/); + if (stream.match('{')) { state.nestedParameters++; - } else if (stream.match(/^}/) && state.nestedParameters > 0) { + } else if (stream.match('}') && state.nestedParameters > 0) { state.nestedParameters--; } if (state.nestedParameters > 0) { @@ -308,13 +274,13 @@ CodeMirror.defineMode("julia", function(config, parserConf) { } function tokenComment(stream, state) { - if (stream.match(/^#=/)) { + if (stream.match('#=')) { state.nestedComments++; } if (!stream.match(/.*?(?=(#=|=#))/)) { stream.skipToEnd(); } - if (stream.match(/^=#/)) { + if (stream.match('=#')) { state.nestedComments--; if (state.nestedComments == 0) state.tokenize = tokenBase; @@ -345,7 +311,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { return "string"; } if (!stream.match(/^[^']+(?=')/)) { stream.skipToEnd(); } - if (stream.match(/^'/)) { state.tokenize = tokenBase; } + if (stream.match('\'')) { state.tokenize = tokenBase; } return "error"; } @@ -383,7 +349,6 @@ CodeMirror.defineMode("julia", function(config, parserConf) { nestedComments: 0, nestedGenerators: 0, nestedParameters: 0, - charsAdvanced: 0, firstParenPos: -1 }; }, diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/lua/lua.js b/Mod manager/utils/QNModManager/CodeMirror/mode/lua/lua.js index 202f3735..2fad0180 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/lua/lua.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/lua/lua.js @@ -148,6 +148,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) { return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0)); }, + electricInput: /^\s*(?:end|until|else|\)|\})$/, lineComment: "--", blockCommentStart: "--[[", blockCommentEnd: "]]" diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/index.html index da3fe61b..4984c04b 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/index.html @@ -159,7 +159,7 @@

    Markdown mode

    Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, `+`, and `-`) as list markers. These three markers are -interchangable; this: +interchangeable; this: * Candy. * Gum. @@ -306,7 +306,7 @@

    Markdown mode

    I strongly recommend against using any `<blink>` tags. I wish SmartyPants used named entities like `&mdash;` - instead of decimal-encoded entites like `&#8212;`. + instead of decimal-encoded entities like `&#8212;`. Output: @@ -315,7 +315,7 @@

    Markdown mode

    <p>I wish SmartyPants used named entities like <code>&amp;mdash;</code> instead of decimal-encoded - entites like <code>&amp;#8212;</code>.</p> + entities like <code>&amp;#8212;</code>.</p> To specify an entire block of pre-formatted code, indent every line of @@ -360,7 +360,7 @@

    Markdown mode

    }); -

    If you also want support strikethrough, emoji and few other goodies, check out Github-Flavored Markdown mode.

    +

    If you also want support strikethrough, emoji and few other goodies, check out GitHub-Flavored Markdown mode.

    Optionally depends on other modes for properly highlighted code blocks, and XML mode for properly highlighted inline XML blocks.

    @@ -370,7 +370,7 @@

    Markdown mode

  • highlightFormatting: boolean
    -
    Whether to separately highlight markdown meta characterts (*[]()etc.) (default: false).
    +
    Whether to separately highlight markdown meta characters (*[]()etc.) (default: false).
  • diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/markdown.js b/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/markdown.js index 287f39b5..a9e272ea 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/markdown.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/markdown.js @@ -223,7 +223,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { // Add this list item's content's indentation to the stack state.listStack.push(state.indentation); - // Reset inline styles which shouldn't propagate aross list items + // Reset inline styles which shouldn't propagate across list items state.em = false; state.strong = false; state.code = false; @@ -612,7 +612,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { return getType(state); } } else if (ch === ' ') { - if (stream.match(/^~~/, true)) { // Probably surrounded by space + if (stream.match('~~', true)) { // Probably surrounded by space if (stream.peek() === ' ') { // Surrounded by spaces, ignore return getType(state); } else { // Not surrounded by spaces, back up pointer @@ -711,7 +711,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { } function footnoteLinkInside(stream, state) { - if (stream.match(/^\]:/, true)) { + if (stream.match(']:', true)) { state.f = state.inline = footnoteUrl; if (modeCfg.highlightFormatting) state.formatting = "link"; var returnType = getType(state); @@ -735,7 +735,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { if (stream.peek() === undefined) { // End of line, set flag to check next line state.linkTitle = true; } else { // More content on line, check if link title - stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true); + stream.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/, true); } state.f = state.inline = inlineNormal; return tokenTypes.linkHref + " url"; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/test.js index 929e7bba..fd5a1fb4 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/markdown/test.js @@ -315,7 +315,7 @@ "[header&header-2 bar]", "[header&header-2 ---]"); - MT("setextAferATX", + MT("setextAfterATX", "[header&header-1 # foo]", "[header&header-2 bar]", "[header&header-2 ---]"); @@ -659,7 +659,7 @@ " [variable-2 text after fenced code]"); // should correctly parse numbered list content indentation - MT("listCommonMark_NumeberedListIndent", + MT("listCommonMark_NumberedListIndent", "[variable-2 1000. list with base indent of 6]", "", " [variable-2 text must be indented 6 spaces at minimum]", diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/meta.js b/Mod manager/utils/QNModManager/CodeMirror/mode/meta.js index d3efdc17..38d5e013 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/meta.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/meta.js @@ -19,7 +19,7 @@ {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]}, {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]}, {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, - {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, + {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy", "cbl"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, @@ -44,7 +44,7 @@ {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]}, {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]}, - {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, + {name: "Embedded JavaScript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, {name: "Esper", mime: "text/x-esper", mode: "sql"}, @@ -76,7 +76,7 @@ {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]}, {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]}, - {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, + {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"], alias: ["jl"]}, {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]}, {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, @@ -169,7 +169,8 @@ {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]}, {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]}, {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]}, - {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]} + {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]}, + {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]}, ]; // Ensure all modes have a mime property for backwards compatibility for (var i = 0; i < CodeMirror.modeInfo.length; i++) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/mllike/mllike.js b/Mod manager/utils/QNModManager/CodeMirror/mode/mllike/mllike.js index a1538f72..8f923727 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/mllike/mllike.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/mllike/mllike.js @@ -60,7 +60,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) { } } if (ch === '(') { - if (stream.eat('*')) { + if (stream.match(/^\*(?!\))/)) { state.commentLevel++; state.tokenize = tokenComment; return state.tokenize(stream, state); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/modelica/modelica.js b/Mod manager/utils/QNModManager/CodeMirror/mode/modelica/modelica.js index a83a4135..2e9622f0 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/modelica/modelica.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/modelica/modelica.js @@ -90,7 +90,7 @@ return "error"; } - function tokenUnsignedNuber(stream, state) { + function tokenUnsignedNumber(stream, state) { stream.eatWhile(isDigit); if (stream.eat('.')) { stream.eatWhile(isDigit); @@ -164,9 +164,9 @@ else if(ch == '"') { state.tokenize = tokenString; } - // UNSIGNED_NUBER + // UNSIGNED_NUMBER else if(isDigit.test(ch)) { - state.tokenize = tokenUnsignedNuber; + state.tokenize = tokenUnsignedNumber; } // ERROR else { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/mscgen/mscgen.js b/Mod manager/utils/QNModManager/CodeMirror/mode/mscgen/mscgen.js index 6f4f9cd8..8d39341c 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/mscgen/mscgen.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/mscgen/mscgen.js @@ -72,11 +72,11 @@ CodeMirror.defineMIME("text/x-msgenny", {name: "mscgen", language: "msgenny"}); function wordRegexpBoundary(pWords) { - return new RegExp("\\b(" + pWords.join("|") + ")\\b", "i"); + return new RegExp("^\\b(?:" + pWords.join("|") + ")\\b", "i"); } function wordRegexp(pWords) { - return new RegExp("(" + pWords.join("|") + ")", "i"); + return new RegExp("^(?:" + pWords.join("|") + ")", "i"); } function startStateFn() { @@ -153,7 +153,7 @@ return "variable"; /* attribute lists */ - if (!pConfig.inAttributeList && !!pConfig.attributes && pStream.match(/\[/, true, true)) { + if (!pConfig.inAttributeList && !!pConfig.attributes && pStream.match('[', true, true)) { pConfig.inAttributeList = true; return "bracket"; } @@ -161,7 +161,7 @@ if (pConfig.attributes !== null && pStream.match(wordRegexpBoundary(pConfig.attributes), true, true)) { return "attribute"; } - if (pStream.match(/]/, true, true)) { + if (pStream.match(']', true, true)) { pConfig.inAttributeList = false; return "bracket"; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/mumps/mumps.js b/Mod manager/utils/QNModManager/CodeMirror/mode/mumps/mumps.js index 3671c9cb..c53b4bf3 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/mumps/mumps.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/mumps/mumps.js @@ -26,7 +26,7 @@ var brackets = new RegExp("[()]"); var identifiers = new RegExp("^[%A-Za-z][A-Za-z0-9]*"); var commandKeywords = ["break","close","do","else","for","goto", "halt", "hang", "if", "job","kill","lock","merge","new","open", "quit", "read", "set", "tcommit", "trollback", "tstart", "use", "view", "write", "xecute", "b","c","d","e","f","g", "h", "i", "j","k","l","m","n","o", "q", "r", "s", "tc", "tro", "ts", "u", "v", "w", "x"]; - // The following list includes instrinsic functions _and_ special variables + // The following list includes intrinsic functions _and_ special variables var intrinsicFuncsWords = ["\\$ascii", "\\$char", "\\$data", "\\$ecode", "\\$estack", "\\$etrap", "\\$extract", "\\$find", "\\$fnumber", "\\$get", "\\$horolog", "\\$io", "\\$increment", "\\$job", "\\$justify", "\\$length", "\\$name", "\\$next", "\\$order", "\\$piece", "\\$qlength", "\\$qsubscript", "\\$query", "\\$quit", "\\$random", "\\$reverse", "\\$select", "\\$stack", "\\$test", "\\$text", "\\$translate", "\\$view", "\\$x", "\\$y", "\\$a", "\\$c", "\\$d", "\\$e", "\\$ec", "\\$es", "\\$et", "\\$f", "\\$fn", "\\$g", "\\$h", "\\$i", "\\$j", "\\$l", "\\$n", "\\$na", "\\$o", "\\$p", "\\$q", "\\$ql", "\\$qs", "\\$r", "\\$re", "\\$s", "\\$st", "\\$t", "\\$tr", "\\$v", "\\$z"]; var intrinsicFuncs = wordRegexp(intrinsicFuncsWords); var command = wordRegexp(commandKeywords); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/nginx/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/nginx/index.html index 5c2bc6e2..1aa690a6 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/nginx/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/nginx/index.html @@ -62,7 +62,7 @@

    NGINX mode

    location / { index index.html index.php; ## Allow a static html file to be shown first try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler - expires 30d; ## Assume all files are cachable + expires 30d; ## Assume all files are cacheable } ## These locations would be hidden by .htaccess normally @@ -128,7 +128,7 @@

    NGINX mode

    location / { index index.html index.php; ## Allow a static html file to be shown first try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler - expires 30d; ## Assume all files are cachable + expires 30d; ## Assume all files are cacheable } ## These locations would be hidden by .htaccess normally diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/nsis/nsis.js b/Mod manager/utils/QNModManager/CodeMirror/mode/nsis/nsis.js index 636940f5..ebd3c8bf 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/nsis/nsis.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/nsis/nsis.js @@ -24,42 +24,42 @@ CodeMirror.defineSimpleMode("nsis",{ { regex: /`(?:[^\\`]|\\.)*`?/, token: "string" }, // Compile Time Commands - {regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace))\b/, token: "keyword"}, + {regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"}, // Conditional Compilation - {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true}, - {regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true}, + {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i, token: "keyword", indent: true}, + {regex: /^\s*(?:\!(else|endif|macroend))\b/i, token: "keyword", dedent: true}, // Runtime Commands - {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"}, - {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true}, - {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true}, + {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/i, token: "keyword"}, + {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/i, token: "keyword", indent: true}, + {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/i, token: "keyword", dedent: true}, // Command Options - {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/, token: "atom"}, - {regex: /\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/, token: "builtin"}, + {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/i, token: "atom"}, + {regex: /\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/i, token: "builtin"}, // LogicLib.nsh - {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/, token: "variable-2", indent: true}, + {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true}, // FileFunc.nsh - {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i, token: "variable-2", dedent: true}, // Memento.nsh - {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/i, token: "variable-2", dedent: true}, // TextFunc.nsh - {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/i, token: "variable-2", dedent: true}, // WinVer.nsh - {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/, token: "variable", dedent: true}, + {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/i, token: "variable", dedent: true}, // WordFunc.nsh - {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/i, token: "variable-2", dedent: true}, // x64.nsh - {regex: /\$\{(?:RunningX64)\}/, token: "variable", dedent: true}, - {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:RunningX64)\}/i, token: "variable", dedent: true}, + {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/i, token: "variable-2", dedent: true}, // Line Comment {regex: /(#|;).*/, token: "comment"}, @@ -71,20 +71,20 @@ CodeMirror.defineSimpleMode("nsis",{ {regex: /[-+\/*=<>!]+/, token: "operator"}, // Variable - {regex: /\$\w+/, token: "variable"}, + {regex: /\$\w[\w\.]*/, token: "variable"}, // Constant - {regex: /\${[\w\.:-]+}/, token: "variable-2"}, + {regex: /\${[\!\w\.:-]+}/, token: "variable-2"}, // Language String - {regex: /\$\([\w\.:-]+\)/, token: "variable-3"} + {regex: /\$\([\!\w\.:-]+\)/, token: "variable-3"} ], comment: [ {regex: /.*?\*\//, token: "comment", next: "start"}, {regex: /.*/, token: "comment"} ], meta: { - electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/, + electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/i, blockCommentStart: "/*", blockCommentEnd: "*/", lineComment: ["#", ";"] diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/ntriples/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/ntriples/index.html index 5473dbff..275cf08b 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/ntriples/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/ntriples/index.html @@ -58,7 +58,7 @@

    N-Triples mode

    "literal 1" . _:bnode3 . _:bnode4 "literal 2"@lang . - # if a graph labe + # if a graph label _:bnode5 "literal 3"^^ . diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/oz/oz.js b/Mod manager/utils/QNModManager/CodeMirror/mode/oz/oz.js index a9738495..73857e4c 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/oz/oz.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/oz/oz.js @@ -45,7 +45,7 @@ CodeMirror.defineMode("oz", function (conf) { } // Special [] keyword - if (stream.match(/(\[])/)) { + if (stream.match('[]')) { return "keyword" } @@ -130,7 +130,7 @@ CodeMirror.defineMode("oz", function (conf) { return "operator"; } - // If nothing match, we skip the entire alphanumerical block + // If nothing match, we skip the entire alphanumeric block stream.eatWhile(/\w/); return "variable"; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/pegjs/pegjs.js b/Mod manager/utils/QNModManager/CodeMirror/mode/pegjs/pegjs.js index 19d5fa4c..ac011d3c 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/pegjs/pegjs.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/pegjs/pegjs.js @@ -39,7 +39,7 @@ CodeMirror.defineMode("pegjs", function (config) { stream.next(); // Skip quote state.inString = true; // Update state } - if (!state.inString && !state.inComment && stream.match(/^\/\*/)) { + if (!state.inString && !state.inComment && stream.match('/*')) { state.inComment = true; } @@ -59,7 +59,7 @@ CodeMirror.defineMode("pegjs", function (config) { return state.lhs ? "property string" : "string"; // Token style } else if (state.inComment) { while (state.inComment && !stream.eol()) { - if (stream.match(/\*\//)) { + if (stream.match('*/')) { state.inComment = false; // Clear flag } else { stream.match(/^.[^\*]*/); @@ -76,7 +76,7 @@ CodeMirror.defineMode("pegjs", function (config) { stream.next(); state.inCharacterClass = true; return 'bracket'; - } else if (stream.match(/^\/\//)) { + } else if (stream.match('//')) { stream.skipToEnd(); return "comment"; } else if (state.braced || stream.peek() === '{') { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/perl/perl.js b/Mod manager/utils/QNModManager/CodeMirror/mode/perl/perl.js index a3101a7c..41e7bc73 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/perl/perl.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/perl/perl.js @@ -347,7 +347,7 @@ CodeMirror.defineMode("perl",function(){ lc :1, // - return lower-case version of a string lcfirst :1, // - return a string with just the next letter in lower case length :1, // - return the number of bytes in a string - 'link' :1, // - create a hard link in the filesytem + 'link' :1, // - create a hard link in the filesystem listen :1, // - register your socket as a server local : 2, // - create a temporary value for a global variable (dynamic scoping) localtime :1, // - convert UNIX time into record or string using local time @@ -441,7 +441,7 @@ CodeMirror.defineMode("perl",function(){ state :1, // - declare and assign a state variable (persistent lexical scoping) study :1, // - optimize input data for repeated searches 'sub' :1, // - declare a subroutine, possibly anonymously - 'substr' :1, // - get or alter a portion of a stirng + 'substr' :1, // - get or alter a portion of a string symlink :1, // - create a symbolic link to a file syscall :1, // - execute an arbitrary system call sysopen :1, // - open a file, pipe, or descriptor @@ -513,10 +513,9 @@ CodeMirror.defineMode("perl",function(){ return null; if(state.chain) return tokenChain(stream,state,state.chain,state.style,state.tail); - if(stream.match(/^\-?[\d\.]/,false)) - if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) - return 'number'; - if(stream.match(/^<<(?=\w)/)){ // NOTE: <\w/, false)) { + if (stream.match(/^->\w/, false)) { // Match object operator state.tokenize = matchSequence([ [["->", null]], @@ -80,13 +80,13 @@ } var phpKeywords = "abstract and array as break case catch class clone const continue declare default " + - "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + + "do else elseif enddeclare endfor endforeach endif endswitch endwhile enum extends final " + "for foreach function global goto if implements interface instanceof namespace " + "new or private protected public static switch throw trait try use var while xor " + "die echo empty exit eval include include_once isset list require require_once return " + - "print unset __halt_compiler self static parent yield insteadof finally"; + "print unset __halt_compiler self static parent yield insteadof finally readonly match"; var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"; - var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; + var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage memory_get_peak_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" ")); CodeMirror.registerHelper("wordChars", "php", /[\w$]/); @@ -95,7 +95,7 @@ helperType: "php", keywords: keywords(phpKeywords), blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"), - defKeywords: keywords("class function interface namespace trait"), + defKeywords: keywords("class enum function interface namespace trait"), atoms: keywords(phpAtoms), builtin: keywords(phpBuiltin), multiLineStrings: true, @@ -106,7 +106,7 @@ }, "<": function(stream, state) { var before; - if (before = stream.match(/<<\s*/)) { + if (before = stream.match(/^<<\s*/)) { var quoted = stream.eat(/['"]/); stream.eatWhile(/[\w\.]/); var delim = stream.current().slice(before[0].length + (quoted ? 2 : 1)); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/pug/pug.js b/Mod manager/utils/QNModManager/CodeMirror/mode/pug/pug.js index a4c0e16b..73e9ae2f 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/pug/pug.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/pug/pug.js @@ -261,7 +261,7 @@ CodeMirror.defineMode("pug", function (config) { } return 'variable'; } - if (stream.match(/^\+#{/, false)) { + if (stream.match('+#{', false)) { stream.next(); state.mixinCallAfter = true; return interpolation(stream, state); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/puppet/puppet.js b/Mod manager/utils/QNModManager/CodeMirror/mode/puppet/puppet.js index 36493420..a92ca110 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/puppet/puppet.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/puppet/puppet.js @@ -176,7 +176,7 @@ CodeMirror.defineMode("puppet", function () { // Match characters that we are going to assume // are trying to be regex if (ch == '/') { - stream.match(/.*?\//); + stream.match(/^[^\/]*\//); return 'variable-3'; } // Match all the numbers diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/python/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/python/index.html index bdfc8f57..78a3a146 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/python/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/python/index.html @@ -190,7 +190,7 @@

    Configuration Options for Python mode:

  • hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much that line should be indented. Defaults to one normal indentation unit.
  • Advanced Configuration Options:

    -

    Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help

    +

    Useful for superset of python syntax like Enthought enaml, IPython magics and questionmark help

    • singleOperators - RegEx - Regular Expression for single operator matching, default :
      ^[\\+\\-\\*/%&|\\^~<>!]
      including
      @
      on Python 3
    • singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :
      ^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]
    • diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/python/python.js b/Mod manager/utils/QNModManager/CodeMirror/mode/python/python.js index de5fd38a..9e532ea1 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/python/python.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/python/python.js @@ -62,7 +62,7 @@ var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/; myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]); myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]); - var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i"); + var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i"); } else { var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/; myKeywords = myKeywords.concat(["exec", "print"]); @@ -282,7 +282,7 @@ } function pushBracketScope(stream, state, type) { - var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1 + var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1 state.scopes.push({offset: state.indent + hangingIndent, type: type, align: align}) @@ -298,7 +298,10 @@ } function tokenLexer(stream, state) { - if (stream.sol()) state.beginningOfLine = true; + if (stream.sol()) { + state.beginningOfLine = true; + state.dedent = false; + } var style = state.tokenize(stream, state); var current = stream.current(); @@ -315,10 +318,10 @@ // Handle scope changes. if (current == "pass" || current == "return") - state.dedent += 1; + state.dedent = true; if (current == "lambda") state.lambda = true; - if (current == ":" && !state.lambda && top(state).type == "py") + if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false)) pushPyScope(state); if (current.length == 1 && !/string|comment/.test(style)) { @@ -332,10 +335,8 @@ else return ERRORCLASS; } } - if (state.dedent > 0 && stream.eol() && top(state).type == "py") { - if (state.scopes.length > 1) state.scopes.pop(); - state.dedent -= 1; - } + if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1) + state.scopes.pop(); return style; } @@ -370,14 +371,16 @@ if (state.tokenize != tokenBase) return state.tokenize.isString ? CodeMirror.Pass : 0; - var scope = top(state), closing = scope.type == textAfter.charAt(0) + var scope = top(state) + var closing = scope.type == textAfter.charAt(0) || + scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter) if (scope.align != null) return scope.align - (closing ? 1 : 0) else return scope.offset - (closing ? hangingIndent : 0) }, - electricInput: /^\s*[\}\]\)]$/, + electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/, closeBrackets: {triples: "'\""}, lineComment: "#", fold: "indent" diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/python/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/python/test.js index 2b605b8e..1adf9532 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/python/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/python/test.js @@ -31,7 +31,7 @@ } MT("fValidStringPrefix", "[string f'this is a]{[variable formatted]}[string string']"); - MT("fValidExpressioninFString", "[string f'expression ]{[number 100][operator *][number 5]}[string string']"); + MT("fValidExpressionInFString", "[string f'expression ]{[number 100][operator *][number 5]}[string string']"); MT("fInvalidFString", "[error f'this is wrong}]"); MT("fNestedFString", "[string f'expression ]{[number 100] [operator +] [string f'inner]{[number 5]}[string ']}[string string']"); MT("uValidStringPrefix", "[string u'this is an unicode string']"); @@ -41,4 +41,34 @@ MT("bracesInFString", "[string f']{[variable x] [operator +] {}}[string !']") MT("nestedFString", "[string f']{[variable b][[ [string f\"c\"] ]]}[string f'] [comment # oops]") + + MT("dontIndentTypeDecl", + "[variable i]: [builtin int] [operator =] [number 32]", + "[builtin print]([variable i])") + + MT("dedentElse", + "[keyword if] [variable x]:", + " [variable foo]()", + "[keyword elif] [variable y]:", + " [variable bar]()", + "[keyword else]:", + " [variable baz]()") + + MT("dedentElsePass", + "[keyword if] [variable x]:", + " [keyword pass]", + "[keyword elif] [variable y]:", + " [keyword pass]", + "[keyword else]:", + " [keyword pass]") + + MT("dedentElseInFunction", + "[keyword def] [def foo]():", + " [keyword if] [variable x]:", + " [variable foo]()", + " [keyword elif] [variable y]:", + " [variable bar]()", + " [keyword pass]", + " [keyword else]:", + " [variable baz]()") })(); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/r/r.js b/Mod manager/utils/QNModManager/CodeMirror/mode/r/r.js index c422af9a..de34c201 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/r/r.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/r/r.js @@ -54,9 +54,9 @@ CodeMirror.defineMode("r", function(config) { } else if (ch == "`") { stream.match(/[^`]+`/); return "variable-3"; - } else if (ch == "." && stream.match(/.[.\d]+/)) { + } else if (ch == "." && stream.match(/.(?:[.]|\d+)/)) { return "keyword"; - } else if (/[\w\.]/.test(ch) && ch != "_") { + } else if (/[a-zA-Z\.]/.test(ch)) { stream.eatWhile(/[\w\.]/); var word = stream.current(); if (atoms.propertyIsEnumerable(word)) return "atom"; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/rpm/rpm.js b/Mod manager/utils/QNModManager/CodeMirror/mode/rpm/rpm.js index 2dece2ea..bb9ec9ff 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/rpm/rpm.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/rpm/rpm.js @@ -12,14 +12,14 @@ "use strict"; CodeMirror.defineMode("rpm-changes", function() { - var headerSeperator = /^-+$/; + var headerSeparator = /^-+$/; var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; var simpleEmail = /^[\w+.-]+@[\w.-]+/; return { token: function(stream) { if (stream.sol()) { - if (stream.match(headerSeperator)) { return 'tag'; } + if (stream.match(headerSeparator)) { return 'tag'; } if (stream.match(headerLine)) { return 'tag'; } } if (stream.match(simpleEmail)) { return 'string'; } @@ -80,12 +80,12 @@ CodeMirror.defineMode("rpm-spec", function() { // Macros like '%make_install' or '%attr(0775,root,root)' if (stream.match(/^%[\w]+/)) { - if (stream.match(/^\(/)) { state.macroParameters = true; } + if (stream.match('(')) { state.macroParameters = true; } return "keyword"; } if (state.macroParameters) { if (stream.match(/^\d+/)) { return "number";} - if (stream.match(/^\)/)) { + if (stream.match(')')) { state.macroParameters = false; return "keyword"; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/index.html index 55fe6c58..daebdca2 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/index.html @@ -34,7 +34,7 @@

      Ruby mode

      # This program evaluates polynomials. It first asks for the coefficients # of a polynomial, which must be entered on one line, highest-order first. # It then requests values of x and will compute the value of the poly for -# each x. It will repeatly ask for x values, unless you the user enters +# each x. It will repeatedly ask for x values, unless you the user enters # a blank line. It that case, it will ask for another polynomial. If the # user types quit for either input, the program immediately exits. # diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/ruby.js b/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/ruby.js index dd0e603e..85bbfc65 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/ruby.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/ruby/ruby.js @@ -11,25 +11,28 @@ })(function(CodeMirror) { "use strict"; +function wordObj(words) { + var o = {}; + for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; + return o; +} + +var keywordList = [ + "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", + "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", + "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", + "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc", + "caller", "lambda", "proc", "public", "protected", "private", "require", "load", + "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" +], keywords = wordObj(keywordList); + +var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then", + "catch", "loop", "proc", "begin"]); +var dedentWords = wordObj(["end", "until"]); +var opening = {"[": "]", "{": "}", "(": ")"}; +var closing = {"]": "[", "}": "{", ")": "("}; + CodeMirror.defineMode("ruby", function(config) { - function wordObj(words) { - var o = {}; - for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; - return o; - } - var keywords = wordObj([ - "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", - "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or", - "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", - "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc", - "caller", "lambda", "proc", "public", "protected", "private", "require", "load", - "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" - ]); - var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then", - "catch", "loop", "proc", "begin"]); - var dedentWords = wordObj(["end", "until"]); - var opening = {"[": "]", "{": "}", "(": ")"}; - var closing = {"]": "[", "}": "{", ")": "("}; var curPunc; function chain(newtok, stream, state) { @@ -295,4 +298,6 @@ CodeMirror.defineMode("ruby", function(config) { CodeMirror.defineMIME("text/x-ruby", "ruby"); +CodeMirror.registerHelper("hintWords", "ruby", keywordList); + }); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/sass/sass.js b/Mod manager/utils/QNModManager/CodeMirror/mode/sass/sass.js index c37ab0b2..d8427bff 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/sass/sass.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/sass/sass.js @@ -231,7 +231,7 @@ CodeMirror.defineMode("sass", function(config) { } if(ch === "@"){ - if(stream.match(/@extend/)){ + if(stream.match('@extend')){ if(!stream.match(/\s*[\w]/)) dedent(state); } @@ -445,7 +445,12 @@ CodeMirror.defineMode("sass", function(config) { indent: function(state) { return state.scopes[0].offset; - } + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//", + fold: "indent" }; }, "css"); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/scheme/scheme.js b/Mod manager/utils/QNModManager/CodeMirror/mode/scheme/scheme.js index 56e4e332..d11a132d 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/scheme/scheme.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/scheme/scheme.js @@ -3,6 +3,7 @@ /** * Author: Koh Zi Han, based on implementation by Koh Zi Chun + * Improved by: Jakub T. Jankiewicz */ (function(mod) { @@ -17,7 +18,7 @@ CodeMirror.defineMode("scheme", function () { var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", - ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; + SYMBOL = "symbol", ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; var INDENT_WORD_SKIP = 2; function makeKeywords(str) { @@ -26,8 +27,8 @@ CodeMirror.defineMode("scheme", function () { return obj; } - var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"); - var indentKeys = makeKeywords("define let letrec let* lambda"); + var keywords = makeKeywords("λ case-lambda call/cc class cond-expand define-class define-values exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?"); + var indentKeys = makeKeywords("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax let-values let*-values define-syntax syntax-rules define-values when unless"); function stateStack(indent, type, prev) { // represents a state stack object this.indent = indent; @@ -67,6 +68,18 @@ CodeMirror.defineMode("scheme", function () { return stream.match(hexMatcher); } + function processEscapedSequence(stream, options) { + var next, escaped = false; + while ((next = stream.next()) != null) { + if (next == options.token && !escaped) { + + options.state.mode = false; + break; + } + escaped = !escaped && next == "\\"; + } + } + return { startState: function () { return { @@ -92,17 +105,19 @@ CodeMirror.defineMode("scheme", function () { switch(state.mode){ case "string": // multi-line string parsing mode - var next, escaped = false; - while ((next = stream.next()) != null) { - if (next == "\"" && !escaped) { - - state.mode = false; - break; - } - escaped = !escaped && next == "\\"; - } + processEscapedSequence(stream, { + token: "\"", + state: state + }); returnType = STRING; // continue on in scheme-string mode break; + case "symbol": // escape symbol + processEscapedSequence(stream, { + token: "|", + state: state + }); + returnType = SYMBOL; // continue on in scheme-symbol mode + break; case "comment": // comment parsing mode var next, maybeEnd = false; while ((next = stream.next()) != null) { @@ -143,6 +158,9 @@ CodeMirror.defineMode("scheme", function () { stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/); returnType = ATOM; } + } else if (ch == '|') { + state.mode = "symbol"; + returnType = SYMBOL; } else if (ch == '#') { if (stream.eat("|")) { // Multi-line comment state.mode = "comment"; // toggle to comment mode @@ -170,7 +188,7 @@ CodeMirror.defineMode("scheme", function () { } else if (stream.match(/^[-+0-9.]/, false)) { hasRadix = false; numTest = isDecimalNumber; - // re-consume the intial # if all matches failed + // re-consume the initial # if all matches failed } else if (!hasExactness) { stream.eat('#'); } @@ -255,6 +273,7 @@ CodeMirror.defineMode("scheme", function () { return state.indentStack.indent; }, + fold: "brace-paren", closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;" }; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/shell/shell.js b/Mod manager/utils/QNModManager/CodeMirror/mode/shell/shell.js index 5af12413..8271485f 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/shell/shell.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/shell/shell.js @@ -70,6 +70,14 @@ CodeMirror.defineMode('shell', function() { stream.eatWhile(/\w/); return 'attribute'; } + if (ch == "<") { + if (stream.match("<<")) return "operator" + var heredoc = stream.match(/^<-?\s*['"]?([^'"]*)['"]?/) + if (heredoc) { + state.tokens.unshift(tokenHeredoc(heredoc[1])) + return 'string-2' + } + } if (/\d/.test(ch)) { stream.eatWhile(/\d/); if(stream.eol() || !/\w/.test(stream.peek())) { @@ -129,6 +137,14 @@ CodeMirror.defineMode('shell', function() { return 'def'; }; + function tokenHeredoc(delim) { + return function(stream, state) { + if (stream.sol() && stream.string == delim) state.tokens.shift() + stream.skipToEnd() + return "string-2" + } + } + function tokenize(stream, state) { return (state.tokens[0] || tokenBase) (stream, state); }; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/shell/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/shell/test.js index 7571d907..237375d4 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/shell/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/shell/test.js @@ -65,9 +65,16 @@ MT("strings in parens", "[def FOO][operator =]([quote $(<][string \"][def $MYDIR][string \"][quote /myfile grep ][string 'hello$'][quote )])") - MT ("string ending in dollar", - '[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]') + MT("string ending in dollar", + '[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]') - MT ("quote ending in dollar", - "[quote $(echo a$)]") + MT("quote ending in dollar", + "[quote $(echo a$)]") + + MT("heredoc", + "[builtin cat] [string-2 <<- end]", + "[string-2 content one]", + "[string-2 content two end]", + "[string-2 end]", + "[builtin echo]") })(); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/sieve/sieve.js b/Mod manager/utils/QNModManager/CodeMirror/mode/sieve/sieve.js index f02a867e..b7236401 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/sieve/sieve.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/sieve/sieve.js @@ -43,7 +43,7 @@ CodeMirror.defineMode("sieve", function(config) { if (ch == "(") { state._indent.push("("); // add virtual angel wings so that editor behaves... - // ...more sane incase of broken brackets + // ...more sane in case of broken brackets state._indent.push("{"); return null; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/soy/soy.js b/Mod manager/utils/QNModManager/CodeMirror/mode/soy/soy.js index d31c947e..debe7268 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/soy/soy.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/soy/soy.js @@ -16,12 +16,16 @@ "alias": { noEndTag: true }, "delpackage": { noEndTag: true }, "namespace": { noEndTag: true, soyState: "namespace-def" }, + "@attribute": paramData, + "@attribute?": paramData, "@param": paramData, "@param?": paramData, "@inject": paramData, "@inject?": paramData, "@state": paramData, "template": { soyState: "templ-def", variableScope: true}, + "extern": {soyState: "param-def"}, + "export": {soyState: "export"}, "literal": { }, "msg": {}, "fallbackmsg": { noEndTag: true, reduceIndent: true}, @@ -29,6 +33,8 @@ "plural": {}, "let": { soyState: "var-def" }, "if": {}, + "javaimpl": {}, + "jsimpl": {}, "elseif": { noEndTag: true, reduceIndent: true}, "else": { noEndTag: true, reduceIndent: true}, "switch": {}, @@ -44,6 +50,8 @@ "delcall": { soyState: "templ-ref" }, "log": {}, "element": { variableScope: true }, + "velog": {}, + "const": { soyState: "const-def"}, }; var indentingTags = Object.keys(tags).filter(function(tag) { @@ -53,7 +61,7 @@ CodeMirror.defineMode("soy", function(config) { var textMode = CodeMirror.getMode(config, "text/plain"); var modes = { - html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false}), + html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false, allowMissingTagName: true}), attributes: textMode, text: textMode, uri: textMode, @@ -132,10 +140,10 @@ state.context = new Context(state.context, "list-literal", state.variables); state.lookupVariables = false; return null; - } else if (stream.match(/map\b/)) { + } else if (stream.match(/\bmap(?=\()/)) { state.soyState.push("map-literal"); return "keyword"; - } else if (stream.match(/record\b/)) { + } else if (stream.match(/\brecord(?=\()/)) { state.soyState.push("record-literal"); return "keyword"; } else if (stream.match(/([\w]+)(?=\()/)) { @@ -274,6 +282,11 @@ return null; case "param-def": + if (match = stream.match(/^\*/)) { + state.soyState.pop(); + state.soyState.push("param-type"); + return "type"; + } if (match = stream.match(/^\w+/)) { state.variables = prepend(state.variables, match[0]); state.soyState.pop(); @@ -404,7 +417,7 @@ return null; case "list-literal": - if (stream.match(/\]/)) { + if (stream.match(']')) { state.soyState.pop(); state.lookupVariables = true; popcontext(state); @@ -441,11 +454,11 @@ state.indent -= 2 * config.indentUnit; return null; } - if (stream.match(/\w+(?=\s+as)/)) { + if (stream.match(/\w+(?=\s+as\b)/)) { return "variable"; } if (match = stream.match(/\w+/)) { - return /(from|as)/.test(match[0]) ? "keyword" : "def"; + return /\b(from|as)\b/.test(match[0]) ? "keyword" : "def"; } if (match = stream.match(/^["']/)) { state.soyState.push("string"); @@ -456,8 +469,15 @@ return null; case "tag": - var endTag = state.tag[0] == "/"; - var tagName = endTag ? state.tag.substring(1) : state.tag; + var endTag; + var tagName; + if (state.tag === undefined) { + endTag = true; + tagName = ''; + } else { + endTag = state.tag[0] == "/"; + tagName = endTag ? state.tag.substring(1) : state.tag; + } var tag = tags[tagName]; if (stream.match(/^\/?}/)) { var selfClosed = stream.current() == "/}"; @@ -491,15 +511,47 @@ } return expression(stream, state); + case "template-call-expression": + if (stream.match(/^([\w-?]+)(?==)/)) { + return "attribute"; + } else if (stream.eat('>')) { + state.soyState.pop(); + return "keyword"; + } else if (stream.eat('/>')) { + state.soyState.pop(); + return "keyword"; + } + return expression(stream, state); case "literal": - if (stream.match(/^(?=\{\/literal})/)) { + if (stream.match('{/literal}', false)) { state.soyState.pop(); return this.token(stream, state); } return tokenUntil(stream, state, /\{\/literal}/); + case "export": + if (match = stream.match(/\w+/)) { + state.soyState.pop(); + if (match == "const") { + state.soyState.push("const-def") + return "keyword"; + } else if (match == "extern") { + state.soyState.push("param-def") + return "keyword"; + } + } else { + stream.next(); + } + return null; + case "const-def": + if (stream.match(/^\w+/)) { + state.soyState.pop(); + return "def"; + } + stream.next(); + return null; } - if (stream.match(/^\{literal}/)) { + if (stream.match('{literal}')) { state.indent += config.indentUnit; state.soyState.push("literal"); state.context = new Context(state.context, "literal", state.variables); @@ -527,7 +579,8 @@ state.context = new Context(state.context, state.tag, tag.variableScope ? state.variables : null); // Otherwise close the current context. } else if (endTag) { - if (!state.context || state.context.tag != tagName) { + var isBalancedForExtern = tagName == 'extern' && (state.context && state.context.tag == 'export'); + if (!state.context || ((state.context.tag != tagName) && !isBalancedForExtern)) { tagError = true; } else if (state.context) { if (state.context.kind) { @@ -552,10 +605,18 @@ state.indent += 2 * config.indentUnit; state.soyState.push("tag"); return "keyword"; - } else if (!state.context && stream.match(/\bimport\b/)) { + } else if (!state.context && stream.sol() && stream.match(/import\b/)) { state.soyState.push("import"); state.indent += 2 * config.indentUnit; return "keyword"; + } else if (match = stream.match('<{')) { + state.soyState.push("template-call-expression"); + state.indent += 2 * config.indentUnit; + state.soyState.push("tag"); + return "keyword"; + } else if (match = stream.match('')) { + state.indent -= 1 * config.indentUnit; + return "keyword"; } return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/soy/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/soy/test.js index 57cd4be4..44e7c4c2 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/soy/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/soy/test.js @@ -26,6 +26,15 @@ '[keyword {] [callee&variable index]([variable-2&error $list])[keyword }]' + '[string "][tag&bracket />]'); + MT('soy-element-composition-test', + '[keyword <{][callee&variable foo]()[keyword }]', + '[keyword >]'); + + MT('soy-element-composition-attribute-test', + '[keyword <{][callee&variable foo]()[keyword }]', + '[attribute class]=[string "Foo"]', + '[keyword >]'); + MT('namespace-test', '[keyword {namespace] [variable namespace][keyword }]') @@ -176,6 +185,24 @@ '[keyword {/template}]', ''); + MT('attribute-type', + '[keyword {template] [def .foo][keyword }]', + ' [keyword {@attribute] [def bar]: [type string][keyword }]', + '[keyword {/template}]', + ''); + + MT('attribute-type-optional', + '[keyword {template] [def .foo][keyword }]', + ' [keyword {@attribute] [def bar]: [type string][keyword }]', + '[keyword {/template}]', + ''); + + MT('attribute-type-all', + '[keyword {template] [def .foo][keyword }]', + ' [keyword {@attribute] [type *][keyword }]', + '[keyword {/template}]', + ''); + MT('state-variable-reference', '[keyword {template] [def .foo][keyword }]', ' [keyword {@param] [def bar]:= [atom true][keyword }]', @@ -281,4 +308,15 @@ MT('import', '[keyword import] {[def Name], [variable Person] [keyword as] [def P]} [keyword from] [string \'examples/proto/example.proto\'];'); + + MT('velog', + '[keyword {velog] [variable-2&error $data][keyword }] Logged [keyword {/velog}]'); + + MT('extern', '[keyword {extern] [def renderer]: ([def s]:[type string])=>[type string][keyword }] [keyword {/extern}]'); + + MT('export extern', '[keyword {export] [keyword extern] [def renderer]: ([def s]:[type string])=>[type string][keyword }] [keyword {/extern}]'); + + MT('const', + '[keyword {const] [def FOO] = [atom 5] [keyword /}]', + '[keyword {export] [keyword const] [def FOO] = [atom 5] [keyword /}]'); })(); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/sparql/sparql.js b/Mod manager/utils/QNModManager/CodeMirror/mode/sparql/sparql.js index bb79abff..6d1d2446 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/sparql/sparql.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/sparql/sparql.js @@ -60,12 +60,18 @@ CodeMirror.defineMode("sparql", function(config) { stream.skipToEnd(); return "comment"; } + else if (ch === "^") { + ch = stream.peek(); + if (ch === "^") stream.eat("^"); + else stream.eatWhile(operatorChars); + return "operator"; + } else if (operatorChars.test(ch)) { stream.eatWhile(operatorChars); return "operator"; } else if (ch == ":") { - stream.eatWhile(/[\w\d\._\-]/); + eatPnLocal(stream); return "atom"; } else if (ch == "@") { @@ -75,7 +81,7 @@ CodeMirror.defineMode("sparql", function(config) { else { stream.eatWhile(/[_\w\d]/); if (stream.eat(":")) { - stream.eatWhile(/[\w\d_\-]/); + eatPnLocal(stream); return "atom"; } var word = stream.current(); @@ -88,6 +94,10 @@ CodeMirror.defineMode("sparql", function(config) { } } + function eatPnLocal(stream) { + stream.match(/(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/i); + } + function tokenLiteral(quote) { return function(stream, state) { var escaped = false, ch; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/sql/sql.js b/Mod manager/utils/QNModManager/CodeMirror/mode/sql/sql.js index 4127cd9a..cd8b757b 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/sql/sql.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/sql/sql.js @@ -122,9 +122,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) return "number"; if (atoms.hasOwnProperty(word)) return "atom"; - if (builtin.hasOwnProperty(word)) return "builtin"; + if (builtin.hasOwnProperty(word)) return "type"; if (keywords.hasOwnProperty(word)) return "keyword"; - if (client.hasOwnProperty(word)) return "string-2"; + if (client.hasOwnProperty(word)) return "builtin"; return null; } } @@ -243,9 +243,9 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { // varName can be quoted with ` or ' or " // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html if (stream.eat("@")) { - stream.match(/^session\./); - stream.match(/^local\./); - stream.match(/^global\./); + stream.match('session.'); + stream.match('local.'); + stream.match('global.'); } if (stream.eat("'")) { @@ -332,7 +332,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-mariadb", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^]/, @@ -370,7 +370,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { "$": hookVar, // The preferred way to escape Identifiers is using double quotes, ref: http://sqlite.org/lang_keywords.html "\"": hookIdentifierDoublequote, - // there is also support for backtics, ref: http://sqlite.org/lang_keywords.html + // there is also support for backticks, ref: http://sqlite.org/lang_keywords.html "`": hookIdentifier } }); @@ -451,8 +451,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { // Spark SQL CodeMirror.defineMIME("text/x-sparksql", { name: "sql", - keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases datata dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"), - builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"), + keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"), + builtin: set("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"), atoms: set("false true null"), operatorChars: /^[*\/+\-%<>!=~&|^]/, dateSQL: set("date time timestamp"), diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/stylus/stylus.js b/Mod manager/utils/QNModManager/CodeMirror/mode/stylus/stylus.js index 653958e8..978696bd 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/stylus/stylus.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/stylus/stylus.js @@ -138,7 +138,7 @@ // Variable if (stream.match(/^(\.|\[)[\w-\'\"\]]+/i, false)) { if (!wordIsTag(stream.current())) { - stream.match(/\./); + stream.match('.'); return ["variable-2", "variable-name"]; } } @@ -722,6 +722,9 @@ return indent; }, electricChars: "}", + blockCommentStart: "/*", + blockCommentEnd: "*/", + blockCommentContinue: " * ", lineComment: "//", fold: "indent" }; @@ -731,14 +734,15 @@ var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"]; // github.com/codemirror/CodeMirror/blob/master/mode/css/css.js - var documentTypes_ = ["domain", "regexp", "url", "url-prefix"]; + // Note, "url-prefix" should precede "url" in order to match correctly in documentTypesRegexp + var documentTypes_ = ["domain", "regexp", "url-prefix", "url"]; var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]; - var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]; + var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","dynamic-range","video-dynamic-range"]; var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"]; var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"]; var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]; var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]; - var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"]; + var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","conic-gradient","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","high","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","standard","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"]; var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"], blockKeywords_ = ["for","if","else","unless", "from", "to"], diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/tiddlywiki/tiddlywiki.js b/Mod manager/utils/QNModManager/CodeMirror/mode/tiddlywiki/tiddlywiki.js index a4fb89f6..6a9ce447 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/tiddlywiki/tiddlywiki.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/tiddlywiki/tiddlywiki.js @@ -114,7 +114,7 @@ CodeMirror.defineMode("tiddlywiki", function () { return 'header'; } - if (ch == '{' && stream.match(/\{\{/)) + if (ch == '{' && stream.match('{{')) return chain(stream, state, twTokenCode); // rudimentary html:// file:// link matching. TW knows much more ... diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/vbscript/vbscript.js b/Mod manager/utils/QNModManager/CodeMirror/mode/vbscript/vbscript.js index 0670c0ce..40339481 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/vbscript/vbscript.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/vbscript/vbscript.js @@ -32,7 +32,7 @@ CodeMirror.defineMode("vbscript", function(conf, parserConf) { var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]"); var doubleOperators = new RegExp("^((<>)|(<=)|(>=))"); var singleDelimiters = new RegExp('^[\\.,]'); - var brakets = new RegExp('^[\\(\\)]'); + var brackets = new RegExp('^[\\(\\)]'); var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*"); var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for']; @@ -183,7 +183,7 @@ CodeMirror.defineMode("vbscript", function(conf, parserConf) { return null; } - if (stream.match(brakets)) { + if (stream.match(brackets)) { return "bracket"; } diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/velocity/velocity.js b/Mod manager/utils/QNModManager/CodeMirror/mode/velocity/velocity.js index 56caa671..79a621a5 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/velocity/velocity.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/velocity/velocity.js @@ -48,7 +48,7 @@ CodeMirror.defineMode("velocity", function() { else if (state.inParams) return chain(stream, state, tokenString(ch)); } - // is it one of the special signs []{}().,;? Seperator? + // is it one of the special signs []{}().,;? Separator? else if (/[\[\]{}\(\),;\.]/.test(ch)) { if (ch == "(" && beforeParams) state.inParams = true; @@ -82,6 +82,7 @@ CodeMirror.defineMode("velocity", function() { } // variable? else if (ch == "$") { + stream.eat("!"); stream.eatWhile(/[\w\d\$_\.{}-]/); // is it one of the specials? if (specials && specials.propertyIsEnumerable(stream.current())) { diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/test.js b/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/test.js index bafe726d..38c1cbe4 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/test.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/test.js @@ -139,6 +139,32 @@ "" ); + MT("align_assignments", + /** + * always @(posedge clk) begin + * if (rst) + * data_out <= 8'b0 + + * 8'b1; + * else + * data_out = 8'b0 + + * 8'b1; + * data_out = + * 8'b0 + 8'b1; + * end + */ + "[keyword always] [def @][bracket (][keyword posedge] [variable clk][bracket )] [keyword begin]", + " [keyword if] [bracket (][variable rst][bracket )]", + " [variable data_out] [meta <=] [number 8'b0] [meta +]", + " [number 8'b1];", + " [keyword else]", + " [variable data_out] [meta =] [number 8'b0] [meta +]", + " [number 8'b1];", + " [variable data_out] [meta =] [number 8'b0] [meta +]", + " [number 8'b1];", + "[keyword end]", + "" + ); + // Indentation tests MT("indent_single_statement_if", "[keyword if] [bracket (][variable foo][bracket )]", @@ -270,4 +296,148 @@ "" ); + MT("indent_uvm_macros", + /** + * `uvm_object_utils_begin(foo) + * `uvm_field_event(foo, UVM_ALL_ON) + * `uvm_object_utils_end + */ + "[def `uvm_object_utils_begin][bracket (][variable foo][bracket )]", + " [def `uvm_field_event][bracket (][variable foo], [variable UVM_ALL_ON][bracket )]", + "[def `uvm_object_utils_end]", + "" + ); + + MT("indent_uvm_macros2", + /** + * `uvm_do_with(mem_read,{ + * bar_nb == 0; + * }) + */ + "[def `uvm_do_with][bracket (][variable mem_read],[bracket {]", + " [variable bar_nb] [meta ==] [number 0];", + "[bracket })]", + "" + ); + + MT("indent_wait_disable_fork", + /** + * virtual task body(); + * repeat (20) begin + * fork + * `uvm_create_on(t,p_seq) + * join_none + * end + * wait fork; + * disable fork; + * endtask : body + */ + "[keyword virtual] [keyword task] [variable body][bracket ()];", + " [keyword repeat] [bracket (][number 20][bracket )] [keyword begin]", + " [keyword fork]", + " [def `uvm_create_on][bracket (][variable t],[variable p_seq][bracket )]", + " [keyword join_none]", + " [keyword end]", + " [keyword wait] [keyword fork];", + " [keyword disable] [keyword fork];", + "[keyword endtask] : [variable body]", + "" + ); + + MT("indent_typedef_class", + /** + * typedef class asdf; + * typedef p p_t[]; + * typedef enum { + * ASDF + * } t; + */ + "[keyword typedef] [keyword class] [variable asdf];", + "[keyword typedef] [variable p] [variable p_t][bracket [[]]];", + "[keyword typedef] [keyword enum] [bracket {]", + " [variable ASDF]", + "[bracket }] [variable t];", + "" + ); + + MT("indent_case_with_macro", + /** + * // It should be assumed that Macros can have ';' inside, or 'begin'/'end' blocks. + * // As such, 'case' statement should indent correctly with macros inside. + * case(foo) + * ASDF : this.foo = seqNum; + * ABCD : `update(f) + * EFGH : `update(g) + * endcase + */ + "[keyword case][bracket (][variable foo][bracket )]", + " [variable ASDF] : [keyword this].[variable foo] [meta =] [variable seqNum];", + " [variable ABCD] : [def `update][bracket (][variable f][bracket )]", + " [variable EFGH] : [def `update][bracket (][variable g][bracket )]", + "[keyword endcase]", + "" + ); + + MT("indent_extern_function", + /** + * extern virtual function void do(ref packet trans); + * extern virtual function void do2(ref packet trans); + */ + "[keyword extern] [keyword virtual] [keyword function] [keyword void] [variable do1][bracket (][keyword ref] [variable packet] [variable trans][bracket )];", + "[keyword extern] [keyword virtual] [keyword function] [keyword void] [variable do2][bracket (][keyword ref] [variable packet] [variable trans][bracket )];", + "" + ); + + MT("indent_assignment", + /** + * for (int i=1;i < fun;i++) begin + * foo = 2 << asdf || 11'h35 >> abcd + * && 8'h6 | 1'b1; + * end + */ + "[keyword for] [bracket (][keyword int] [variable i][meta =][number 1];[variable i] [meta <] [variable fun];[variable i][meta ++][bracket )] [keyword begin]", + " [variable foo] [meta =] [number 2] [meta <<] [variable asdf] [meta ||] [number 11'h35] [meta >>] [variable abcd]", + " [meta &&] [number 8'h6] [meta |] [number 1'b1];", + "[keyword end]", + "" + ); + + MT("indent_foreach_constraint", + /** + * `uvm_rand_send_with(wrTlp, { + * length ==1; + * foreach (Data[i]) { + * payload[i] == Data[i]; + * } + * }) + */ + "[def `uvm_rand_send_with][bracket (][variable wrTlp], [bracket {]", + " [variable length] [meta ==][number 1];", + " [keyword foreach] [bracket (][variable Data][bracket [[][variable i][bracket ]])] [bracket {]", + " [variable payload][bracket [[][variable i][bracket ]]] [meta ==] [variable Data][bracket [[][variable i][bracket ]]];", + " [bracket }]", + "[bracket })]", + "" + ); + + MT("indent_compiler_directives", + /** + * `ifdef DUT + * `else + * `ifndef FOO + * `define FOO + * `endif + * `endif + * `timescale 1ns/1ns + */ + "[def `ifdef] [variable DUT]", + "[def `else]", + " [def `ifndef] [variable FOO]", + " [def `define] [variable FOO]", + " [def `endif]", + "[def `endif]", + "[def `timescale] [number 1][variable ns][meta /][number 1][variable ns]", + "" + ); + })(); diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/verilog.js b/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/verilog.js index 43990452..6c799f29 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/verilog.js +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/verilog/verilog.js @@ -16,6 +16,12 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { var indentUnit = config.indentUnit, statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, + // compilerDirectivesUseRegularIndentation - If set, Compiler directive + // indentation follows the same rules as everything else. Otherwise if + // false, compiler directives will track their own indentation. + // For example, `ifdef nested inside another `ifndef will be indented, + // but a `ifdef inside a function block may not be indented. + compilerDirectivesUseRegularIndentation = parserConfig.compilerDirectivesUseRegularIndentation, noIndentKeywords = parserConfig.noIndentKeywords || [], multiLineStrings = parserConfig.multiLineStrings, hooks = parserConfig.hooks || {}; @@ -62,7 +68,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { binary_module_path_operator ::= == | != | && | || | & | | | ^ | ^~ | ~^ */ - var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/; + var isOperatorChar = /[\+\-\*\/!~&|^%=?:<>]/; var isBracketChar = /[\[\]{}()]/; var unsignedNumber = /\d[0-9_]*/; @@ -72,8 +78,13 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i; var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i; - var closingBracketOrWord = /^((\w+)|[)}\]])/; + var closingBracketOrWord = /^((`?\w+)|[)}\]])/; var closingBracket = /[)}\]]/; + var compilerDirectiveRegex = new RegExp( + "^(`(?:ifdef|ifndef|elsif|else|endif|undef|undefineall|define|include|begin_keywords|celldefine|default|" + + "nettype|end_keywords|endcelldefine|line|nounconnected_drive|pragma|resetall|timescale|unconnected_drive))\\b"); + var compilerDirectiveBeginRegex = /^(`(?:ifdef|ifndef|elsif|else))\b/; + var compilerDirectiveEndRegex = /^(`(?:elsif|else|endif))\b/; var curPunc; var curKeyword; @@ -96,6 +107,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { openClose["do" ] = "while"; openClose["fork" ] = "join;join_any;join_none"; openClose["covergroup"] = "endgroup"; + openClose["macro_begin"] = "macro_end"; for (var i in noIndentKeywords) { var keyword = noIndentKeywords[i]; @@ -105,7 +117,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { } // Keywords which open statements that are ended with a semi-colon - var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while"); + var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while extern typedef"); function tokenBase(stream, state) { var ch = stream.peek(), style; @@ -125,6 +137,23 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { if (ch == '`') { stream.next(); if (stream.eatWhile(/[\w\$_]/)) { + var cur = stream.current(); + curKeyword = cur; + // Macros that end in _begin, are start of block and end with _end + if (cur.startsWith("`uvm_") && cur.endsWith("_begin")) { + var keywordClose = curKeyword.substr(0,curKeyword.length - 5) + "end"; + openClose[cur] = keywordClose; + curPunc = "newblock"; + } else { + stream.eatSpace(); + if (stream.peek() == '(') { + // Check if this is a block + curPunc = "newmacro"; + } + var withSpace = stream.current(); + // Move the stream back before the spaces + stream.backUp(withSpace.length - cur.length); + } return "def"; } else { return null; @@ -145,6 +174,12 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { stream.eatWhile(/[\d_.]/); return "def"; } + // Event + if (ch == '@') { + stream.next(); + stream.eatWhile(/[@]/); + return "def"; + } // Strings if (ch == '"') { stream.next(); @@ -178,6 +213,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { // Operators if (stream.eatWhile(isOperatorChar)) { + curPunc = stream.current(); return "meta"; } @@ -187,6 +223,15 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { if (keywords[cur]) { if (openClose[cur]) { curPunc = "newblock"; + if (cur === "fork") { + // Fork can be a statement instead of block in cases of: + // "disable fork;" and "wait fork;" (trailing semicolon) + stream.eatSpace() + if (stream.peek() == ';') { + curPunc = "newstatement"; + } + stream.backUp(stream.current().length - cur.length); + } } if (statementKeywords[cur]) { curPunc = "newstatement"; @@ -226,16 +271,17 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { return "comment"; } - function Context(indented, column, type, align, prev) { + function Context(indented, column, type, scopekind, align, prev) { this.indented = indented; this.column = column; this.type = type; + this.scopekind = scopekind; this.align = align; this.prev = prev; } - function pushContext(state, col, type) { + function pushContext(state, col, type, scopekind) { var indent = state.indented; - var c = new Context(indent, col, type, null, state.context); + var c = new Context(indent, col, type, scopekind ? scopekind : "", null, state.context); return state.context = c; } function popContext(state) { @@ -261,6 +307,16 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { } } + function isInsideScopeKind(ctx, scopekind) { + if (ctx == null) { + return false; + } + if (ctx.scopekind === scopekind) { + return true; + } + return isInsideScopeKind(ctx.prev, scopekind); + } + function buildElectricInputRegEx() { // Reindentation should occur on any bracket char: {}()[] // or on a match of any of the block closing keywords, at @@ -287,8 +343,9 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { startState: function(basecolumn) { var state = { tokenize: null, - context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + context: new Context((basecolumn || 0) - indentUnit, 0, "top", "top", false), indented: 0, + compilerDirectiveIndented: 0, startOfLine: true }; if (hooks.startState) hooks.startState(state); @@ -313,15 +370,42 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { curPunc = null; curKeyword = null; var style = (state.tokenize || tokenBase)(stream, state); - if (style == "comment" || style == "meta" || style == "variable") return style; + if (style == "comment" || style == "meta" || style == "variable") { + if (((curPunc === "=") || (curPunc === "<=")) && !isInsideScopeKind(ctx, "assignment")) { + // '<=' could be nonblocking assignment or lessthan-equals (which shouldn't cause indent) + // Search through the context to see if we are already in an assignment. + // '=' could be inside port declaration with comma or ')' afterward, or inside for(;;) block. + pushContext(state, stream.column() + curPunc.length, "assignment", "assignment"); + if (ctx.align == null) ctx.align = true; + } + return style; + } if (ctx.align == null) ctx.align = true; - if (curPunc == ctx.type) { - popContext(state); - } else if ((curPunc == ";" && ctx.type == "statement") || + var isClosingAssignment = ctx.type == "assignment" && + closingBracket.test(curPunc) && ctx.prev && ctx.prev.type === curPunc; + if (curPunc == ctx.type || isClosingAssignment) { + if (isClosingAssignment) { + ctx = popContext(state); + } + ctx = popContext(state); + if (curPunc == ")") { + // Handle closing macros, assuming they could have a semicolon or begin/end block inside. + if (ctx && (ctx.type === "macro")) { + ctx = popContext(state); + while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state); + } + } else if (curPunc == "}") { + // Handle closing statements like constraint block: "foreach () {}" which + // do not have semicolon at end. + if (ctx && (ctx.type === "statement")) { + while (ctx && (ctx.type == "statement")) ctx = popContext(state); + } + } + } else if (((curPunc == ";" || curPunc == ",") && (ctx.type == "statement" || ctx.type == "assignment")) || (ctx.type && isClosing(curKeyword, ctx.type))) { ctx = popContext(state); - while (ctx && ctx.type == "statement") ctx = popContext(state); + while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state); } else if (curPunc == "{") { pushContext(state, stream.column(), "}"); } else if (curPunc == "[") { @@ -329,9 +413,9 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { } else if (curPunc == "(") { pushContext(state, stream.column(), ")"); } else if (ctx && ctx.type == "endcase" && curPunc == ":") { - pushContext(state, stream.column(), "statement"); + pushContext(state, stream.column(), "statement", "case"); } else if (curPunc == "newstatement") { - pushContext(state, stream.column(), "statement"); + pushContext(state, stream.column(), "statement", curKeyword); } else if (curPunc == "newblock") { if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) { // The 'function' keyword can appear in some other contexts where it actually does not @@ -339,9 +423,23 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { // Do nothing in this case } else if (curKeyword == "task" && ctx && ctx.type == "statement") { // Same thing for task + } else if (curKeyword == "class" && ctx && ctx.type == "statement") { + // Same thing for class (e.g. typedef) } else { var close = openClose[curKeyword]; - pushContext(state, stream.column(), close); + pushContext(state, stream.column(), close, curKeyword); + } + } else if (curPunc == "newmacro" || (curKeyword && curKeyword.match(compilerDirectiveRegex))) { + if (curPunc == "newmacro") { + // Macros (especially if they have parenthesis) potentially have a semicolon + // or complete statement/block inside, and should be treated as such. + pushContext(state, stream.column(), "macro", "macro"); + } + if (curKeyword.match(compilerDirectiveEndRegex)) { + state.compilerDirectiveIndented -= statementIndentUnit; + } + if (curKeyword.match(compilerDirectiveBeginRegex)) { + state.compilerDirectiveIndented += statementIndentUnit; } } @@ -361,8 +459,15 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { var possibleClosing = textAfter.match(closingBracketOrWord); if (possibleClosing) closing = isClosing(possibleClosing[0], ctx.type); + if (!compilerDirectivesUseRegularIndentation && textAfter.match(compilerDirectiveRegex)) { + if (textAfter.match(compilerDirectiveEndRegex)) { + return state.compilerDirectiveIndented - statementIndentUnit; + } + return state.compilerDirectiveIndented; + } if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit); - else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1); + else if ((closingBracket.test(ctx.type) || ctx.type == "assignment") + && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1); else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit; else return ctx.indented + (closing ? 0 : indentUnit); }, @@ -437,7 +542,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { }; var tlvIndentUnit = 3; var tlvTrackStatements = false; - var tlvIdentMatch = /^([~!@#\$%\^&\*-\+=\?\/\\\|'"<>]+)([\d\w_]*)/; // Matches an identifiere. + var tlvIdentMatch = /^([~!@#\$%\^&\*-\+=\?\/\\\|'"<>]+)([\d\w_]*)/; // Matches an identifier. // Note that ':' is excluded, because of it's use in [:]. var tlvFirstLevelIndentMatch = /^[! ] /; var tlvLineIndentationMatch = /^[! ] */; @@ -614,7 +719,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) { } else { // Just swallow one character and try again. // This enables subsequent identifier match with preceding symbol character, which - // is legal within a statement. (Eg, !$reset). It also enables detection of + // is legal within a statement. (E.g., !$reset). It also enables detection of // comment start with preceding symbols. stream.backUp(stream.current().length - 1); style = "tlv-default"; diff --git a/Mod manager/utils/QNModManager/CodeMirror/mode/vue/index.html b/Mod manager/utils/QNModManager/CodeMirror/mode/vue/index.html index df519a5c..6ea54b75 100644 --- a/Mod manager/utils/QNModManager/CodeMirror/mode/vue/index.html +++ b/Mod manager/utils/QNModManager/CodeMirror/mode/vue/index.html @@ -38,7 +38,7 @@

      Vue.js mode