configui/public/ace/js/keybinding-vim.js

8 lines
104 KiB
JavaScript
Raw Normal View History

2021-10-19 15:41:09 +00:00
define("ace/ext/hardwrap",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){function d(e,t,n){if(e.length<t)return;var r=e.slice(0,t),i=e.slice(t),s=/^(?:(\s+)|(\S+)(\s+))/.exec(i),o=/(?:(\s+)|(\s+)(\S+))$/.exec(r),u=0,a=0;o&&!o[2]&&(u=t-o[1].length,a=t),s&&!s[2]&&(u||(u=t),a=t+s[1].length);if(u)return{start:u,end:a};if(o&&o[2]&&o.index>n)return{start:o.index,end:o.index+o[3].length}}var n=t.column||e.getOption("printMarginColumn"),i=Math.min(t.startRow,t.endRow),s=Math.max(t.startRow,t.endRow),o=e.session;while(i<=s){var u=o.getLine(i);if(u.length>n){var a=d(u,n,5);a&&o.replace(new r(i,a.start,i,a.end),"\n"),s++}else if(/\S/.test(u)&&i!=s){var f=o.getLine(i+1);if(f&&/\S/.test(f)){var l=u.replace(/\s+$/,""),c=f.replace(/^\s+/,""),h=l+" "+c,a=d(h,n,5);if(a&&a.start>l.length||h.length<n){var p=new r(i,l.length,i+1,f.length-c.length);o.replace(p," "),i--,s--}}}i++}}var r=e("../range").Range;t.hardWrap=i}),define("ace/keyboard/vim",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/dom","ace/lib/oop","ace/lib/keys","ace/lib/event","ace/search","ace/lib/useragent","ace/search_highlight","ace/commands/multi_select_commands","ace/mode/text","ace/ext/hardwrap","ace/multi_select"],function(e,t,n){"use strict";function r(){function t(e){return typeof e!="object"?e+"":"line"in e?e.line+":"+e.ch:"anchor"in e?t(e.anchor)+"->"+t(e.head):Array.isArray(e)?"["+e.map(function(e){return t(e)})+"]":JSON.stringify(e)}var e="";for(var n=0;n<arguments.length;n++){var r=arguments[n],i=t(r);e+=i+" "}console.log(e)}function g(e){return{row:e.line,column:e.ch}}function y(e){return new x(e.row,e.column)}function N(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),m.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",sr),ot(e),m.on(e.getInputField(),"paste",D(e))}function C(e){e.setOption("disableInput",!1),e.off("cursorActivity",sr),m.off(e.getInputField(),"paste",D(e)),e.state.vim=null}function k(e,t){this==m.keyMap.vim&&m.rmClass(e.getWrapperElement(),"cm-fat-cursor"),(!t||t.attach!=L)&&C(e)}function L(e,t){this==m.keyMap.vim&&m.addClass(e.getWrapperElement(),"cm-fat-cursor"),(!t||t.attach!=L)&&N(e)}function A(e,t){if(!t)return undefined;if(this[e])return this[e];var n=_(e);if(!n)return!1;var r=m.Vim.findKey(t,n);return typeof r=="function"&&m.signal(t,"vim-keypress",n),r}function _(e){if(e.charAt(0)=="'")return e.charAt(1);var t=e.split(/-(?!$)/),n=t[t.length-1];if(t.length==1&&t[0].length==1)return!1;if(t.length==2&&t[0]=="Shift"&&n.length==1)return!1;var r=!1;for(var i=0;i<t.length;i++){var s=t[i];s in O?t[i]=O[s]:r=!0,s in M&&(t[i]=M[s])}return r?(K(n)&&(t[t.length-1]=n.toLowerCase()),"<"+t.join("-")+">"):!1}function D(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(kt(e.getCursor(),0,1)),xt.enterInsertMode(e,{},t))}),t.onPasteFn}function j(e,t){var n=[];for(var r=e;r<e+t;r++)n.push(String.fromCharCode(r));return n}function X(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function V(e){return/^[a-z]$/.test(e)}function $(e){return"()[]{}".indexOf(e)!=-1}function J(e){return P.test(e)}function K(e){return z.test(e)}function Q(e){return/^\s*$/.test(e)}function G(e){return".?!".indexOf(e)!=-1}function Y(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}function et(e,t,n,r,i){if(t===undefined&&!i)throw Error("defaultValue is required unless callback is provided");n||(n="string"),Z[e]={type:n,defaultValue:t,callback:i};if(r)for(var s=0;s<r.length;s++)Z[r[s]]=Z[e];t&&tt(e,t)}function tt(e,t,n,r){var i=Z[e];r=r||{};var s=r.scope;if(!i)return new Error("Unknown option: "+e);if(i.type=="boolean"){if(t&&t!==!0)return new Error("Invalid argument: "+e+"="+t);t!==!1&&(t=!0)}i.callback?(s!=="local"&&i.callback(t,undefined),s!=="global"&&n&&i.callback(t,n)):(s!=="local"&&(i.value=i.type=="boolean"?!!t:t),s!=="global"&&n&&(n.state.vim.options[e]={value:t}))}function nt(e,t,n){var r=Z[e];n=n||{};var i=n.scope;if(!r)return new Error("Unknown option: "+e);if(r.callback){var s=t&&r.callback(undefined,t);if(i
window.require(["ace/keyboard/vim"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();