ext-hardwrap-6a63c981.js 2.2 KB

12
  1. import{g as k}from"./index-15e3682d.js";function z(p,M){for(var t=0;t<M.length;t++){const l=M[t];if(typeof l!="string"&&!Array.isArray(l)){for(const d in l)if(d!=="default"&&!(d in p)){const c=Object.getOwnPropertyDescriptor(l,d);c&&Object.defineProperty(p,d,c.get?c:{enumerable:!0,get:()=>l[d]})}}}return Object.freeze(Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}))}var m={exports:{}};(function(p,M){ace.define("ace/ext/hardwrap",["require","exports","module","ace/range","ace/editor","ace/config"],function(t,l,d){var c=t("../range").Range;function S(n,e){for(var o=e.column||n.getOption("printMarginColumn"),R=e.allowMerge!=!1,r=Math.min(e.startRow,e.endRow),w=Math.max(e.startRow,e.endRow),v=n.session;r<=w;){var g=v.getLine(r);if(g.length>o){var u=j(g,o,5);if(u){var D=/^\s*/.exec(g)[0];v.replace(new c(r,u.start,r,u.end),`
  2. `+D)}w++}else if(R&&/\S/.test(g)&&r!=w){var x=v.getLine(r+1);if(x&&/\S/.test(x)){var h=g.replace(/\s+$/,""),O=x.replace(/^\s+/,""),E=h+" "+O,u=j(E,o,5);if(u&&u.start>h.length||E.length<o){var H=new c(r,h.length,r+1,x.length-O.length);v.replace(H," "),r--,w--}else h.length<g.length&&v.remove(new c(r,h.length,r,g.length))}}r++}function j($,s,C){if(!($.length<s)){var P=$.slice(0,s),W=$.slice(s),i=/^(?:(\s+)|(\S+)(\s+))/.exec(W),a=/(?:(\s+)|(\s+)(\S+))$/.exec(P),f=0,y=0;if(a&&!a[2]&&(f=s-a[1].length,y=s),i&&!i[2]&&(f||(f=s),y=s+i[1].length),f)return{start:f,end:y};if(a&&a[2]&&a.index>C)return{start:a.index,end:a.index+a[2].length};if(i&&i[2])return f=s+i[2].length,{start:f,end:f+i[3].length}}}}function b(n){if(n.command.name=="insertstring"&&/\S/.test(n.args)){var e=n.editor,o=e.selection.cursor;if(o.column<=e.renderer.$printMarginColumn)return;var R=e.session.$undoManager.$lastDelta;S(e,{startRow:o.row,endRow:o.row,allowMerge:!1}),R!=e.session.$undoManager.$lastDelta&&e.session.markUndoGroup()}}var A=t("../editor").Editor;t("../config").defineOptions(A.prototype,"editor",{hardWrap:{set:function(n){n?this.commands.on("afterExec",b):this.commands.off("afterExec",b)},value:!1}}),l.hardWrap=S}),function(){ace.require(["ace/ext/hardwrap"],function(t){p&&(p.exports=t)})}()})(m);var _=m.exports;const B=k(_),G=z({__proto__:null,default:B},[_]);export{G as e};