1 parent
e2e90f8618
commit
17718732cc
525 files changed
+3631
-381
No files matched your search
@@ -0,0 +1 @@
|
||||
ace.define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/incremental_search","ace/commands/incremental_search_commands","ace/keyboard/hash_handler","ace/lib/keys"],function(e,n,t){var a=e("../lib/dom");e("../incremental_search");var o=e("../commands/incremental_search_commands"),r=function(e,n){var t=this.scroller.getBoundingClientRect(),a=Math.floor((e+this.scrollLeft-t.left-this.$padding)/this.characterWidth),o=Math.floor((n+this.scrollTop-t.top)/this.lineHeight);return this.session.screenToDocumentPosition(o,a)},i=e("./hash_handler").HashHandler;n.handler=new i,n.handler.isEmacs=!0,n.handler.$id="ace/keyboard/emacs";var s=!1,c,l;n.handler.attach=function(e){s||(s=!0,a.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_hidden-cursors .ace_cursor{ 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")),c=e.session.$selectLongWords,e.session.$selectLongWords=!0,l=e.session.$useEmacsStyleLineStart,e.session.$useEmacsStyleLineStart=!0,e.session.$emacsMark=null,e.session.$emacsMarkRing=e.session.$emacsMarkRing||[],e.emacsMark=function(){return this.session.$emacsMark},e.setEmacsMark=function(e){this.session.$emacsMark=e},e.pushEmacsMark=function(e,n){var t=this.session.$emacsMark;t&&this.session.$emacsMarkRing.push(t),!e||n?this.setEmacsMark(e):this.session.$emacsMarkRing.push(e)},e.popEmacsMark=function(){var e=this.emacsMark();return e?(this.setEmacsMark(null),e):this.session.$emacsMarkRing.pop()},e.getLastEmacsMark=function(e){return this.session.$emacsMark||this.session.$emacsMarkRing.slice(-1)[0]},e.on("click",m),e.on("changeSession",d),e.renderer.screenToTextCoordinates=r,e.setStyle("emacs-mode"),e.commands.addCommands(f),n.handler.platform=e.commands.platform,e.$emacsModeHandler=this,e.addEventListener("copy",this.onCopy),e.addEventListener("paste",this.onPaste)},n.handler.detach=function(e){delete e.renderer.screenToTextCoordinates,e.session.$selectLongWords=c,e.session.$useEmacsStyleLineStart=l,e.removeEventListener("click",m),e.removeEventListener("changeSession",d),e.unsetStyle("emacs-mode"),e.commands.removeCommands(f),e.removeEventListener("copy",this.onCopy),e.removeEventListener("paste",this.onPaste)};var d=function(e){e.oldSession&&(e.oldSession.$selectLongWords=c,e.oldSession.$useEmacsStyleLineStart=l),c=e.session.$selectLongWords,e.session.$selectLongWords=!0,l=e.session.$useEmacsStyleLineStart,e.session.$useEmacsStyleLineStart=!0,e.session.hasOwnProperty("$emacsMark")||(e.session.$emacsMark=null),e.session.hasOwnProperty("$emacsMarkRing")||(e.session.$emacsMarkRing=[])},m=function(e){e.editor.session.$emacsMark=null},h=e("../lib/keys").KEY_MODS,u={C:"ctrl",S:"shift",M:"alt",CMD:"command"},g=["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"];g.forEach(function(e){var n=0;e.split("-").forEach(function(e){n|=h[u[e]]}),u[n]=e.toLowerCase()+"-"}),n.handler.onCopy=function(e,t){t.$handlesEmacsOnCopy||(t.$handlesEmacsOnCopy=!0,n.handler.commands.killRingSave.exec(t),delete t.$handlesEmacsOnCopy)},n.handler.onPaste=function(e,n){n.pushEmacsMark(n.getCursorPosition())},n.handler.bindKey=function(e,n){if(e){var t=this.commandKeyBinding;e.split("|").forEach(function(e){e=e.toLowerCase(),t[e]=n;var a=e.split(" ").slice(0,-1);a.reduce(function(e,n,t){var a=e[t-1]?e[t-1]+" ":"";return e.concat([a+n])},[]).forEach(function(e){t[e]||(t[e]="null")})},this)}},n.handler.handleKeyboard=function(e,n,t,a){if(-1===a)return void 0;var o=e.editor;if(-1==n&&(o.pushEmacsMark(),e.count)){var r=new Array(e.count+1).join(t);return e.count=null,{command:"insertstring",args:r}}if("\x00"==t)return void 0;var i=u[n];if("c-"==i||e.universalArgument){var s=String(e.count||0),c=parseInt(t[t.length-1]);if("number"==typeof c&&!isNaN(c))return e.count=parseInt(s+c),{command:"null"};e.universalArgument&&(e.count=4)}e.universalArgument=!1,i&&(t=i+t),e.keyChain&&(t=e.keyChain+=" "+t);var l=this.commandKeyBinding[t];if(e.keyChain="null"==l?t:"",!l)return void 0;if("null"===l)return{command:"null"};if("universalArgument"===l)return e.universalArgument=!0,{command:"null"};var d;if("string"!=typeof l&&(d=l.args,l.command&&(l=l.command),"goorselect"===l&&(l=o.emacsMark()?d[1]:d[0],d=null)),"string"==typeof l&&(("iLine truncated
|
||||
Reference in new issue
Block a user