mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-16 14:54:51 +00:00
769ffa19b7
* Update codemirror.js to 5.58.2 * Update codemirror.css to 5.58.2 * Update activeline.js to 5.58.2 * Update dialog.js to 5.58.2 * Update jump-to-line.js to 5.58.2 * Update search.js to 5.58.2 * Update searchcursor.js to 5.58.2 * Update xml.js to 5.58.2 * Update show-hint.js to 5.58.2 * Update show-hint.css to 5.58.2 * Update javascript-hint.js to 5.58.2 * Update xml-hint.js to 5.58.2 * Update html-hint.js to 5.58.2 * Update css-hint.js to 5.58.2 * Update anyword-hint.js to 5.58.2 * Update closebrackets.js to 5.58.2 * Update matchbrackets.js to 5.58.2 * Update closetag.js to 5.58.2 * Update xml-fold.js to 5.58.2 * Update fullscreen.js to 5.58.2 * Update emacs.js to 5.58.2 * Update sublime.js to 5.58.2 * Update comment.js to 5.58.2 * Update vim.js to 5.58.2 * Update css.js to 5.58.2 * Update multiplex.js to 5.58.2 * Update htmlembedded.js to 5.58.2 * Update htmlmixed.js to 5.58.2 * Update javascript.js to 5.58.2 * Update markdown.js to 5.58.2 * Update markdown.js * Update readme.tid * Update markdown.js
4 lines
3.1 KiB
JavaScript
Executable File
4 lines
3.1 KiB
JavaScript
Executable File
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
|
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
|
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(i){var h=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),k=i.Pos,p={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function v(t){return t&&t.bracketRegex||/[(){}[\]]/}function u(t,e,n){var r=t.getLineHandle(e.line),i=e.ch-1,c=n&&n.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var a=v(n),o=!c&&0<=i&&a.test(r.text.charAt(i))&&p[r.text.charAt(i)]||a.test(r.text.charAt(i+1))&&p[r.text.charAt(++i)];if(!o)return null;var l=">"==o.charAt(1)?1:-1;if(n&&n.strict&&0<l!=(i==e.ch))return null;var s=t.getTokenTypeAt(k(e.line,i+1)),h=f(t,k(e.line,i+(0<l?1:0)),l,s||null,n);return null==h?null:{from:k(e.line,i),to:h&&h.pos,match:h&&h.ch==o.charAt(0),forward:0<l}}function f(t,e,n,r,i){for(var c=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,o=[],l=v(i),s=0<n?Math.min(e.line+a,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-a),h=e.line;h!=s;h+=n){var u=t.getLine(h);if(u){var f=0<n?0:u.length-1,m=0<n?u.length:-1;if(!(u.length>c))for(h==e.line&&(f=e.ch-(n<0?1:0));f!=m;f+=n){var g=u.charAt(f);if(l.test(g)&&(void 0===r||t.getTokenTypeAt(k(h,f+1))==r)){var d=p[g];if(d&&">"==d.charAt(1)==0<n)o.push(g);else{if(!o.length)return{pos:k(h,f),ch:g};o.pop()}}}}}return h-n!=(0<n?t.lastLine():t.firstLine())&&null}function e(t,e,n){for(var r=t.state.matchBrackets.maxHighlightLineLength||1e3,i=[],c=t.listSelections(),a=0;a<c.length;a++){var o,l=c[a].empty()&&u(t,c[a].head,n);l&&t.getLine(l.from.line).length<=r&&(o=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i.push(t.markText(l.from,k(l.from.line,l.from.ch+1),{className:o})),l.to&&t.getLine(l.to.line).length<=r&&i.push(t.markText(l.to,k(l.to.line,l.to.ch+1),{className:o})))}if(i.length){h&&t.state.focused&&t.focus();function s(){t.operation(function(){for(var t=0;t<i.length;t++)i[t].clear()})}if(!e)return s;setTimeout(s,800)}}function c(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=e(t,!1,t.state.matchBrackets)})}i.defineOption("matchBrackets",!1,function(t,e,n){function r(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}n&&n!=i.Init&&(t.off("cursorActivity",c),t.off("focus",c),t.off("blur",r),r(t)),e&&(t.state.matchBrackets="object"==typeof e?e:{},t.on("cursorActivity",c),t.on("focus",c),t.on("blur",r))}),i.defineExtension("matchBrackets",function(){e(this,!0)}),i.defineExtension("findMatchingBracket",function(t,e,n){return!n&&"boolean"!=typeof e||(e=n?(n.strict=e,n):e?{strict:!0}:null),u(this,t,e)}),i.defineExtension("scanForBracket",function(t,e,n,r){return f(this,t,e,n,r)})});
|