Commits

os0x  committed 19aedbe

vimモードでないときにテキストエリアでアクションができなかった問題を修正

  • Participants
  • Parent commits be5af70

Comments (0)

Files changed (1)

File chrome_keyconfig.js

 		if ('selectionStart' in target && target.disabled !== true) {
 			try {
 				var s = target.selectionStart;
-				if (!KeyConfig.useVim) {
-					return;
-				}
-				//actionset = KeyConfig.vimActionSet;
-				if (KeyConfig.vimActionSet === 'vim_normal_actions') {
-					evt.preventDefault();
-				}
-				if (this.handleKey(key, evt, target, KeyConfig.vimActionSet, true)) {
-					return;
+				if (KeyConfig.useVim) {
+					if (KeyConfig.vimActionSet === 'vim_normal_actions') {
+						evt.preventDefault();
+					}
+					if (this.handleKey(key, evt, target, KeyConfig.vimActionSet, true)) {
+						return;
+					}
 				}
 				if (!/^[CMA]-/.test(key)) {
 					return;
 		this.handleKey(key, evt, target, KeyConfig.actionSet, isTextedit);
 	},
 	handleKey: function(key, evt,target, actionset, isTextedit){
-		var fired = false, matched = false;
+		var matched = false;
 		if (/^\d+$/.test(key)) {
 			KeyConfig.timesBuf += key;
 		}
-		KeyConfig['_' + actionset].forEach(function(keyset, i ){
+		var fired = KeyConfig['_' + actionset].some(function(keyset, i ){
 			if (fired) {
 				keyset.input = '';
 			} else if (keyset.input) {
 				} else if (keyset.key.indexOf(keyset.input) === 0) {
 					Notify.append(' ' + key);
 					matched = true;
+					return true;
 				} else {
 					keyset.input = '';
 				}
 					var res = KeyConfig.fireAction(actionset, keyset.input, isTextedit, evt, target);
 					if (res !== false) evt.preventDefault();
 					keyset.input = '';
-					fired = true;
 					KeyConfig.times = 1;
+					return true;
 				}
 				matched = true;
 			}