Changeset 8692
- Timestamp:
- 04/03/08 03:23:36 (5 years ago)
- Location:
- platform/firefox/textareavieditor
- Files:
-
- 19 modified
- 1 moved
-
build.xml (modified) (3 diffs, 1 prop)
-
chrome.default.manifest (modified) (1 diff, 1 prop)
-
chrome.manifest (modified) (1 diff, 1 prop)
-
chrome.test.manifest (modified) (1 diff, 1 prop)
-
content/overlay-fx.xul (moved) (moved from platform/firefox/textareavieditor/content/overlay-ff.xul) (1 prop)
-
content/textareavieditor.html (modified) (1 prop)
-
content/textareavieditor.xul (modified) (1 diff, 1 prop)
-
content/vi_caret.js (modified) (4 diffs, 1 prop)
-
content/vi_commandline.js (modified) (5 diffs, 1 prop)
-
content/vi_commands.js (modified) (12 diffs, 1 prop)
-
content/vi_editor.js (modified) (8 diffs, 1 prop)
-
content/vi_events.js (modified) (4 diffs, 1 prop)
-
content/vi_io.js (modified) (2 diffs, 1 prop)
-
content/vi_mappings.js (modified) (18 diffs, 1 prop)
-
content/vi_options.js (modified) (10 diffs, 1 prop)
-
content/vi_utils.js (modified) (2 diffs, 1 prop)
-
defaults/preferences/textareavieditor.js (modified) (1 diff, 1 prop)
-
install.rdf (modified) (2 diffs, 1 prop)
-
locale/en-US/textareavieditor.dtd (modified) (1 prop)
-
skin/textareavieditor.css (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
platform/firefox/textareavieditor/build.xml
- Property svn:executable deleted
r8686 r8692 7 7 <property name="app.name" value="textareavieditor" /> 8 8 <property name="app.id" value="${app.name}@teramako.ddo.jp" /> <!-- extension id like: xxx@xxx.com --> 9 <property name="f f.dir" value="C:\Documents and Settings\teramako\Application Data\Mozilla\Firefox\Profiles\kq1voi12.develop" />9 <property name="fx.dir" value="C:\Documents and Settings\teramako\Application Data\Mozilla\Firefox\Profiles\kq1voi12.develop" /> 10 10 11 <condition property="f f.present">11 <condition property="fx.present"> 12 12 <and> 13 <isset property="f f.dir" />14 <available file="${f f.dir}" type="dir" />13 <isset property="fx.dir" /> 14 <available file="${fx.dir}" type="dir" /> 15 15 </and> 16 16 </condition> … … 29 29 </target> 30 30 31 <target name="test.chrome" depends="chrome" if="f f.present">31 <target name="test.chrome" depends="chrome" if="fx.present"> 32 32 <!-- copy to chrome directory --> 33 <copy file="${dist.dir}/${app.name}.jar" todir="${f f.dir}/chrome/chrome" overwrite="true" />34 <copy file="${src.dir}/chrome.manifest" tofile="${f f.dir}/chrome/${app.name}.manifest" overwrite="true" />33 <copy file="${dist.dir}/${app.name}.jar" todir="${fx.dir}/chrome/chrome" overwrite="true" /> 34 <copy file="${src.dir}/chrome.manifest" tofile="${fx.dir}/chrome/${app.name}.manifest" overwrite="true" /> 35 35 </target> 36 36 37 37 <!-- copy to extensions directory --> 38 38 <!-- 39 <target name="test.ext" depends="chrome" if="f f.present">40 <copy file="${dist.dir}/${app.name}.jar" todir="${f f.dir}/extensions/${app.id}/chrome" overwrite="true" />41 <copy file="${src.dir}/chrome.manifest" todir="${f f.dir}/extensions/${app.id}" overwrite="true" />39 <target name="test.ext" depends="chrome" if="fx.present"> 40 <copy file="${dist.dir}/${app.name}.jar" todir="${fx.dir}/extensions/${app.id}/chrome" overwrite="true" /> 41 <copy file="${src.dir}/chrome.manifest" todir="${fx.dir}/extensions/${app.id}" overwrite="true" /> 42 42 </target> 43 43 --> … … 60 60 </target> 61 61 62 <target name="clean.f f" if="ff.present">63 <delete dir="${f f.dir}/extensions/${app.id}" failonerror="false" />64 <delete file="${f f.dir}/chrome/${app.name}.manifest" failonerror="false" />65 <delete file="${f f.dir}/chrome/chrome/${app.name}.jar" failonerror="false" />62 <target name="clean.fx" if="fx.present"> 63 <delete dir="${fx.dir}/extensions/${app.id}" failonerror="false" /> 64 <delete file="${fx.dir}/chrome/${app.name}.manifest" failonerror="false" /> 65 <delete file="${fx.dir}/chrome/chrome/${app.name}.jar" failonerror="false" /> 66 66 </target> 67 67 -
platform/firefox/textareavieditor/chrome.default.manifest
- Property svn:executable deleted
r8686 r8692 1 1 content textareavieditor jar:chrome/textareavieditor.jar!/content/ 2 overlay chrome://browser/content/browser.xul chrome://textareavieditor/content/overlay-f f.xul2 overlay chrome://browser/content/browser.xul chrome://textareavieditor/content/overlay-fx.xul 3 3 locale textareavieditor en-US jar:chrome/textareavieditor.jar!/locale/en-US/ 4 4 skin textareavieditor classic/1.0 jar:chrome/textareavieditor.jar!/skin/ -
platform/firefox/textareavieditor/chrome.manifest
- Property svn:executable deleted
r8686 r8692 1 1 content textareavieditor jar:chrome/textareavieditor.jar!/content/ 2 overlay chrome://browser/content/browser.xul chrome://textareavieditor/content/overlay-f f.xul2 overlay chrome://browser/content/browser.xul chrome://textareavieditor/content/overlay-fx.xul 3 3 locale textareavieditor en-US jar:chrome/textareavieditor.jar!/locale/en-US/ 4 4 skin textareavieditor classic/1.0 jar:chrome/textareavieditor.jar!/skin/ -
platform/firefox/textareavieditor/chrome.test.manifest
- Property svn:executable deleted
r8686 r8692 1 1 content textareavieditor content/ 2 overlay chrome://browser/content/browser.xul chrome://textareavieditor/content/overlay-f f.xul2 overlay chrome://browser/content/browser.xul chrome://textareavieditor/content/overlay-fx.xul 3 3 locale textareavieditor en-US locale/en-US/ 4 4 skin textareavieditor classic/1.0 skin/ -
platform/firefox/textareavieditor/content/overlay-fx.xul
- Property svn:executable deleted
-
platform/firefox/textareavieditor/content/textareavieditor.html
- Property svn:executable deleted
-
platform/firefox/textareavieditor/content/textareavieditor.xul
- Property svn:executable deleted
r8686 r8692 12 12 <html:h1>Sandbox</html:h1> 13 13 <html:p>Input: <html:input style="width:500px;"/></html:p> 14 <html:p>Textarea:<html:br/><html:textarea cols="80" rows="20" ></html:textarea></html:p>14 <html:p>Textarea:<html:br/><html:textarea cols="80" rows="20"/></html:p> 15 15 </window> -
platform/firefox/textareavieditor/content/vi_caret.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 89 89 }, 90 90 /** 91 * Return postition of [offset, lineNum] co rdinate91 * Return postition of [offset, lineNum] coordinate 92 92 * @method 93 93 * @param {Number} lineNum … … 95 95 * @return {Number} 96 96 */ 97 getPositionFromCo rdinate: function(lineNum, offset){97 getPositionFromCoordinate: function(lineNum, offset){ 98 98 var t = viEditor.input.target; 99 99 var lines = t.value.split('\n'); … … 246 246 [line1, line2] = [line2, line1]; 247 247 } 248 var start = this.getPositionFromCo rdinate(line1,0);249 var end = this.getPositionFromCo rdinate(line2, Number.POSITIVE_INFINITY);248 var start = this.getPositionFromCoordinate(line1,0); 249 var end = this.getPositionFromCoordinate(line2, Number.POSITIVE_INFINITY); 250 250 if ( t.textLength > end){ 251 end++ 251 end++; 252 252 } 253 253 t.selectionStart = start; -
platform/firefox/textareavieditor/content/vi_commandline.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 67 67 var completions = []; 68 68 var completionIndex = 0; 69 var commandReg = /^((?: (?:[+-]?[\d]+|'<|\.)(?:,(?:[+-]?[\d]+|'>|\.))?)|[%$])?([\S]+)?(?:([\s]+)(.+))?$/;69 var commandReg = /^((?:[+-]?\d+|'<|\.)(?:,(?:[+-]?\d+|'>|\.))?|[%$])?(\S+)?(?:(\s+)(.+))?$/; 70 70 function completer(forward){ 71 71 if(completions.length == 0){ … … 102 102 } 103 103 if (completions.length > 1){ 104 completionIndex = forward ? completionIndex + 1 : completionIndex-1;104 completionIndex += forward ? 1 : -1; 105 105 if (completions.length <= completionIndex){ 106 106 completionIndex = 0; … … 126 126 deckElm.selectedIndex = 0; 127 127 },false); 128 defaultColor = document.defaultView.getComputedStyle(modeElm,null).getPropertyValue('color') 128 defaultColor = document.defaultView.getComputedStyle(modeElm,null).getPropertyValue('color'); 129 129 }, 130 130 /** … … 256 256 //viEditor.log("commandLine.execute: `" + cmds[0].names[0] + "` args:" + cmds[1]); 257 257 result = cmds[0].execute.apply(cmds[0], cmds[1]); 258 } 258 } 259 259 } catch (e) { 260 260 this.error(e.name + ': ' + e.message); -
platform/firefox/textareavieditor/content/vi_commands.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 50 50 viEditor.Command = function(specs, action, extraInfo){ 51 51 if (!specs || !action) return null; 52 52 53 53 function parseSpaces(specs){ 54 54 var shortNames = []; … … 69 69 return { names: names, longNames: longNames, shortNames: shortNames }; 70 70 } 71 71 72 72 this.spacs = specs; 73 73 var expandSpecs = parseSpaces(specs); 74 74 this.shortNames = expandSpecs.shortNames; 75 75 this.longNames = expandSpecs.longNames; 76 76 77 77 this.name = this.longNames[0]; 78 78 this.names = expandSpecs.names; … … 82 82 */ 83 83 this.action = action; 84 84 85 85 if (extraInfo){ 86 86 this.flags = extraInfo.flags || 0; … … 150 150 var exCommands = []; 151 151 var lastRunCommand = ""; 152 // For command parse 1 23153 var reg = /^((?: (?:[+-]?[\d]+|'<|\.)(?:,(?:[+-]?[\d]+|'>|\.))?)|[%$])?([\S]+)?(?:[\s]+(.+))?$/;154 152 // For command parse 1 2 3 153 var reg = /^((?:[+-]?\d+|'<|\.)(?:,(?:[+-]?\d+|'>|\.))?|[%$])?(\S+)?(?:\s+(.+))?$/; 154 155 155 /** 156 156 * Return Iterator of <var>exCommands</var> … … 171 171 //viEditor.log('parseRange: `' + str + "'"); 172 172 var t = viEditor.input.target; 173 var reg = /^([+-])?( [\d]+)$/;173 var reg = /^([+-])?(\d+)$/; 174 174 var start, end; 175 175 if (!str || str == '.'){ … … 183 183 return [0, t.value.length]; 184 184 } 185 185 186 186 function getPositionFromString(str){ 187 187 //viEditor.log('command#getPositionFromString: str:`' + str + "'"); … … 200 200 } 201 201 } 202 202 203 203 var strList = str.split(','); 204 204 var p = []; 205 for (var i=0; i<strList.length; i++){206 if (reg.test(str List[i])){207 p = p.concat(getPositionFromNumber(str List[i]));205 strList.forEach(function(strItem){ 206 if (reg.test(strItem)){ 207 p = p.concat(getPositionFromNumber(strItem)); 208 208 } else { 209 var r = getPositionFromString(str List[i]);209 var r = getPositionFromString(strItem); 210 210 if (r == null){ 211 throw new SyntaxError('Invalid range: `' + str List[i]+ "'");211 throw new SyntaxError('Invalid range: `' + strItem + "'"); 212 212 } 213 213 p = p.concat(r); 214 214 } 215 } 215 }); 216 216 start = Math.min.apply(this,p); 217 217 end = Math.max.apply(this,p); … … 289 289 if (prefix == ':') { 290 290 var arg = ''; 291 var range = [] 291 var range = []; 292 292 var list = str.match(reg); 293 293 if (!list) return null; … … 443 443 viEditor.input.target = null; 444 444 },{ 445 shortHelp: 'Quit the te starea/input',446 help: 'Blur the textarea or input element. And fo rcus to the browser.'445 shortHelp: 'Quit the textarea/input', 446 help: 'Blur the textarea or input element. And focus to the browser.' 447 447 } 448 448 )); 449 449 viEditor.commands.add(new viEditor.Command(['gotoline'], 450 450 function(arg){ 451 var matches = arg.replace(/ [\s]+/g,'').match(/^(?:([+-])?(\d+)|([%$]))$/);451 var matches = arg.replace(/\s+/g,'').match(/^(?:([+-])?(\d+)|([%$]))$/); 452 452 var num; 453 453 if (!matches){ … … 471 471 break; 472 472 } 473 viEditor.caret.to(viEditor.caret.getPositionFromCo rdinate(num,0));473 viEditor.caret.to(viEditor.caret.getPositionFromCoordinate(num,0)); 474 474 viEditor.caret.toBeginOfLine(true); 475 475 },{ 476 shortHelp: 'Quit the te starea/input',477 help: 'Blur the textarea or input element. And fo rcus to the browser.',476 shortHelp: 'Quit the textarea/input', 477 help: 'Blur the textarea or input element. And focus to the browser.', 478 478 flags: viEditor.commandFlags.ARGUMENT 479 479 } … … 491 491 viEditor.commands.add(new viEditor.Command(['set'], 492 492 function(arg){ 493 var [,name,value] = arg.match(/^\s*([\w \-]+)(?:\s*=\s*(.+))?/);493 var [,name,value] = arg.match(/^\s*([\w-]+)(?:\s*=\s*(.+))?/); 494 494 var option = viEditor.options.get(name); 495 495 if (!option) throw new SyntaxError('No such option'); -
platform/firefox/textareavieditor/content/vi_editor.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 54 54 * pending motion map object 55 55 * @type {Map,Object} 56 */ 56 */ 57 57 pendingMotionMap: null, 58 58 /** … … 96 96 */ 97 97 viEditor.setMode = function(mode){ 98 if (!this.input.target) 98 if (!this.input.target) 99 99 return false; 100 100 switch (mode) { … … 130 130 */ 131 131 viEditor.doCommand = function(cmd, count){ 132 if (!this.input.target || !this.input.target.controllers) 132 if (!this.input.target || !this.input.target.controllers) 133 133 return false; 134 if (isNaN(count)) 134 if (isNaN(count)) 135 135 count = 1; 136 136 var controller = this.input.target.controllers.getControllerForCommand(cmd); … … 154 154 var console_service = Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService); 155 155 return function(msg, level){ 156 console_service.logStringMessage('viEditor: ' + msg) 156 console_service.logStringMessage('viEditor: ' + msg); 157 157 }; 158 158 })(); … … 168 168 if (tagname == 'textarea') { 169 169 viEditor.events.onKeyPress(e, target, true); 170 } else if (tagname == 'input' && ( target.getAttribute('type') == 'text' || !target.hasAttribute('type'))) {170 } else if (tagname == 'input' && (!target.hasAttribute('type') || target.getAttribute('type') == 'text')) { 171 171 viEditor.events.onKeyPress(e, target, false); 172 172 } … … 181 181 viEditor.input.target = target; 182 182 viEditor.commandLine.appear(); 183 return 183 return; 184 184 } 185 185 },true); … … 191 191 //var etarget = e.originalTarget; 192 192 var tagname = etarget.localName.toLowerCase(); 193 194 if (tagname != 'textarea' && !(tagname == 'input' && ( etarget.type == 'text' || !etarget.type))) {193 194 if (tagname != 'textarea' && !(tagname == 'input' && (!etarget.type || etarget.type == 'text'))) { 195 195 viEditor.commandLine.hide(); 196 return 196 return; 197 197 } 198 198 },true); -
platform/firefox/textareavieditor/content/vi_events.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 35 35 */ 36 36 viEditor.events = (function(){ 37 var keyTable= [37 const KEYTABLE = [ 38 38 [ KeyEvent.DOM_VK_ESCAPE, ["Esc", "Escape"] ], 39 39 [ KeyEvent.DOM_VK_LEFT_SHIFT, ["<"] ], … … 197 197 if (e.altKey){modifier += 'A-';} 198 198 if (e.metaKey){modifier += 'M-';} 199 199 200 200 if(e.charCode == 0){ 201 201 if(e.shiftKey){modifier += 'S-';} 202 for (var i in keyTable){203 if(k eyTable[i][0] == e.keyCode){204 key = k eyTable[i][1][0];202 for each(var k in KEYTABLE){ 203 if(k[0] == e.keyCode){ 204 key = k[1][0]; 205 205 break; 206 206 } 207 207 } 208 } else if (e.charCode == 32){208 } else if (e.charCode == KeyEvent.DOM_VK_SPACE){ 209 209 if(e.shiftKey){modifier += 'S-';} 210 210 key = 'Space'; … … 216 216 } 217 217 return '<' + modifier + key + '>'; 218 }218 } 219 219 } 220 220 })(); -
platform/firefox/textareavieditor/content/vi_io.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 49 49 path = path.replace('/','\\','g'); 50 50 } 51 if (/^~ /.test(path)){51 if (/^~(?=\W|$)/.test(path)){ 52 52 var home = envService.get('HOME'); 53 53 if (WINDOWS && !home){ -
platform/firefox/textareavieditor/content/vi_mappings.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 35 35 */ 36 36 viEditor.mapFlags = { 37 /** MOTION 1 */ 37 /** MOTION 1 */ 38 38 MOTION: 1 << 0, 39 39 /** COUNT 2 */ … … 60 60 */ 61 61 viEditor.Map = function(mode, cmds, action, extraInfo){ 62 if (!mode || (!cmds || !cmds.length) || !action)62 if (!mode || !cmds || !cmds.length || !action) 63 63 return null; 64 64 /** map mode */ … … 76 76 this.help = extraInfo.help || null; 77 77 } 78 } 78 }; 79 79 /** 80 80 * @method … … 85 85 */ 86 86 viEditor.Map.prototype.hasName = function(name){ 87 for (var i=0; i<this.names.length; i++){ 88 if(this.names[i] == name){ 89 return true; 90 } 91 } 92 return false; 87 return this.names.some(function(n){ 88 return n == name; 89 }); 93 90 }; 94 91 /** … … 108 105 if(this.flags & viEditor.mapFlags.MOTION){ 109 106 args.push(motion); 110 args.push(argument) 107 args.push(argument); 111 108 args.push(motionCount >= 1 ? motionCount : 0); 112 109 } … … 124 121 * main map list 125 122 * @type {Array} 126 */ 123 */ 127 124 var mainMaps = []; 128 125 /** … … 155 152 function getMap(mode, cmd, stack){ 156 153 var maps = stack[mode]; 157 if (!maps) { return null; }154 if (!maps) { return null; } 158 155 var names; 159 156 for (var i=0; i<maps.length; i++){ 160 157 names = maps[i].names; 161 for ( varj=0; j<names.length; j++){158 for (let j=0; j<names.length; j++){ 162 159 if(names[j] == cmd){ 163 160 return maps[i]; … … 177 174 for (var i=0; i<maps.length; i++){ 178 175 names = maps[i].names; 179 for ( varj=0; j<names.length; j++){176 for (let j=0; j<names.length; j++){ 180 177 if(names[j] == cmd){ 181 178 names.splice(j,1); … … 301 298 function(c){ 302 299 if (c > 0){ 303 viEditor.caret.to(viEditor.caret.getPositionFromCo rdinate(c,0));300 viEditor.caret.to(viEditor.caret.getPositionFromCoordinate(c,0)); 304 301 } else { 305 302 viEditor.caret.to(viEditor.input.target.textLength); … … 308 305 },{ 309 306 flags: viEditor.mapFlags.COUNT, 310 shortHelp: 'Goto line <var>{count}</var> of the non-b rank character',307 shortHelp: 'Goto line <var>{count}</var> of the non-blank character', 311 308 help: 'If not <var>{count}</var>, goto the last line' 312 309 } … … 315 312 function(c){ 316 313 if (c > 0){ 317 viEditor.caret.to(viEditor.caret.getPositionFromCo rdinate(c,0));314 viEditor.caret.to(viEditor.caret.getPositionFromCoordinate(c,0)); 318 315 viEditor.caret.toEndOfLine(); 319 316 } else { … … 322 319 },{ 323 320 flags: viEditor.mapFlags.COUNT, 324 shortHelp: 'Goto line <var>{count}</var> of the last charact or',321 shortHelp: 'Goto line <var>{count}</var> of the last character', 325 322 help: 'If not <var>{count}</var>, goto the last line' 326 323 } … … 543 540 var map = viEditor.mappings.getMainMap(viEditor.modes.NORMAL,'d'); 544 541 if ( map.execute(c,(m == 'c' ? 'd' : m),arg,mc) ){ 545 if (/^[ jkc]$/.test(m)){542 if (/^[cjk]$/.test(m)){ 546 543 viEditor.mappings.getMainMap(viEditor.modes.NORMAL,'O').execute(null,null,null,null); 547 544 } else { … … 954 951 function(){ 955 952 viEditor.setMode(viEditor.modes.NORMAL); 956 viEditor.commandLine.focus('/') 953 viEditor.commandLine.focus('/'); 957 954 } 958 955 )); … … 1045 1042 */ 1046 1043 getUserIterator: function(mode){ 1047 return mappingsIterator(mode, userMaps) 1044 return mappingsIterator(mode, userMaps); 1048 1045 }, 1049 1046 /** 1050 * Return true if cmd matches one of userMaps names 1047 * Return true if cmd matches one of userMaps names 1051 1048 * @alias viEditor.mappings.hasMap 1052 1049 * @method … … 1056 1053 */ 1057 1054 hasMap: function(mode, cmd){ 1058 var maps = userMaps[mode]; 1059 for (var i=0; i<maps.length; i++){ 1060 if(maps[i].names.indexOf(cmd) != -1){ 1061 return true; 1062 } 1063 } 1064 return false; 1055 return userMaps[mode].some(function(map){ 1056 return map.names.indexOf(cmd) > -1; 1057 }); 1065 1058 }, 1066 1059 /** … … 1139 1132 /** @type {viEditor.Map} */ 1140 1133 var map = mappings[i]; 1141 for ( varj=0; j<map.names.length; j++){1134 for (let j=0; j<map.names.length; j++){ 1142 1135 if(map.names[j].indexOf(cmd) == 0){ 1143 1136 matches.push(map); -
platform/firefox/textareavieditor/content/vi_options.js
- Property svn:executable deleted
r8686 r8692 4 4 /* ***** BEGIN LICENSE BLOCK ***** 5 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 6 * 6 * 7 7 * The contents of this file are subject to the Mozilla Public License Version 8 8 * 1.1 (the "License"); you may not use this file except in compliance with 9 9 * the License. You may obtain a copy of the License at 10 10 * http://www.mozilla.org/MPL/ 11 * 11 * 12 12 * Software distributed under the License is distributed on an "AS IS" basis, 13 13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 14 * for the specific language governing rights and limitations under the License. 15 * 15 * 16 16 * (c) 2007-2008: teramako <teramako@gmail.com> 17 * 17 * 18 18 * Alternatively, the contents of this file may be used under the terms of 19 19 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 53 53 } 54 54 var value = null; 55 55 56 56 this.name = names[0]; 57 57 this.names = names; … … 59 59 this.type = type; 60 60 this.storable = false; 61 61 62 62 if (extraInfo){ 63 63 if (extraInfo.usage){ … … 75 75 } 76 76 value = this.defaultValue; 77 77 78 78 if (extraInfo.setter){ 79 79 this.setter = extraInfo.setter; … … 84 84 this.completer = extraInfo.completer || null; 85 85 this.validator = extraInfo.validator || null; 86 86 87 87 if (this.type == 'boolean'){ 88 88 this.names = []; … … 219 219 'If not, value is computed as absoluted px size', 220 220 setter: function(width){ 221 var list = width.match(/^([+-])?( [\d]+)$/);221 var list = width.match(/^([+-])?(\d+)$/); 222 222 if (!list || !viEditor.input.target) return; 223 223 var w = parseInt(width,10); … … 225 225 if (list[1]){ 226 226 var s = t.ownerDocument.defaultView.getComputedStyle(t, null); 227 var fontSize = parseInt(s.getPropertyValue('font-size').replace( 'px',''), 10);227 var fontSize = parseInt(s.getPropertyValue('font-size').replace(/\D+/g,''), 10); 228 228 w = t.scrollWidth + (w * fontSize); 229 229 } … … 237 237 })(); 238 238 viEditor.options.add(new viEditor.Option(['height'], 'number', { 239 shortHelp: 'Set tex area height(px)',239 shortHelp: 'Set textarea height(px)', 240 240 help: 'If argument is begnning of "+" or "-", it\'s computed as relative value which is timed font-size.<br/>' + 241 241 'If not, value is computed as absoluted ps size.', 242 242 setter: function(height){ 243 var list = height.match(/^([+-])?( [\d]+)$/);243 var list = height.match(/^([+-])?(\d+)$/); 244 244 if (!list | !viEditor.input.target) return; 245 245 var h = parseInt(height,10); … … 248 248 var s = t.ownerDocument.defaultView.getComputedStyle(t, null); 249 249 var lineHeight = s.getPropertyValue('line-height'); 250 var fontSize = parseInt(s.getPropertyValue('font-size').repralce( 'px',''),10);250 var fontSize = parseInt(s.getPropertyValue('font-size').repralce(/\D+/g,''),10); 251 251 var currentLineHeight; 252 252 if (lineHeight == 'normal'){ 253 253 currentLineHeight = 1.25 * fontSize; 254 254 } else { 255 currentLineHeight = parseInt(lineHeight.replace( 'px',''),10);255 currentLineHeight = parseInt(lineHeight.replace(/\D+/g,''),10); 256 256 } 257 257 h = t.scrollHeight + (h * currentLineHeight); … … 308 308 storable: true 309 309 })); 310 310 -
platform/firefox/textareavieditor/content/vi_utils.js
- Property svn:executable deleted
r8686 r8692 5 5 /* ***** BEGIN LICENSE BLOCK ***** 6 6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 7 * 7 * 8 8 * The contents of this file are subject to the Mozilla Public License Version 9 9 * 1.1 (the "License"); you may not use this file except in compliance with 10 10 * the License. You may obtain a copy of the License at 11 11 * http://www.mozilla.org/MPL/ 12 * 12 * 13 13 * Software distributed under the License is distributed on an "AS IS" basis, 14 14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 15 15 * for the specific language governing rights and limitations under the License. 16 * 16 * 17 17 * (c) 2007-2008: teramako <teramako@gmail.com> 18 * 18 * 19 19 * Alternatively, the contents of this file may be used under the terms of 20 20 * either the GNU General Public License Version 2 or later (the "GPL"), or … … 73 73 var startLineNum = t.value.substring(0, start).split('\n').length; 74 74 var lineNum = t.value.substring(start,end).split('\n').length; 75 var reg = new RegExp('^( \t|[ ]{1,' + (count*viEditor.options.shiftwidth) +'})','g');75 var reg = new RegExp('^(?:\\t| {1,' + (count*viEditor.options.shiftwidth) +'})','g'); 76 76 for (var i=startLineNum-1; i<startLineNum+lineNum-1; i++){ 77 77 lines[i] = lines[i].replace(reg,''); -
platform/firefox/textareavieditor/defaults/preferences/textareavieditor.js
- Property svn:executable deleted
r8686 r8692 3 3 pref('extensions.vieditor.vfg', '-moz-fieldtext'); 4 4 pref('extensions.vieditor.vlfg', '-moz-fieldtext'); 5 p erf('extensions.vieditor.ibg', '-moz-field');6 p erf('extensions.vieditor.nbg', '-moz-field');7 p erf('extensions.vieditor.vbg', '-moz-field');8 p erf('extensions.vieditor.vlbg', '-moz-field');5 pref('extensions.vieditor.ibg', '-moz-field'); 6 pref('extensions.vieditor.nbg', '-moz-field'); 7 pref('extensions.vieditor.vbg', '-moz-field'); 8 pref('extensions.vieditor.vlbg', '-moz-field'); 9 9 pref('extensions.vieditor.shiftwidth', 4); 10 10 -
platform/firefox/textareavieditor/install.rdf
- Property svn:executable deleted
r8686 r8692 9 9 <em:id>textareavieditor@teramako.ddo.jp</em:id> 10 10 <em:type>2</em:type> 11 11 12 12 <em:targetApplication> 13 13 <!-- Firefox --> … … 27 27 <em:localized> 28 28 <Description> 29 <em:locale>ja -JP</em:locale>29 <em:locale>ja</em:locale> 30 30 <em:name>Textarea viEditor</em:name> 31 31 <em:description>vim のような操作で textarea を編集</em:description> -
platform/firefox/textareavieditor/locale/en-US/textareavieditor.dtd
- Property svn:executable deleted
-
platform/firefox/textareavieditor/skin/textareavieditor.css
- Property svn:executable deleted
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)