mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-11-09 15:08:27 +01:00
8 lines
100 KiB
JavaScript
8 lines
100 KiB
JavaScript
|
ace.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/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 m(e){return{row:e.line,column:e.ch}}function g(e){return new S(e.row,e.column)}function T(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),v.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",er),rt(e),v.on(e.getInputField(),"paste",_(e))}function N(e){e.setOption("disableInput",!1),e.off("cursorActivity",er),v.off(e.getInputField(),"paste",_(e)),e.state.vim=null}function C(e,t){this==v.keyMap.vim&&v.rmClass(e.getWrapperElement(),"cm-fat-cursor"),(!t||t.attach!=k)&&N(e)}function k(e,t){this==v.keyMap.vim&&v.addClass(e.getWrapperElement(),"cm-fat-cursor"),(!t||t.attach!=k)&&T(e)}function L(e,t){if(!t)return undefined;if(this[e])return this[e];var n=M(e);if(!n)return!1;var r=v.Vim.findKey(t,n);return typeof r=="function"&&v.signal(t,"vim-keypress",n),r}function M(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 A?t[i]=A[s]:r=!0,s in O&&(t[i]=O[s])}return r?(V(n)&&(t[t.length-1]=n.toLowerCase()),"<"+t.join("-")+">"):!1}function _(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(Tt(e.getCursor(),0,1)),wt.enterInsertMode(e,{},t))}),t.onPasteFn}function B(e,t){var n=[];for(var r=e;r<e+t;r++)n.push(String.fromCharCode(r));return n}function U(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function z(e){return/^[a-z]$/.test(e)}function W(e){return"()[]{}".indexOf(e)!=-1}function X(e){return D.test(e)}function V(e){return/^[A-Z]$/.test(e)}function $(e){return/^\s*$/.test(e)}function J(e){return".?!".indexOf(e)!=-1}function K(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}function G(e,t,n,r,i){if(t===undefined&&!i)throw Error("defaultValue is required unless callback is provided");n||(n="string"),Q[e]={type:n,defaultValue:t,callback:i};if(r)for(var s=0;s<r.length;s++)Q[r[s]]=Q[e];t&&Y(e,t)}function Y(e,t,n,r){var i=Q[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 Z(e,t,n){var r=Q[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!=="global"&&s!==undefined)return s;if(i!=="local")return r.callback();return}var s=i!=="global"&&t&&t.state.vim.options[e];return(s||i!=="local"&&r||{}).value}function nt(){this.latestRegister=undefined,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=undefined,this.lastInsertModeChanges=tt()}function rt(e){return e.state.vim||(e.state.vim={inputState:new at,lastEditInputState:undefined,lastEditActionCommand:undefined,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:undefined,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function st(){it={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:undefined,jumpList:et(),macroModeState:new nt,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new ht({}),searchHistoryController:new pt,exCommandHistoryController:new
|
||
|
ace.require(["ace/keyboard/vim"], function(m) {
|
||
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
||
|
module.exports = m;
|
||
|
}
|
||
|
});
|
||
|
})();
|
||
|
|