This commit is contained in:
Fabian Jakobs 2011-08-18 17:29:50 +02:00
commit 4b7a0a6313
7 changed files with 43 additions and 79 deletions

View file

@ -2955,7 +2955,9 @@ exports.isMac = (os == "mac");
/** Is the user using a browser that identifies itself as Linux */
exports.isLinux = (os == "linux");
exports.isIE = ! + "\v1";
exports.isIE =
navigator.appName == "Microsoft Internet Explorer"
&& parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1])
/** Is this Firefox or related? */
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
@ -8228,7 +8230,7 @@ var TextInput = function(parentNode, host) {
}
});
if (useragent.isIE) {
if ("onbeforecopy" in text) {
event.addListener(text, "beforecopy", function(e) {
var copyText = host.getCopyText();
if(copyText)
@ -23956,6 +23958,22 @@ define('ace/keyboard/keybinding/vim', ['require', 'exports', 'module' , 'ace/key
var StateHandler = require("ace/keyboard/state_handler").StateHandler;
var matchCharacterOnly = require("ace/keyboard/state_handler").matchCharacterOnly;
var vimcommand = function(key, exec, then) {
return {
regex: [ "([0-9]*)", key ],
exec: exec,
params: [
{
name: "times",
match: 1,
type: "number",
defaultValue: 1
}
],
then: then
}
}
var vimStates = {
start: [
{
@ -23991,78 +24009,20 @@ var vimStates = {
exec: "overwrite",
then: "replaceMode"
},
{
regex: [ "([0-9]*)", "(k|up)" ],
exec: "golineup",
params: [
{
name: "times",
match: 1,
type: "number",
defaultValue: 1
}
]
},
{
regex: [ "([0-9]*)", "(j|down|enter)" ],
exec: "golinedown",
params: [
{
name: "times",
match: 1,
type: "number",
defaultValue: 1
}
]
},
{
regex: [ "([0-9]*)", "(l|right)" ],
exec: "gotoright",
params: [
{
name: "times",
match: 1,
type: "number",
defaultValue: 1
}
]
},
{
regex: [ "([0-9]*)", "(h|left)" ],
exec: "gotoleft",
params: [
{
name: "times",
match: 1,
type: "number",
defaultValue: 1
}
]
},
vimcommand("(k|up)", "golineup"),
vimcommand("(j|down)", "golinedown"),
vimcommand("(l|right)", "golineright"),
vimcommand("(h|left)", "golineleft"),
{
key: "shift-g",
exec: "gotoend"
},
{
key: "b",
exec: "gotowordleft"
},
{
key: "e",
exec: "gotowordright"
},
{
key: "x",
exec: "del"
},
{
key: "shift-x",
exec: "backspace"
},
{
key: "shift-d",
exec: "removetolineend"
},
vimcommand("b", "gotowordleft"),
vimcommand("e", "gotowordright"),
vimcommand("x", "del"),
vimcommand("shift-x", "backspace"),
vimcommand("shift-d", "removetolineend"),
vimcommand("u", "undo"), // [count] on this may/may not work, depending on browser implementation...
{
comment: "Catch some keyboard input to stop it here",
match: matchCharacterOnly

File diff suppressed because one or more lines are too long

View file

@ -3034,7 +3034,9 @@ exports.isMac = (os == "mac");
/** Is the user using a browser that identifies itself as Linux */
exports.isLinux = (os == "linux");
exports.isIE = ! + "\v1";
exports.isIE =
navigator.appName == "Microsoft Internet Explorer"
&& parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1])
/** Is this Firefox or related? */
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
@ -6976,7 +6978,7 @@ var TextInput = function(parentNode, host) {
}
});
if (useragent.isIE) {
if ("onbeforecopy" in text) {
event.addListener(text, "beforecopy", function(e) {
var copyText = host.getCopyText();
if(copyText)

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},{regex:["([0-9]*)","(k|up)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(j|down|enter)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(l|right)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(h|left)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{key:"shift-g",exec:"gotoend"},{key:"b",exec:"gotowordleft"},{key:"e",exec:"gotowordright"},{key:"x",exec:"del"},{key:"shift-x",exec:"backspace"},{key:"shift-d",exec:"removetolineend"},{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(f)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b==0||c!=""&&c!=String.fromCharCode(0)){var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
define("ace/keyboard/keybinding/vim",["require","exports","module","ace/keyboard/state_handler"],function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f=function(a,b,c){return{regex:["([0-9]*)",a],exec:b,params:[{name:"times",match:1,type:"number",defaultValue:1}],then:c}},g={start:[{key:"i",then:"insertMode"},{key:"d",then:"deleteMode"},{key:"a",exec:"gotoright",then:"insertMode"},{key:"shift-i",exec:"gotolinestart",then:"insertMode"},{key:"shift-a",exec:"gotolineend",then:"insertMode"},{key:"shift-c",exec:"removetolineend",then:"insertMode"},{key:"shift-r",exec:"overwrite",then:"replaceMode"},f("(k|up)","golineup"),f("(j|down)","golinedown"),f("(l|right)","golineright"),f("(h|left)","golineleft"),{key:"shift-g",exec:"gotoend"},f("b","gotowordleft"),f("e","gotowordright"),f("x","del"),f("shift-x","backspace"),f("shift-d","removetolineend"),f("u","undo"),{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}],replaceMode:[{key:"esc",exec:"overwrite",then:"start"}],deleteMode:[{key:"d",exec:"removeline",then:"start"}]};b.Vim=new d(g)}),define("ace/keyboard/state_handler",["require","exports","module"],function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b==0||c!=""&&c!=String.fromCharCode(0)){var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}return null}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})

View file

@ -3028,7 +3028,9 @@ exports.isMac = (os == "mac");
/** Is the user using a browser that identifies itself as Linux */
exports.isLinux = (os == "linux");
exports.isIE = ! + "\v1";
exports.isIE =
navigator.appName == "Microsoft Internet Explorer"
&& parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1])
/** Is this Firefox or related? */
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
@ -6970,7 +6972,7 @@ var TextInput = function(parentNode, host) {
}
});
if (useragent.isIE) {
if ("onbeforecopy" in text) {
event.addListener(text, "beforecopy", function(e) {
var copyText = host.getCopyText();
if(copyText)
@ -18083,7 +18085,7 @@ window.__ace_shadowed__.transformTextarea = function(element) {
overflow: "auto",
fontSize: "14px"
};
if (!UA.isIE) {
if (!UA.isIE || UA.isIE >= 9) {
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
} else {
settingDivStyles.backgroundColor = "#333";

File diff suppressed because one or more lines are too long