- md5
- eab247f20980dc6ab3b675a0aac60ef5
- sha1
- 5b8e909f8be68efb4c5cefac113f8e76d23a5353
- sha256
- 7d5baf09025e5be4a460bd4e50f1fbc7bd8f0e0f6cd837770823250c58c824c9
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],a):a(CodeMirror)}(function(a){"use strict";function b(a,b){return"string"==typeof a?a=new RegExp(a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),b?"gi":"g"):a.global||(a=new RegExp(a.source,a.ignoreCase?"gi":"g")),{token:function(b){a.lastIndex=b.pos;var c=a.exec(b.string);return c&&c.index==b.pos?(b.pos+=c[0].length,"searching"):void(c?b.pos=c.index:b.skipToEnd())}}}function c(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function d(a){return a.state.search||(a.state.search=new c)}function e(a){return"string"==typeof a&&a==a.toLowerCase()}function f(a,b,c){return a.getSearchCursor(b,c,e(b))}function g(a,b,c,d){a.openDialog(b,d,{value:c,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){n(a)}})}function h(a,b,c,d,e){a.openDialog?a.openDialog(b,e,{value:d,selectValueOnOpen:!0}):e(prompt(c,d))}function i(a,b,c,d){a.openConfirm?a.openConfirm(b,d):confirm(c)&&d[0]()}function j(a){var b=a.match(/^\/(.*)\/([a-z]*)$/);if(b)try{a=new RegExp(b[1],-1==b[2].indexOf("i")?"":"i")}catch(c){}return("string"==typeof a?""==a:a.test(""))&&(a=/x^/),a}function k(a,c,d){c.queryText=d,c.query=j(d),a.removeOverlay(c.overlay,e(c.query)),c.overlay=b(c.query,e(c.query)),a.addOverlay(c.overlay),a.showMatchesOnScrollbar&&(c.annotate&&(c.annotate.clear(),c.annotate=null),c.annotate=a.showMatchesOnScrollbar(c.query,e(c.query)))}function l(b,c,e){var f=d(b);if(f.query)return m(b,c);var i=b.getSelection()||f.lastQuery;e&&b.openDialog?g(b,p,i,function(c,d){a.e_stop(d),c&&(c!=f.queryText&&k(b,f,c),m(b,d.shiftKey))}):h(b,p,"Search for:",i,function(a){a&&!f.query&&b.operation(function(){k(b,f,a),f.posFrom=f.posTo=b.getCursor(),m(b,c)})})}function m(b,c){b.operation(function(){var e=d(b),g=f(b,e.query,c?e.posFrom:e.posTo);(g.find(c)||(g=f(b,e.query,c?a.Pos(b.lastLine()):a.Pos(b.firstLine(),0)),g.find(c)))&&(b.setSelection(g.from(),g.to()),b.scrollIntoView({from:g.from(),to:g.to()},20),e.posFrom=g.from(),e.posTo=g.to())})}function n(a){a.operation(function(){var b=d(a);b.lastQuery=b.query,b.query&&(b.query=b.queryText=null,a.removeOverlay(b.overlay),b.annotate&&(b.annotate.clear(),b.annotate=null))})}function o(a,b){if(!a.getOption("readOnly")){var c=a.getSelection()||d(a).lastQuery;h(a,q,"Replace:",c,function(c){c&&(c=j(c),h(a,r,"Replace with:","",function(d){if(b)a.operation(function(){for(var b=f(a,c);b.findNext();)if("string"!=typeof c){var e=a.getRange(b.from(),b.to()).match(c);b.replace(d.replace(/\$(\d)/g,function(a,b){return e[b]}))}else b.replace(d)});else{n(a);var e=f(a,c,a.getCursor()),g=function(){var b,d=e.from();!(b=e.findNext())&&(e=f(a,c),!(b=e.findNext())||d&&e.from().line==d.line&&e.from().ch==d.ch)||(a.setSelection(e.from(),e.to()),a.scrollIntoView({from:e.from(),to:e.to()}),i(a,s,"Replace?",[function(){h(b)},g]))},h=function(a){e.replace("string"==typeof c?d:d.replace(/\$(\d)/g,function(b,c){return a[c]})),g()};g()}}))})}}var p='Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',q='Replace: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',r='With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',s="Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";a.commands.find=function(a){n(a),l(a)},a.commands.findPersistent=function(a){n(a),l(a,!1,!0)},a.commands.findNext=l,a.commands.findPrev=function(a){l(a,!0)},a.commands.clearSearch=n,a.commands.replace=o,a.commands.replaceAll=function(a){o(a,!0)}});
No other release has this exact content. See every version of this file.