mirror of
https://github.com/YunoHost-Apps/limesurvey_ynh.git
synced 2024-09-03 19:36:32 +02:00
1 line
8.1 KiB
JavaScript
1 line
8.1 KiB
JavaScript
|
ace.define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,n){var r=e("../lib/dom"),i=function(e,t){var n=this.scroller.getBoundingClientRect(),r=Math.floor((e+this.scrollLeft-n.left-this.$padding)/this.characterWidth),i=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(i,r)},s=e("./hash_handler").HashHandler;t.handler=new s;var o=!1,u,a;t.handler.attach=function(e){o||(o=!0,r.importCssString(" .emacs-mode .ace_cursor{ border: 2px rgba(50,250,50,0.8) solid!important; -moz-box-sizing: border-box!important; -webkit-box-sizing: border-box!important; box-sizing: border-box!important; background-color: rgba(0,250,0,0.9); opacity: 0.5; } .emacs-mode .ace_cursor.ace_hidden{ opacity: 1; background-color: transparent; } .emacs-mode .ace_overwrite-cursors .ace_cursor { opacity: 1; background-color: transparent; border-width: 0 0 2px 2px !important; } .emacs-mode .ace_text-layer { z-index: 4 } .emacs-mode .ace_cursor-layer { z-index: 2 }","emacsMode")),u=e.session.$selectLongWords,e.session.$selectLongWords=!0,a=e.session.$useEmacsStyleLineStart,e.session.$useEmacsStyleLineStart=!0,e.session.$emacsMark=null,t.markMode=function(){return e.session.$emacsMark},t.setMarkMode=function(t){e.session.$emacsMark=t},e.on("click",l),e.on("changeSession",f),e.renderer.screenToTextCoordinates=i,e.setStyle("emacs-mode"),e.commands.addCommands(d),t.handler.platform=e.commands.platform},t.handler.detach=function(e){delete e.renderer.screenToTextCoordinates,e.session.$selectLongWords=u,e.session.$useEmacsStyleLineStart=a,e.removeEventListener("click",l),e.removeEventListener("changeSession",f),e.unsetStyle("emacs-mode"),e.commands.removeCommands(d)};var f=function(e){e.oldSession&&(e.oldSession.$selectLongWords=u,e.oldSession.$useEmacsStyleLineStart=a),u=e.session.$selectLongWords,e.session.$selectLongWords=!0,a=e.session.$useEmacsStyleLineStart,e.session.$useEmacsStyleLineStart=!0,e.session.hasOwnProperty("$emacsMark")||(e.session.$emacsMark=null)},l=function(e){e.editor.session.$emacsMark=null},c=e("../lib/keys").KEY_MODS,h={C:"ctrl",S:"shift",M:"alt",CMD:"command"},p=["C-S-M-CMD","S-M-CMD","C-M-CMD","C-S-CMD","C-S-M","M-CMD","S-CMD","S-M","C-CMD","C-M","C-S","CMD","M","S","C"];p.forEach(function(e){var t=0;e.split("-").forEach(function(e){t|=c[h[e]]}),h[t]=e.toLowerCase()+"-"}),t.handler.bindKey=function(e,t){if(!e)return;var n=this.commmandKeyBinding;e.split("|").forEach(function(e){e=e.toLowerCase(),n[e]=t,e=e.split(" ")[0],n[e]||(n[e]="null")},this)},t.handler.handleKeyboard=function(e,n,r,i){if(n==-1){t.setMarkMode(null);if(e.count){var s=Array(e.count+1).join(r);return e.count=null,{command:"insertstring",args:s}}}if(r=="\0")return;var o=h[n];if(o=="c-"||e.universalArgument){var u=parseInt(r[r.length-1]);if(u)return e.count=u,{command:"null"}}e.universalArgument=!1,o&&(r=o+r),e.keyChain&&(r=e.keyChain+=" "+r);var a=this.commmandKeyBinding[r];e.keyChain=a=="null"?r:"";if(!a)return;if(a==="null")return{command:"null"};if(a==="universalArgument")return e.universalArgument=!0,{command:"null"};var f;typeof a!="string"&&(f=a.args,a.command&&(a=a.command),a==="goorselect"&&(a=t.markMode()?f[1]:f[0],f=null)),typeof a=="string"&&((a==="insertstring"||a==="splitline"||a==="togglecomment")&&t.setMarkMode(null),a=this.commands[a]||e.editor.commands.commands[a]),!a.readonly&&!a.isYank&&(e.lastCommand=null);if(e.count){var u=e.count;return e.count=0,{args:f,command:{exec:function(e,t){for(var n=0;n<u;n++)a.exec(e,t)}}}}return{command:a,args:f}},t.emacsKeys={"Up|C-p":{command:"goorselect",args:["golineup","selectup"]},"Down|C-n":{command:"goorselect",args:["golinedown","selectdown"]},"Left|C-b":{command:"goorselect",args:["gotoleft","s
|