MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / doInsertModeKeysFn

Function doInsertModeKeysFn

lib/web/CodeMirror/test/vim_test.js:157–181  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

155 }
156 }
157 function doInsertModeKeysFn(cm) {
158 return function(args) {
159 if (args instanceof Array) { arguments = args; }
160 function executeHandler(handler) {
161 if (typeof handler == 'string') {
162 CodeMirror.commands[handler](cm);
163 } else {
164 handler(cm);
165 }
166 return true;
167 }
168 for (var i = 0; i < arguments.length; i++) {
169 var key = arguments[i];
170 // Find key in keymap and handle.
171 var handled = CodeMirror.lookupKey(key, cm.getOption('keyMap'), executeHandler, cm);
172 // Record for insert mode.
173 if (handled == "handled" && cm.state.vim.insertMode && arguments[i] != 'Esc') {
174 var lastChange = CodeMirror.Vim.getVimGlobalState_().macroModeState.lastInsertModeChanges;
175 if (lastChange && (key.indexOf('Delete') != -1 || key.indexOf('Backspace') != -1)) {
176 lastChange.changes.push(new CodeMirror.Vim.InsertModeKey(key));
177 }
178 }
179 }
180 }
181 }
182 function doExFn(cm) {
183 return function(command) {
184 cm.openDialog = helpers.fakeOpenDialog(command);

Callers 1

testVimFunction · 0.85

Calls 2

indexOfMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected