mirror of
https://github.com/lxsang/ant-http
synced 2024-11-09 21:58:20 +01:00
1 line
94 KiB
JavaScript
1 line
94 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 E(e.row,e.column)}function x(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),v.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",Jn),tt(e),v.on(e.getInputField(),"paste",M(e))}function T(e){e.setOption("disableInput",!1),e.off("cursorActivity",Jn),v.off(e.getInputField(),"paste",M(e)),e.state.vim=null}function N(e,t){this==v.keyMap.vim&&v.rmClass(e.getWrapperElement(),"cm-fat-cursor"),(!t||t.attach!=C)&&T(e,!1)}function C(e,t){this==v.keyMap.vim&&v.addClass(e.getWrapperElement(),"cm-fat-cursor"),(!t||t.attach!=C)&&x(e)}function k(e,t){if(!t)return undefined;var n=O(e);if(!n)return!1;var r=v.Vim.findKey(t,n);return typeof r=="function"&&v.signal(t,"vim-keypress",n),r}function O(e){if(e.charAt(0)=="'")return e.charAt(1);var t=e.split("-");/-$/.test(e)&&t.splice(-2,2,"-");var 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 L?t[i]=L[s]:r=!0,s in A&&(t[i]=A[s])}return r?(X(n)&&(t[t.length-1]=n.toLowerCase()),"<"+t.join("-")+">"):!1}function M(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(St(e.getCursor(),0,1)),yt.enterInsertMode(e,{},t))}),t.onPasteFn}function H(e,t){var n=[];for(var r=e;r<e+t;r++)n.push(String.fromCharCode(r));return n}function R(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function U(e){return/^[a-z]$/.test(e)}function z(e){return"()[]{}".indexOf(e)!=-1}function W(e){return _.test(e)}function X(e){return/^[A-Z]$/.test(e)}function V(e){return/^\s*$/.test(e)}function $(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}function K(e,t,n,r,i){if(t===undefined&&!i)throw Error("defaultValue is required unless callback is provided");n||(n="string"),J[e]={type:n,defaultValue:t,callback:i};if(r)for(var s=0;s<r.length;s++)J[r[s]]=J[e];t&&Q(e,t)}function Q(e,t,n,r){var i=J[e];r=r||{};var s=r.scope;if(!i)throw Error("Unknown option: "+e);if(i.type=="boolean"){if(t&&t!==!0)throw 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 G(e,t,n){var r=J[e];n=n||{};var i=n.scope;if(!r)throw 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 et(){this.latestRegister=undefined,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=undefined,this.lastInsertModeChanges=Z()}function tt(e){return e.state.vim||(e.state.vim={inputState:new ot,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 rt(){nt={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:undefined,jumpList:Y(),macroModeState:new et,lastChararacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new lt({}),searchHistoryController:new ct({}),exCommandHistoryController:new ct({})};for(var e in J){var t=J[e];t.value
|