ber-security.graylog.graylog-plugin-alert-wizard.5.2.1.source-code.c1ef58663e7326fe623bed35be305efd.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graylog-plugin-alert-wizard Show documentation
Show all versions of graylog-plugin-alert-wizard Show documentation
Graylog ${project.artifactId} plugin.
The newest version!
{"version":3,"sources":["webpack://AlertWizard/c1ef58663e7326fe623bed35be305efd.js"],"sourcesContent":["ace.define(\"ace/ext/hardwrap\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/editor\",\"ace/config\"], function(require, exports, module){\"use strict\";\nvar Range = require(\"../range\").Range;\nfunction hardWrap(editor, options) {\n var max = options.column || editor.getOption(\"printMarginColumn\");\n var allowMerge = options.allowMerge != false;\n var row = Math.min(options.startRow, options.endRow);\n var endRow = Math.max(options.startRow, options.endRow);\n var session = editor.session;\n while (row <= endRow) {\n var line = session.getLine(row);\n if (line.length > max) {\n var space = findSpace(line, max, 5);\n if (space) {\n var indentation = /^\\s*/.exec(line)[0];\n session.replace(new Range(row, space.start, row, space.end), \"\\n\" + indentation);\n }\n endRow++;\n }\n else if (allowMerge && /\\S/.test(line) && row != endRow) {\n var nextLine = session.getLine(row + 1);\n if (nextLine && /\\S/.test(nextLine)) {\n var trimmedLine = line.replace(/\\s+$/, \"\");\n var trimmedNextLine = nextLine.replace(/^\\s+/, \"\");\n var mergedLine = trimmedLine + \" \" + trimmedNextLine;\n var space = findSpace(mergedLine, max, 5);\n if (space && space.start > trimmedLine.length || mergedLine.length < max) {\n var replaceRange = new Range(row, trimmedLine.length, row + 1, nextLine.length - trimmedNextLine.length);\n session.replace(replaceRange, \" \");\n row--;\n endRow--;\n }\n else if (trimmedLine.length < line.length) {\n session.remove(new Range(row, trimmedLine.length, row, line.length));\n }\n }\n }\n row++;\n }\n function findSpace(line, max, min) {\n if (line.length < max)\n return;\n var before = line.slice(0, max);\n var after = line.slice(max);\n var spaceAfter = /^(?:(\\s+)|(\\S+)(\\s+))/.exec(after);\n var spaceBefore = /(?:(\\s+)|(\\s+)(\\S+))$/.exec(before);\n var start = 0;\n var end = 0;\n if (spaceBefore && !spaceBefore[2]) {\n start = max - spaceBefore[1].length;\n end = max;\n }\n if (spaceAfter && !spaceAfter[2]) {\n if (!start)\n start = max;\n end = max + spaceAfter[1].length;\n }\n if (start) {\n return {\n start: start,\n end: end\n };\n }\n if (spaceBefore && spaceBefore[2] && spaceBefore.index > min) {\n return {\n start: spaceBefore.index,\n end: spaceBefore.index + spaceBefore[2].length\n };\n }\n if (spaceAfter && spaceAfter[2]) {\n start = max + spaceAfter[2].length;\n return {\n start: start,\n end: start + spaceAfter[3].length\n };\n }\n }\n}\nfunction wrapAfterInput(e) {\n if (e.command.name == \"insertstring\" && /\\S/.test(e.args)) {\n var editor = e.editor;\n var cursor = editor.selection.cursor;\n if (cursor.column <= editor.renderer.$printMarginColumn)\n return;\n var lastDelta = editor.session.$undoManager.$lastDelta;\n hardWrap(editor, {\n startRow: cursor.row, endRow: cursor.row,\n allowMerge: false\n });\n if (lastDelta != editor.session.$undoManager.$lastDelta)\n editor.session.markUndoGroup();\n }\n}\nvar Editor = require(\"../editor\").Editor;\nrequire(\"../config\").defineOptions(Editor.prototype, \"editor\", {\n hardWrap: {\n set: function (val) {\n if (val) {\n this.commands.on(\"afterExec\", wrapAfterInput);\n }\n else {\n this.commands.off(\"afterExec\", wrapAfterInput);\n }\n },\n value: false\n }\n});\nexports.hardWrap = hardWrap;\n\n});\n\nace.define(\"ace/keyboard/vim\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/keys\",\"ace/lib/event\",\"ace/search\",\"ace/lib/useragent\",\"ace/search_highlight\",\"ace/commands/multi_select_commands\",\"ace/mode/text\",\"ace/ext/hardwrap\",\"ace/multi_select\"], function(require, exports, module){// CodeMirror, copyright (c) by Marijn Haverbeke and others\n'use strict';\nfunction log() {\n var d = \"\";\n function format(p) {\n if (typeof p != \"object\")\n return p + \"\";\n if (\"line\" in p) {\n return p.line + \":\" + p.ch;\n }\n if (\"anchor\" in p) {\n return format(p.anchor) + \"->\" + format(p.head);\n }\n if (Array.isArray(p))\n return \"[\" + p.map(function (x) {\n return format(x);\n }) + \"]\";\n return JSON.stringify(p);\n }\n for (var i = 0; i < arguments.length; i++) {\n var p = arguments[i];\n var f = format(p);\n d += f + \" \";\n }\n console.log(d);\n}\nvar Range = require(\"../range\").Range;\nvar EventEmitter = require(\"../lib/event_emitter\").EventEmitter;\nvar domLib = require(\"../lib/dom\");\nvar oop = require(\"../lib/oop\");\nvar KEYS = require(\"../lib/keys\");\nvar event = require(\"../lib/event\");\nvar Search = require(\"../search\").Search;\nvar useragent = require(\"../lib/useragent\");\nvar SearchHighlight = require(\"../search_highlight\").SearchHighlight;\nvar multiSelectCommands = require(\"../commands/multi_select_commands\");\nvar TextModeTokenRe = require(\"../mode/text\").Mode.prototype.tokenRe;\nvar hardWrap = require(\"../ext/hardwrap\").hardWrap;\nrequire(\"../multi_select\");\nvar CodeMirror = function (ace) {\n this.ace = ace;\n this.state = {};\n this.marks = {};\n this.options = {};\n this.$uid = 0;\n this.onChange = this.onChange.bind(this);\n this.onSelectionChange = this.onSelectionChange.bind(this);\n this.onBeforeEndOperation = this.onBeforeEndOperation.bind(this);\n this.ace.on('change', this.onChange);\n this.ace.on('changeSelection', this.onSelectionChange);\n this.ace.on('beforeEndOperation', this.onBeforeEndOperation);\n};\nCodeMirror.Pos = function (line, ch) {\n if (!(this instanceof Pos))\n return new Pos(line, ch);\n this.line = line;\n this.ch = ch;\n};\nCodeMirror.defineOption = function (name, val, setter) { };\nCodeMirror.commands = {\n redo: function (cm) { cm.ace.redo(); },\n undo: function (cm) { cm.ace.undo(); },\n newlineAndIndent: function (cm) { cm.ace.insert(\"\\n\"); },\n goLineLeft: function (cm) { cm.ace.selection.moveCursorLineStart(); },\n goLineRight: function (cm) { cm.ace.selection.moveCursorLineEnd(); }\n};\nCodeMirror.keyMap = {};\nCodeMirror.addClass = CodeMirror.rmClass = function () { };\nCodeMirror.e_stop = CodeMirror.e_preventDefault = event.stopEvent;\nCodeMirror.keyName = function (e) {\n var key = (KEYS[e.keyCode] || e.key || \"\");\n if (key.length == 1)\n key = key.toUpperCase();\n key = event.getModifierString(e).replace(/(^|-)\\w/g, function (m) {\n return m.toUpperCase();\n }) + key;\n return key;\n};\nCodeMirror.keyMap['default'] = function (key) {\n return function (cm) {\n var cmd = cm.ace.commands.commandKeyBinding[key.toLowerCase()];\n return cmd && cm.ace.execCommand(cmd) !== false;\n };\n};\nCodeMirror.lookupKey = function lookupKey(key, map, handle) {\n if (!map)\n map = \"default\";\n if (typeof map == \"string\")\n map = CodeMirror.keyMap[map];\n var found = typeof map == \"function\" ? map(key) : map[key];\n if (found === false)\n return \"nothing\";\n if (found === \"...\")\n return \"multi\";\n if (found != null && handle(found))\n return \"handled\";\n if (map.fallthrough) {\n if (!Array.isArray(map.fallthrough))\n return lookupKey(key, map.fallthrough, handle);\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle);\n if (result)\n return result;\n }\n }\n};\nCodeMirror.findMatchingTag = function (cm, head) {\n return cm.findMatchingTag(head);\n};\nCodeMirror.findEnclosingTag = function (cm, head) {\n};\nCodeMirror.signal = function (o, name, e) { return o._signal(name, e); };\nCodeMirror.on = event.addListener;\nCodeMirror.off = event.removeListener;\nCodeMirror.isWordChar = function (ch) {\n if (ch < \"\\x7f\")\n return /^\\w$/.test(ch);\n TextModeTokenRe.lastIndex = 0;\n return TextModeTokenRe.test(ch);\n};\n(function () {\n oop.implement(CodeMirror.prototype, EventEmitter);\n this.destroy = function () {\n this.ace.off('change', this.onChange);\n this.ace.off('changeSelection', this.onSelectionChange);\n this.ace.off('beforeEndOperation', this.onBeforeEndOperation);\n this.removeOverlay();\n };\n this.virtualSelectionMode = function () {\n return this.ace.inVirtualSelectionMode && this.ace.selection.index;\n };\n this.onChange = function (delta) {\n var change = { text: delta.action[0] == 'i' ? delta.lines : [] };\n var curOp = this.curOp = this.curOp || {};\n if (!curOp.changeHandlers)\n curOp.changeHandlers = this._eventRegistry[\"change\"] && this._eventRegistry[\"change\"].slice();\n if (!curOp.lastChange) {\n curOp.lastChange = curOp.change = change;\n }\n else {\n curOp.lastChange.next = curOp.lastChange = change;\n }\n this.$updateMarkers(delta);\n };\n this.onSelectionChange = function () {\n var curOp = this.curOp = this.curOp || {};\n if (!curOp.cursorActivityHandlers)\n curOp.cursorActivityHandlers = this._eventRegistry[\"cursorActivity\"] && this._eventRegistry[\"cursorActivity\"].slice();\n this.curOp.cursorActivity = true;\n if (this.ace.inMultiSelectMode) {\n this.ace.keyBinding.removeKeyboardHandler(multiSelectCommands.keyboardHandler);\n }\n };\n this.operation = function (fn, force) {\n if (!force && this.curOp || force && this.curOp && this.curOp.force) {\n return fn();\n }\n if (force || !this.ace.curOp) {\n if (this.curOp)\n this.onBeforeEndOperation();\n }\n if (!this.ace.curOp) {\n var prevOp = this.ace.prevOp;\n this.ace.startOperation({\n command: { name: \"vim\", scrollIntoView: \"cursor\" }\n });\n }\n var curOp = this.curOp = this.curOp || {};\n this.curOp.force = force;\n var result = fn();\n if (this.ace.curOp && this.ace.curOp.command.name == \"vim\") {\n if (this.state.dialog)\n this.ace.curOp.command.scrollIntoView = this.ace.curOp.vimDialogScroll;\n this.ace.endOperation();\n if (!curOp.cursorActivity && !curOp.lastChange && prevOp)\n this.ace.prevOp = prevOp;\n }\n if (force || !this.ace.curOp) {\n if (this.curOp)\n this.onBeforeEndOperation();\n }\n return result;\n };\n this.onBeforeEndOperation = function () {\n var op = this.curOp;\n if (op) {\n if (op.change) {\n this.signal(\"change\", op.change, op);\n }\n if (op && op.cursorActivity) {\n this.signal(\"cursorActivity\", null, op);\n }\n this.curOp = null;\n }\n };\n this.signal = function (eventName, e, handlers) {\n var listeners = handlers ? handlers[eventName + \"Handlers\"]\n : (this._eventRegistry || {})[eventName];\n if (!listeners)\n return;\n listeners = listeners.slice();\n for (var i = 0; i < listeners.length; i++)\n listeners[i](this, e);\n };\n this.firstLine = function () { return 0; };\n this.lastLine = function () { return this.ace.session.getLength() - 1; };\n this.lineCount = function () { return this.ace.session.getLength(); };\n this.setCursor = function (line, ch) {\n if (typeof line === 'object') {\n ch = line.ch;\n line = line.line;\n }\n var shouldScroll = !this.curOp && !this.ace.inVirtualSelectionMode;\n if (!this.ace.inVirtualSelectionMode)\n this.ace.exitMultiSelectMode();\n this.ace.session.unfold({ row: line, column: ch });\n this.ace.selection.moveTo(line, ch);\n if (shouldScroll) {\n this.ace.renderer.scrollCursorIntoView();\n this.ace.endOperation();\n }\n };\n this.getCursor = function (p) {\n var sel = this.ace.selection;\n var pos = p == 'anchor' ? (sel.isEmpty() ? sel.lead : sel.anchor) :\n p == 'head' || !p ? sel.lead : sel.getRange()[p];\n return toCmPos(pos);\n };\n this.listSelections = function (p) {\n var ranges = this.ace.multiSelect.rangeList.ranges;\n if (!ranges.length || this.ace.inVirtualSelectionMode)\n return [{ anchor: this.getCursor('anchor'), head: this.getCursor('head') }];\n return ranges.map(function (r) {\n return {\n anchor: this.clipPos(toCmPos(r.cursor == r.end ? r.start : r.end)),\n head: this.clipPos(toCmPos(r.cursor))\n };\n }, this);\n };\n this.setSelections = function (p, primIndex) {\n var sel = this.ace.multiSelect;\n var ranges = p.map(function (x) {\n var anchor = toAcePos(x.anchor);\n var head = toAcePos(x.head);\n var r = Range.comparePoints(anchor, head) < 0\n ? new Range.fromPoints(anchor, head)\n : new Range.fromPoints(head, anchor);\n r.cursor = Range.comparePoints(r.start, head) ? r.end : r.start;\n return r;\n });\n if (this.ace.inVirtualSelectionMode) {\n this.ace.selection.fromOrientedRange(ranges[0]);\n return;\n }\n if (!primIndex) {\n ranges = ranges.reverse();\n }\n else if (ranges[primIndex]) {\n ranges.push(ranges.splice(primIndex, 1)[0]);\n }\n sel.toSingleRange(ranges[0].clone());\n var session = this.ace.session;\n for (var i = 0; i < ranges.length; i++) {\n var range = session.$clipRangeToDocument(ranges[i]); // todo why ace doesn't do this?\n sel.addRange(range);\n }\n };\n this.setSelection = function (a, h, options) {\n var sel = this.ace.selection;\n sel.moveTo(a.line, a.ch);\n sel.selectTo(h.line, h.ch);\n if (options && options.origin == '*mouse') {\n this.onBeforeEndOperation();\n }\n };\n this.somethingSelected = function (p) {\n return !this.ace.selection.isEmpty();\n };\n this.clipPos = function (p) {\n var pos = this.ace.session.$clipPositionToDocument(p.line, p.ch);\n return toCmPos(pos);\n };\n this.foldCode = function (pos) {\n this.ace.session.$toggleFoldWidget(pos.line, {});\n };\n this.markText = function (cursor) {\n return { clear: function () { }, find: function () { } };\n };\n this.$updateMarkers = function (delta) {\n var isInsert = delta.action == \"insert\";\n var start = delta.start;\n var end = delta.end;\n var rowShift = (end.row - start.row) * (isInsert ? 1 : -1);\n var colShift = (end.column - start.column) * (isInsert ? 1 : -1);\n if (isInsert)\n end = start;\n for (var i in this.marks) {\n var point = this.marks[i];\n var cmp = Range.comparePoints(point, start);\n if (cmp < 0) {\n continue; // delta starts after the range\n }\n if (cmp === 0) {\n if (isInsert) {\n if (point.bias == 1) {\n cmp = 1;\n }\n else {\n point.bias = -1;\n continue;\n }\n }\n }\n var cmp2 = isInsert ? cmp : Range.comparePoints(point, end);\n if (cmp2 > 0) {\n point.row += rowShift;\n point.column += point.row == end.row ? colShift : 0;\n continue;\n }\n if (!isInsert && cmp2 <= 0) {\n point.row = start.row;\n point.column = start.column;\n if (cmp2 === 0)\n point.bias = 1;\n }\n }\n };\n var Marker = function (cm, id, row, column) {\n this.cm = cm;\n this.id = id;\n this.row = row;\n this.column = column;\n cm.marks[this.id] = this;\n };\n Marker.prototype.clear = function () { delete this.cm.marks[this.id]; };\n Marker.prototype.find = function () { return toCmPos(this); };\n this.setBookmark = function (cursor, options) {\n var bm = new Marker(this, this.$uid++, cursor.line, cursor.ch);\n if (!options || !options.insertLeft)\n bm.$insertRight = true;\n this.marks[bm.id] = bm;\n return bm;\n };\n this.moveH = function (increment, unit) {\n if (unit == 'char') {\n var sel = this.ace.selection;\n sel.clearSelection();\n sel.moveCursorBy(0, increment);\n }\n };\n this.findPosV = function (start, amount, unit, goalColumn) {\n if (unit == 'page') {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n amount = amount * Math.floor(config.height / config.lineHeight);\n unit = 'line';\n }\n if (unit == 'line') {\n var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch);\n if (goalColumn != null)\n screenPos.column = goalColumn;\n screenPos.row += amount;\n screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1);\n var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column);\n return toCmPos(pos);\n }\n else {\n debugger;\n }\n };\n this.charCoords = function (pos, mode) {\n if (mode == 'div' || !mode) {\n var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch);\n return { left: sc.column, top: sc.row };\n }\n if (mode == 'local') {\n var renderer = this.ace.renderer;\n var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch);\n var lh = renderer.layerConfig.lineHeight;\n var cw = renderer.layerConfig.characterWidth;\n var top = lh * sc.row;\n return { left: sc.column * cw, top: top, bottom: top + lh };\n }\n };\n this.coordsChar = function (pos, mode) {\n var renderer = this.ace.renderer;\n if (mode == 'local') {\n var row = Math.max(0, Math.floor(pos.top / renderer.lineHeight));\n var col = Math.max(0, Math.floor(pos.left / renderer.characterWidth));\n var ch = renderer.session.screenToDocumentPosition(row, col);\n return toCmPos(ch);\n }\n else if (mode == 'div') {\n throw \"not implemented\";\n }\n };\n this.getSearchCursor = function (query, pos, caseFold) {\n var caseSensitive = false;\n var isRegexp = false;\n if (query instanceof RegExp && !query.global) {\n caseSensitive = !query.ignoreCase;\n query = query.source;\n isRegexp = true;\n }\n if (query == \"\\\\n\") {\n query = \"\\n\";\n isRegexp = false;\n }\n var search = new Search();\n if (pos.ch == undefined)\n pos.ch = Number.MAX_VALUE;\n var acePos = { row: pos.line, column: pos.ch };\n var cm = this;\n var last = null;\n return {\n findNext: function () { return this.find(false); },\n findPrevious: function () { return this.find(true); },\n find: function (back) {\n search.setOptions({\n needle: query,\n caseSensitive: caseSensitive,\n wrap: false,\n backwards: back,\n regExp: isRegexp,\n start: last || acePos\n });\n var range = search.find(cm.ace.session);\n last = range;\n return last && [!last.isEmpty()];\n },\n from: function () { return last && toCmPos(last.start); },\n to: function () { return last && toCmPos(last.end); },\n replace: function (text) {\n if (last) {\n last.end = cm.ace.session.doc.replace(last, text);\n }\n }\n };\n };\n this.scrollTo = function (x, y) {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n var maxHeight = config.maxHeight;\n maxHeight -= (renderer.$size.scrollerHeight - renderer.lineHeight) * renderer.$scrollPastEnd;\n if (y != null)\n this.ace.session.setScrollTop(Math.max(0, Math.min(y, maxHeight)));\n if (x != null)\n this.ace.session.setScrollLeft(Math.max(0, Math.min(x, config.width)));\n };\n this.scrollInfo = function () { return 0; };\n this.scrollIntoView = function (pos, margin) {\n if (pos) {\n var renderer = this.ace.renderer;\n var viewMargin = { \"top\": 0, \"bottom\": margin };\n renderer.scrollCursorIntoView(toAcePos(pos), (renderer.lineHeight * 2) / renderer.$size.scrollerHeight, viewMargin);\n }\n };\n this.getLine = function (row) { return this.ace.session.getLine(row); };\n this.getRange = function (s, e) {\n return this.ace.session.getTextRange(new Range(s.line, s.ch, e.line, e.ch));\n };\n this.replaceRange = function (text, s, e) {\n if (!e)\n e = s;\n var range = new Range(s.line, s.ch, e.line, e.ch);\n this.ace.session.$clipRangeToDocument(range);\n return this.ace.session.replace(range, text);\n };\n this.replaceSelection =\n this.replaceSelections = function (p) {\n var sel = this.ace.selection;\n if (this.ace.inVirtualSelectionMode) {\n this.ace.session.replace(sel.getRange(), p[0] || \"\");\n return;\n }\n sel.inVirtualSelectionMode = true;\n var ranges = sel.rangeList.ranges;\n if (!ranges.length)\n ranges = [this.ace.multiSelect.getRange()];\n for (var i = ranges.length; i--;)\n this.ace.session.replace(ranges[i], p[i] || \"\");\n sel.inVirtualSelectionMode = false;\n };\n this.getSelection = function () {\n return this.ace.getSelectedText();\n };\n this.getSelections = function () {\n return this.listSelections().map(function (x) {\n return this.getRange(x.anchor, x.head);\n }, this);\n };\n this.getInputField = function () {\n return this.ace.textInput.getElement();\n };\n this.getWrapperElement = function () {\n return this.ace.container;\n };\n var optMap = {\n indentWithTabs: \"useSoftTabs\",\n indentUnit: \"tabSize\",\n tabSize: \"tabSize\",\n firstLineNumber: \"firstLineNumber\",\n readOnly: \"readOnly\"\n };\n this.setOption = function (name, val) {\n this.state[name] = val;\n switch (name) {\n case 'indentWithTabs':\n name = optMap[name];\n val = !val;\n break;\n case 'keyMap':\n this.state.$keyMap = val;\n return;\n break;\n default:\n name = optMap[name];\n }\n if (name)\n this.ace.setOption(name, val);\n };\n this.getOption = function (name) {\n var val;\n var aceOpt = optMap[name];\n if (aceOpt)\n val = this.ace.getOption(aceOpt);\n switch (name) {\n case 'indentWithTabs':\n name = optMap[name];\n return !val;\n case 'keyMap':\n return this.state.$keyMap || 'vim';\n }\n return aceOpt ? val : this.state[name];\n };\n this.toggleOverwrite = function (on) {\n this.state.overwrite = on;\n return this.ace.setOverwrite(on);\n };\n this.addOverlay = function (o) {\n if (!this.$searchHighlight || !this.$searchHighlight.session) {\n var highlight = new SearchHighlight(null, \"ace_highlight-marker\", \"text\");\n var marker = this.ace.session.addDynamicMarker(highlight);\n highlight.id = marker.id;\n highlight.session = this.ace.session;\n highlight.destroy = function (o) {\n highlight.session.off(\"change\", highlight.updateOnChange);\n highlight.session.off(\"changeEditor\", highlight.destroy);\n highlight.session.removeMarker(highlight.id);\n highlight.session = null;\n };\n highlight.updateOnChange = function (delta) {\n var row = delta.start.row;\n if (row == delta.end.row)\n highlight.cache[row] = undefined;\n else\n highlight.cache.splice(row, highlight.cache.length);\n };\n highlight.session.on(\"changeEditor\", highlight.destroy);\n highlight.session.on(\"change\", highlight.updateOnChange);\n }\n var re = new RegExp(o.query.source, \"gmi\");\n this.$searchHighlight = o.highlight = highlight;\n this.$searchHighlight.setRegexp(re);\n this.ace.renderer.updateBackMarkers();\n };\n this.removeOverlay = function (o) {\n if (this.$searchHighlight && this.$searchHighlight.session) {\n this.$searchHighlight.destroy();\n }\n };\n this.getScrollInfo = function () {\n var renderer = this.ace.renderer;\n var config = renderer.layerConfig;\n return {\n left: renderer.scrollLeft,\n top: renderer.scrollTop,\n height: config.maxHeight,\n width: config.width,\n clientHeight: config.height,\n clientWidth: config.width\n };\n };\n this.getValue = function () {\n return this.ace.getValue();\n };\n this.setValue = function (v) {\n return this.ace.setValue(v, -1);\n };\n this.getTokenTypeAt = function (pos) {\n var token = this.ace.session.getTokenAt(pos.line, pos.ch);\n return token && /comment|string/.test(token.type) ? \"string\" : \"\";\n };\n this.findMatchingBracket = function (pos) {\n var m = this.ace.session.findMatchingBracket(toAcePos(pos));\n return { to: m && toCmPos(m) };\n };\n this.findMatchingTag = function (pos) {\n var m = this.ace.session.getMatchingTags(toAcePos(pos));\n if (!m)\n return;\n return {\n open: {\n from: toCmPos(m.openTag.start),\n to: toCmPos(m.openTag.end)\n },\n close: {\n from: toCmPos(m.closeTag.start),\n to: toCmPos(m.closeTag.end)\n }\n };\n };\n this.indentLine = function (line, method) {\n if (method === true)\n this.ace.session.indentRows(line, line, \"\\t\");\n else if (method === false)\n this.ace.session.outdentRows(new Range(line, 0, line, 0));\n };\n this.indexFromPos = function (pos) {\n return this.ace.session.doc.positionToIndex(toAcePos(pos));\n };\n this.posFromIndex = function (index) {\n return toCmPos(this.ace.session.doc.indexToPosition(index));\n };\n this.focus = function (index) {\n return this.ace.textInput.focus();\n };\n this.blur = function (index) {\n return this.ace.blur();\n };\n this.defaultTextHeight = function (index) {\n return this.ace.renderer.layerConfig.lineHeight;\n };\n this.scanForBracket = function (pos, dir, _, options) {\n var re = options.bracketRegex.source;\n var tokenRe = /paren|text|operator|tag/;\n if (dir == 1) {\n var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), tokenRe);\n }\n else {\n var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), { row: pos.line, column: pos.ch + 1 }, tokenRe);\n }\n return m && { pos: toCmPos(m) };\n };\n this.refresh = function () {\n return this.ace.resize(true);\n };\n this.getMode = function () {\n return { name: this.getOption(\"mode\") };\n };\n this.execCommand = function (name) {\n if (CodeMirror.commands.hasOwnProperty(name))\n return CodeMirror.commands[name](this);\n if (name == \"indentAuto\")\n return this.ace.execCommand(\"autoindent\");\n console.log(name + \" is not implemented\");\n };\n this.getLineNumber = function (handle) {\n return handle.row;\n };\n this.getLineHandle = function (row) {\n return { text: this.ace.session.getLine(row), row: row };\n };\n}).call(CodeMirror.prototype);\nfunction toAcePos(cmPos) {\n return { row: cmPos.line, column: cmPos.ch };\n}\nfunction toCmPos(acePos) {\n return new Pos(acePos.row, acePos.column);\n}\nvar StringStream = CodeMirror.StringStream = function (string, tabSize) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n};\nStringStream.prototype = {\n eol: function () { return this.pos >= this.string.length; },\n sol: function () { return this.pos == this.lineStart; },\n peek: function () { return this.string.charAt(this.pos) || undefined; },\n next: function () {\n if (this.pos < this.string.length)\n return this.string.charAt(this.pos++);\n },\n eat: function (match) {\n var ch = this.string.charAt(this.pos);\n if (typeof match == \"string\")\n var ok = ch == match;\n else\n var ok = ch && (match.test ? match.test(ch) : match(ch));\n if (ok) {\n ++this.pos;\n return ch;\n }\n },\n eatWhile: function (match) {\n var start = this.pos;\n while (this.eat(match)) { }\n return this.pos > start;\n },\n eatSpace: function () {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos)))\n ++this.pos;\n return this.pos > start;\n },\n skipToEnd: function () { this.pos = this.string.length; },\n skipTo: function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {\n this.pos = found;\n return true;\n }\n },\n backUp: function (n) { this.pos -= n; },\n column: function () {\n throw \"not implemented\";\n },\n indentation: function () {\n throw \"not implemented\";\n },\n match: function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false)\n this.pos += pattern.length;\n return true;\n }\n }\n else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0)\n return null;\n if (match && consume !== false)\n this.pos += match[0].length;\n return match;\n }\n },\n current: function () { return this.string.slice(this.start, this.pos); },\n hideFirstChars: function (n, inner) {\n this.lineStart += n;\n try {\n return inner();\n }\n finally {\n this.lineStart -= n;\n }\n }\n};\nCodeMirror.defineExtension = function (name, fn) {\n CodeMirror.prototype[name] = fn;\n};\ndomLib.importCssString(\".normal-mode .ace_cursor{\\n border: none;\\n background-color: rgba(255,0,0,0.5);\\n}\\n.normal-mode .ace_hidden-cursors .ace_cursor{\\n background-color: transparent;\\n border: 1px solid red;\\n opacity: 0.7\\n}\\n.ace_dialog {\\n position: absolute;\\n left: 0; right: 0;\\n background: inherit;\\n z-index: 15;\\n padding: .1em .8em;\\n overflow: hidden;\\n color: inherit;\\n}\\n.ace_dialog-top {\\n border-bottom: 1px solid #444;\\n top: 0;\\n}\\n.ace_dialog-bottom {\\n border-top: 1px solid #444;\\n bottom: 0;\\n}\\n.ace_dialog input {\\n border: none;\\n outline: none;\\n background: transparent;\\n width: 20em;\\n color: inherit;\\n font-family: monospace;\\n}\", \"vimMode\", false);\n(function () {\n function dialogDiv(cm, template, bottom) {\n var wrap = cm.ace.container;\n var dialog;\n dialog = wrap.appendChild(document.createElement(\"div\"));\n if (bottom)\n dialog.className = \"ace_dialog ace_dialog-bottom\";\n else\n dialog.className = \"ace_dialog ace_dialog-top\";\n if (typeof template == \"string\") {\n dialog.innerHTML = template;\n }\n else { // Assuming it's a detached DOM element.\n dialog.appendChild(template);\n }\n return dialog;\n }\n function closeNotification(cm, newVal) {\n if (cm.state.currentNotificationClose)\n cm.state.currentNotificationClose();\n cm.state.currentNotificationClose = newVal;\n }\n CodeMirror.defineExtension(\"openDialog\", function (template, callback, options) {\n if (this.virtualSelectionMode())\n return;\n if (!options)\n options = {};\n closeNotification(this, null);\n var dialog = dialogDiv(this, template, options.bottom);\n var closed = false, me = this;\n this.state.dialog = dialog;\n function close(newVal) {\n if (typeof newVal == 'string') {\n inp.value = newVal;\n }\n else {\n if (closed)\n return;\n if (newVal && newVal.type == \"blur\") {\n if (document.activeElement === inp)\n return;\n }\n if (me.state.dialog == dialog) {\n me.state.dialog = null;\n me.focus();\n }\n closed = true;\n dialog.remove();\n if (options.onClose)\n options.onClose(dialog);\n var cm = me;\n if (cm.state.vim) {\n cm.state.vim.status = null;\n cm.ace._signal(\"changeStatus\");\n cm.ace.renderer.$loop.schedule(cm.ace.renderer.CHANGE_CURSOR);\n }\n }\n }\n var inp = dialog.getElementsByTagName(\"input\")[0], button;\n if (inp) {\n if (options.value) {\n inp.value = options.value;\n if (options.selectValueOnOpen !== false)\n inp.select();\n }\n if (options.onInput)\n CodeMirror.on(inp, \"input\", function (e) { options.onInput(e, inp.value, close); });\n if (options.onKeyUp)\n CodeMirror.on(inp, \"keyup\", function (e) { options.onKeyUp(e, inp.value, close); });\n CodeMirror.on(inp, \"keydown\", function (e) {\n if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) {\n return;\n }\n if (e.keyCode == 13)\n callback(inp.value);\n if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {\n CodeMirror.e_stop(e);\n close();\n }\n });\n if (options.closeOnBlur !== false)\n CodeMirror.on(inp, \"blur\", close);\n inp.focus();\n }\n else if (button = dialog.getElementsByTagName(\"button\")[0]) {\n CodeMirror.on(button, \"click\", function () {\n close();\n me.focus();\n });\n if (options.closeOnBlur !== false)\n CodeMirror.on(button, \"blur\", close);\n button.focus();\n }\n return close;\n });\n CodeMirror.defineExtension(\"openNotification\", function (template, options) {\n if (this.virtualSelectionMode())\n return;\n closeNotification(this, close);\n var dialog = dialogDiv(this, template, options && options.bottom);\n var closed = false, doneTimer;\n var duration = options && typeof options.duration !== \"undefined\" ? options.duration : 5000;\n function close() {\n if (closed)\n return;\n closed = true;\n clearTimeout(doneTimer);\n dialog.remove();\n }\n CodeMirror.on(dialog, 'click', function (e) {\n CodeMirror.e_preventDefault(e);\n close();\n });\n if (duration)\n doneTimer = setTimeout(close, duration);\n return close;\n });\n})();\nvar Pos = CodeMirror.Pos;\nfunction transformCursor(cm, range) {\n var vim = cm.state.vim;\n if (!vim || vim.insertMode)\n return range.head;\n var head = vim.sel.head;\n if (!head)\n return range.head;\n if (vim.visualBlock) {\n if (range.head.line != head.line) {\n return;\n }\n }\n if (range.from() == range.anchor && !range.empty()) {\n if (range.head.line == head.line && range.head.ch != head.ch)\n return new Pos(range.head.line, range.head.ch - 1);\n }\n return range.head;\n}\nfunction updateSelectionForSurrogateCharacters(cm, curStart, curEnd) {\n if (curStart.line === curEnd.line && curStart.ch >= curEnd.ch - 1) {\n var text = cm.getLine(curStart.line);\n var charCode = text.charCodeAt(curStart.ch);\n if (0xD800 <= charCode && charCode <= 0xD8FF) {\n curEnd.ch += 1;\n }\n }\n return { start: curStart, end: curEnd };\n}\nvar defaultKeymap = [\n { keys: '', type: 'keyToKey', toKeys: 'h' },\n { keys: '', type: 'keyToKey', toKeys: 'l' },\n { keys: '', type: 'keyToKey', toKeys: 'k' },\n { keys: '', type: 'keyToKey', toKeys: 'j' },\n { keys: 'g', type: 'keyToKey', toKeys: 'gk' },\n { keys: 'g', type: 'keyToKey', toKeys: 'gj' },\n { keys: '', type: 'keyToKey', toKeys: 'l' },\n { keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal' },\n { keys: '', type: 'keyToKey', toKeys: 'x', context: 'normal' },\n { keys: '', type: 'keyToKey', toKeys: 'W' },\n { keys: '', type: 'keyToKey', toKeys: 'B', context: 'normal' },\n { keys: '', type: 'keyToKey', toKeys: 'w' },\n { keys: '', type: 'keyToKey', toKeys: 'b', context: 'normal' },\n { keys: '', type: 'keyToKey', toKeys: 'j' },\n { keys: '', type: 'keyToKey', toKeys: 'k' },\n { keys: '', type: 'keyToKey', toKeys: '' },\n { keys: '', type: 'keyToKey', toKeys: '' },\n { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' },\n { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' },\n { keys: '', type: 'keyToKey', toKeys: '' },\n { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' },\n { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },\n { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual' },\n { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },\n { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },\n { keys: '', type: 'keyToKey', toKeys: '0' },\n { keys: '', type: 'keyToKey', toKeys: '$' },\n { keys: '', type: 'keyToKey', toKeys: '' },\n { keys: '', type: 'keyToKey', toKeys: '' },\n { keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' },\n { keys: '', type: 'keyToKey', toKeys: 'i', context: 'normal' },\n { keys: '', type: 'action', action: 'toggleOverwrite', context: 'insert' },\n { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true } },\n { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true } },\n { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true } },\n { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false } },\n { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true } },\n { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true } },\n { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true } },\n { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true } },\n { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false } },\n { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false } },\n { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true } },\n { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true } },\n { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true } },\n { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false } },\n { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true } },\n { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true } },\n { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true } },\n { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true } },\n { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true } },\n { keys: '(', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: false } },\n { keys: ')', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: true } },\n { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true } },\n { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false } },\n { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true } },\n { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true } },\n { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true } },\n { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true } },\n { keys: \"g$\", type: \"motion\", motion: \"moveToEndOfDisplayLine\" },\n { keys: \"g^\", type: \"motion\", motion: \"moveToStartOfDisplayLine\" },\n { keys: \"g0\", type: \"motion\", motion: \"moveToStartOfDisplayLine\" },\n { keys: '0', type: 'motion', motion: 'moveToStartOfLine' },\n { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar: true } },\n { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar: true } },\n { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar: true, repeatOffset: -1 } },\n { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true } },\n { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true } },\n { keys: 'f', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true, inclusive: true } },\n { keys: 'F', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false } },\n { keys: 't', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true } },\n { keys: 'T', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false } },\n { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true } },\n { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false } },\n { keys: '\\'', type: 'motion', motion: 'goToMark', motionArgs: { toJumplist: true, linewise: true } },\n { keys: '`', type: 'motion', motion: 'goToMark', motionArgs: { toJumplist: true } },\n { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } },\n { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } },\n { keys: ']\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } },\n { keys: '[\\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } },\n { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true } },\n { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true } },\n { keys: ']', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true } },\n { keys: '[', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true } },\n { keys: '|', type: 'motion', motion: 'moveToColumn' },\n { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context: 'visual' },\n { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: { sameLine: true }, context: 'visual' },\n { keys: 'd', type: 'operator', operator: 'delete' },\n { keys: 'y', type: 'operator', operator: 'yank' },\n { keys: 'c', type: 'operator', operator: 'change' },\n { keys: '=', type: 'operator', operator: 'indentAuto' },\n { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true } },\n { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false } },\n { keys: 'g~', type: 'operator', operator: 'changeCase' },\n { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: true }, isEdit: true },\n { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: false }, isEdit: true },\n { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true } },\n { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true } },\n { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true } },\n { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false } },\n { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false } },\n { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true } },\n { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal' },\n { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual' },\n { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'expandToLine', motionArgs: { linewise: true }, context: 'normal' },\n { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual' },\n { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal' },\n { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual' },\n { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal' },\n { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual' },\n { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveToStartOfLine', context: 'insert' },\n { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },\n { keys: '', type: 'idle', context: 'normal' },\n { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true } },\n { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false } },\n { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true } },\n { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true } },\n { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' },\n { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' },\n { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' },\n { keys: 'gi', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'lastEdit' }, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank' }, context: 'normal' },\n { keys: 'gI', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'bol' }, context: 'normal' },\n { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' },\n { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' },\n { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' },\n { keys: 'v', type: 'action', action: 'toggleVisualMode' },\n { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true } },\n { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true } },\n { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true } },\n { keys: 'gv', type: 'action', action: 'reselectLastSelection' },\n { keys: 'J', type: 'action', action: 'joinLines', isEdit: true },\n { keys: 'gJ', type: 'action', action: 'joinLines', actionArgs: { keepSpaces: true }, isEdit: true },\n { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true } },\n { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true } },\n { keys: 'r', type: 'action', action: 'replace', isEdit: true },\n { keys: '@', type: 'action', action: 'replayMacro' },\n { keys: 'q', type: 'action', action: 'enterMacroRecordMode' },\n { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }, context: 'normal' },\n { keys: 'R', type: 'operator', operator: 'change', operatorArgs: { linewise: true, fullLine: true }, context: 'visual', exitVisualBlock: true },\n { keys: 'u', type: 'action', action: 'undo', context: 'normal' },\n { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: true }, context: 'visual', isEdit: true },\n { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: { toLower: false }, context: 'visual', isEdit: true },\n { keys: '', type: 'action', action: 'redo' },\n { keys: 'm', type: 'action', action: 'setMark' },\n { keys: '\"', type: 'action', action: 'setRegister' },\n { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' } },\n { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' } },\n { keys: 'z', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' } },\n { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },\n { keys: '.', type: 'action', action: 'repeatLastEdit' },\n { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: { increase: true, backtrack: false } },\n { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: { increase: false, backtrack: false } },\n { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' },\n { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' },\n { keys: 'a', type: 'motion', motion: 'textObjectManipulation' },\n { keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true } },\n { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true } },\n { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true } },\n { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true } },\n { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true } },\n { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true } },\n { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true } },\n { keys: ':', type: 'ex' }\n];\nvar defaultKeymapLength = defaultKeymap.length;\nvar defaultExCommandMap = [\n { name: 'colorscheme', shortName: 'colo' },\n { name: 'map' },\n { name: 'imap', shortName: 'im' },\n { name: 'nmap', shortName: 'nm' },\n { name: 'vmap', shortName: 'vm' },\n { name: 'unmap' },\n { name: 'write', shortName: 'w' },\n { name: 'undo', shortName: 'u' },\n { name: 'redo', shortName: 'red' },\n { name: 'set', shortName: 'se' },\n { name: 'setlocal', shortName: 'setl' },\n { name: 'setglobal', shortName: 'setg' },\n { name: 'sort', shortName: 'sor' },\n { name: 'substitute', shortName: 's', possiblyAsync: true },\n { name: 'nohlsearch', shortName: 'noh' },\n { name: 'yank', shortName: 'y' },\n { name: 'delmarks', shortName: 'delm' },\n { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },\n { name: 'vglobal', shortName: 'v' },\n { name: 'global', shortName: 'g' }\n];\nfunction enterVimMode(cm) {\n cm.setOption('disableInput', true);\n cm.setOption('showCursorWhenSelecting', false);\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"normal\" });\n cm.on('cursorActivity', onCursorActivity);\n maybeInitVimState(cm);\n CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm));\n}\nfunction leaveVimMode(cm) {\n cm.setOption('disableInput', false);\n cm.off('cursorActivity', onCursorActivity);\n CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));\n cm.state.vim = null;\n if (highlightTimeout)\n clearTimeout(highlightTimeout);\n}\nfunction detachVimMap(cm, next) {\n if (this == CodeMirror.keyMap.vim) {\n cm.options.$customCursor = null;\n CodeMirror.rmClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n }\n if (!next || next.attach != attachVimMap)\n leaveVimMode(cm);\n}\nfunction attachVimMap(cm, prev) {\n if (this == CodeMirror.keyMap.vim) {\n if (cm.curOp)\n cm.curOp.selectionChanged = true;\n cm.options.$customCursor = transformCursor;\n CodeMirror.addClass(cm.getWrapperElement(), \"cm-fat-cursor\");\n }\n if (!prev || prev.attach != attachVimMap)\n enterVimMode(cm);\n}\nCodeMirror.defineOption('vimMode', false, function (cm, val, prev) {\n if (val && cm.getOption(\"keyMap\") != \"vim\")\n cm.setOption(\"keyMap\", \"vim\");\n else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption(\"keyMap\")))\n cm.setOption(\"keyMap\", \"default\");\n});\nfunction cmKey(key, cm) {\n if (!cm) {\n return undefined;\n }\n if (this[key]) {\n return this[key];\n }\n var vimKey = cmKeyToVimKey(key);\n if (!vimKey) {\n return false;\n }\n var cmd = vimApi.findKey(cm, vimKey);\n if (typeof cmd == 'function') {\n CodeMirror.signal(cm, 'vim-keypress', vimKey);\n }\n return cmd;\n}\nvar modifiers = { Shift: 'S', Ctrl: 'C', Alt: 'A', Cmd: 'D', Mod: 'A', CapsLock: '' };\nvar specialKeys = { Enter: 'CR', Backspace: 'BS', Delete: 'Del', Insert: 'Ins' };\nfunction cmKeyToVimKey(key) {\n if (key.charAt(0) == '\\'') {\n return key.charAt(1);\n }\n var pieces = key.split(/-(?!$)/);\n var lastPiece = pieces[pieces.length - 1];\n if (pieces.length == 1 && pieces[0].length == 1) {\n return false;\n }\n else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) {\n return false;\n }\n var hasCharacter = false;\n for (var i = 0; i < pieces.length; i++) {\n var piece = pieces[i];\n if (piece in modifiers) {\n pieces[i] = modifiers[piece];\n }\n else {\n hasCharacter = true;\n }\n if (piece in specialKeys) {\n pieces[i] = specialKeys[piece];\n }\n }\n if (!hasCharacter) {\n return false;\n }\n if (isUpperCase(lastPiece)) {\n pieces[pieces.length - 1] = lastPiece.toLowerCase();\n }\n return '<' + pieces.join('-') + '>';\n}\nfunction getOnPasteFn(cm) {\n var vim = cm.state.vim;\n if (!vim.onPasteFn) {\n vim.onPasteFn = function () {\n if (!vim.insertMode) {\n cm.setCursor(offsetCursor(cm.getCursor(), 0, 1));\n actions.enterInsertMode(cm, {}, vim);\n }\n };\n }\n return vim.onPasteFn;\n}\nvar numberRegex = /[\\d]/;\nvar wordCharTest = [CodeMirror.isWordChar, function (ch) {\n return ch && !CodeMirror.isWordChar(ch) && !/\\s/.test(ch);\n }], bigWordCharTest = [function (ch) {\n return /\\S/.test(ch);\n }];\nfunction makeKeyRange(start, size) {\n var keys = [];\n for (var i = start; i < start + size; i++) {\n keys.push(String.fromCharCode(i));\n }\n return keys;\n}\nvar upperCaseAlphabet = makeKeyRange(65, 26);\nvar lowerCaseAlphabet = makeKeyRange(97, 26);\nvar numbers = makeKeyRange(48, 10);\nvar validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']);\nvar validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '\"', '.', ':', '_', '/', '+']);\nvar upperCaseChars;\ntry {\n upperCaseChars = new RegExp(\"^[\\\\p{Lu}]$\", \"u\");\n}\ncatch (_) {\n upperCaseChars = /^[A-Z]$/;\n}\nfunction isLine(cm, line) {\n return line >= cm.firstLine() && line <= cm.lastLine();\n}\nfunction isLowerCase(k) {\n return (/^[a-z]$/).test(k);\n}\nfunction isMatchableSymbol(k) {\n return '()[]{}'.indexOf(k) != -1;\n}\nfunction isNumber(k) {\n return numberRegex.test(k);\n}\nfunction isUpperCase(k) {\n return upperCaseChars.test(k);\n}\nfunction isWhiteSpaceString(k) {\n return (/^\\s*$/).test(k);\n}\nfunction isEndOfSentenceSymbol(k) {\n return '.?!'.indexOf(k) != -1;\n}\nfunction inArray(val, arr) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] == val) {\n return true;\n }\n }\n return false;\n}\nvar options = {};\nfunction defineOption(name, defaultValue, type, aliases, callback) {\n if (defaultValue === undefined && !callback) {\n throw Error('defaultValue is required unless callback is provided');\n }\n if (!type) {\n type = 'string';\n }\n options[name] = {\n type: type,\n defaultValue: defaultValue,\n callback: callback\n };\n if (aliases) {\n for (var i = 0; i < aliases.length; i++) {\n options[aliases[i]] = options[name];\n }\n }\n if (defaultValue) {\n setOption(name, defaultValue);\n }\n}\nfunction setOption(name, value, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n return new Error('Unknown option: ' + name);\n }\n if (option.type == 'boolean') {\n if (value && value !== true) {\n return new Error('Invalid argument: ' + name + '=' + value);\n }\n else if (value !== false) {\n value = true;\n }\n }\n if (option.callback) {\n if (scope !== 'local') {\n option.callback(value, undefined);\n }\n if (scope !== 'global' && cm) {\n option.callback(value, cm);\n }\n }\n else {\n if (scope !== 'local') {\n option.value = option.type == 'boolean' ? !!value : value;\n }\n if (scope !== 'global' && cm) {\n cm.state.vim.options[name] = { value: value };\n }\n }\n}\nfunction getOption(name, cm, cfg) {\n var option = options[name];\n cfg = cfg || {};\n var scope = cfg.scope;\n if (!option) {\n return new Error('Unknown option: ' + name);\n }\n if (option.callback) {\n var local = cm && option.callback(undefined, cm);\n if (scope !== 'global' && local !== undefined) {\n return local;\n }\n if (scope !== 'local') {\n return option.callback();\n }\n return;\n }\n else {\n var local = (scope !== 'global') && (cm && cm.state.vim.options[name]);\n return (local || (scope !== 'local') && option || {}).value;\n }\n}\ndefineOption('filetype', undefined, 'string', ['ft'], function (name, cm) {\n if (cm === undefined) {\n return;\n }\n if (name === undefined) {\n var mode = cm.getOption('mode');\n return mode == 'null' ? '' : mode;\n }\n else {\n var mode = name == '' ? 'null' : name;\n cm.setOption('mode', mode);\n }\n});\nvar createCircularJumpList = function () {\n var size = 100;\n var pointer = -1;\n var head = 0;\n var tail = 0;\n var buffer = new Array(size);\n function add(cm, oldCur, newCur) {\n var current = pointer % size;\n var curMark = buffer[current];\n function useNextSlot(cursor) {\n var next = ++pointer % size;\n var trashMark = buffer[next];\n if (trashMark) {\n trashMark.clear();\n }\n buffer[next] = cm.setBookmark(cursor);\n }\n if (curMark) {\n var markPos = curMark.find();\n if (markPos && !cursorEqual(markPos, oldCur)) {\n useNextSlot(oldCur);\n }\n }\n else {\n useNextSlot(oldCur);\n }\n useNextSlot(newCur);\n head = pointer;\n tail = pointer - size + 1;\n if (tail < 0) {\n tail = 0;\n }\n }\n function move(cm, offset) {\n pointer += offset;\n if (pointer > head) {\n pointer = head;\n }\n else if (pointer < tail) {\n pointer = tail;\n }\n var mark = buffer[(size + pointer) % size];\n if (mark && !mark.find()) {\n var inc = offset > 0 ? 1 : -1;\n var newCur;\n var oldCur = cm.getCursor();\n do {\n pointer += inc;\n mark = buffer[(size + pointer) % size];\n if (mark &&\n (newCur = mark.find()) &&\n !cursorEqual(oldCur, newCur)) {\n break;\n }\n } while (pointer < head && pointer > tail);\n }\n return mark;\n }\n function find(cm, offset) {\n var oldPointer = pointer;\n var mark = move(cm, offset);\n pointer = oldPointer;\n return mark && mark.find();\n }\n return {\n cachedCursor: undefined,\n add: add,\n find: find,\n move: move\n };\n};\nvar createInsertModeChanges = function (c) {\n if (c) {\n return {\n changes: c.changes,\n expectCursorActivityForChange: c.expectCursorActivityForChange\n };\n }\n return {\n changes: [],\n expectCursorActivityForChange: false\n };\n};\nfunction MacroModeState() {\n this.latestRegister = undefined;\n this.isPlaying = false;\n this.isRecording = false;\n this.replaySearchQueries = [];\n this.onRecordingDone = undefined;\n this.lastInsertModeChanges = createInsertModeChanges();\n}\nMacroModeState.prototype = {\n exitMacroRecordMode: function () {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.onRecordingDone) {\n macroModeState.onRecordingDone(); // close dialog\n }\n macroModeState.onRecordingDone = undefined;\n macroModeState.isRecording = false;\n },\n enterMacroRecordMode: function (cm, registerName) {\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.clear();\n this.latestRegister = registerName;\n if (cm.openDialog) {\n var template = dom('span', { class: 'cm-vim-message' }, 'recording @' + registerName);\n this.onRecordingDone = cm.openDialog(template, null, { bottom: true });\n }\n this.isRecording = true;\n }\n }\n};\nfunction maybeInitVimState(cm) {\n if (!cm.state.vim) {\n cm.state.vim = {\n inputState: new InputState(),\n lastEditInputState: undefined,\n lastEditActionCommand: undefined,\n lastHPos: -1,\n lastHSPos: -1,\n lastMotion: null,\n marks: {},\n insertMode: false,\n insertModeRepeat: undefined,\n visualMode: false,\n visualLine: false,\n visualBlock: false,\n lastSelection: null,\n lastPastedText: null,\n sel: {},\n options: {}\n };\n }\n return cm.state.vim;\n}\nvar vimGlobalState;\nfunction resetVimGlobalState() {\n vimGlobalState = {\n searchQuery: null,\n searchIsReversed: false,\n lastSubstituteReplacePart: undefined,\n jumpList: createCircularJumpList(),\n macroModeState: new MacroModeState,\n lastCharacterSearch: { increment: 0, forward: true, selectedCharacter: '' },\n registerController: new RegisterController({}),\n searchHistoryController: new HistoryController(),\n exCommandHistoryController: new HistoryController()\n };\n for (var optionName in options) {\n var option = options[optionName];\n option.value = option.defaultValue;\n }\n}\nvar lastInsertModeKeyTimer;\nvar vimApi = {\n enterVimMode: enterVimMode,\n leaveVimMode: leaveVimMode,\n buildKeyMap: function () {\n },\n getRegisterController: function () {\n return vimGlobalState.registerController;\n },\n resetVimGlobalState_: resetVimGlobalState,\n getVimGlobalState_: function () {\n return vimGlobalState;\n },\n maybeInitVimState_: maybeInitVimState,\n suppressErrorLogging: false,\n InsertModeKey: InsertModeKey,\n map: function (lhs, rhs, ctx) {\n exCommandDispatcher.map(lhs, rhs, ctx);\n },\n unmap: function (lhs, ctx) {\n return exCommandDispatcher.unmap(lhs, ctx);\n },\n noremap: function (lhs, rhs, ctx) {\n function toCtxArray(ctx) {\n return ctx ? [ctx] : ['normal', 'insert', 'visual'];\n }\n var ctxsToMap = toCtxArray(ctx);\n var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;\n for (var i = actualLength - origLength; i < actualLength && ctxsToMap.length; i++) {\n var mapping = defaultKeymap[i];\n if (mapping.keys == rhs &&\n (!ctx || !mapping.context || mapping.context === ctx) &&\n mapping.type.substr(0, 2) !== 'ex' &&\n mapping.type.substr(0, 3) !== 'key') {\n var newMapping = {};\n for (var key in mapping) {\n newMapping[key] = mapping[key];\n }\n newMapping.keys = lhs;\n if (ctx && !newMapping.context) {\n newMapping.context = ctx;\n }\n this._mapCommand(newMapping);\n var mappedCtxs = toCtxArray(mapping.context);\n ctxsToMap = ctxsToMap.filter(function (el) { return mappedCtxs.indexOf(el) === -1; });\n }\n }\n },\n mapclear: function (ctx) {\n var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;\n var userKeymap = defaultKeymap.slice(0, actualLength - origLength);\n defaultKeymap = defaultKeymap.slice(actualLength - origLength);\n if (ctx) {\n for (var i = userKeymap.length - 1; i >= 0; i--) {\n var mapping = userKeymap[i];\n if (ctx !== mapping.context) {\n if (mapping.context) {\n this._mapCommand(mapping);\n }\n else {\n var contexts = ['normal', 'insert', 'visual'];\n for (var j in contexts) {\n if (contexts[j] !== ctx) {\n var newMapping = {};\n for (var key in mapping) {\n newMapping[key] = mapping[key];\n }\n newMapping.context = contexts[j];\n this._mapCommand(newMapping);\n }\n }\n }\n }\n }\n }\n },\n setOption: setOption,\n getOption: getOption,\n defineOption: defineOption,\n defineEx: function (name, prefix, func) {\n if (!prefix) {\n prefix = name;\n }\n else if (name.indexOf(prefix) !== 0) {\n throw new Error('(Vim.defineEx) \"' + prefix + '\" is not a prefix of \"' + name + '\", command not registered');\n }\n exCommands[name] = func;\n exCommandDispatcher.commandMap_[prefix] = { name: name, shortName: prefix, type: 'api' };\n },\n handleKey: function (cm, key, origin) {\n var command = this.findKey(cm, key, origin);\n if (typeof command === 'function') {\n return command();\n }\n },\n multiSelectHandleKey: multiSelectHandleKey,\n findKey: function (cm, key, origin) {\n var vim = maybeInitVimState(cm);\n function handleMacroRecording() {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n if (key == 'q') {\n macroModeState.exitMacroRecordMode();\n clearInputState(cm);\n return true;\n }\n if (origin != 'mapping') {\n logKey(macroModeState, key);\n }\n }\n }\n function handleEsc() {\n if (key == '') {\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n else if (vim.insertMode) {\n exitInsertMode(cm);\n }\n else {\n return;\n }\n clearInputState(cm);\n return true;\n }\n }\n function doKeyToKey(keys) {\n var match;\n while (keys) {\n match = (/<\\w+-.+?>|<\\w+>|./).exec(keys);\n key = match[0];\n keys = keys.substring(match.index + key.length);\n vimApi.handleKey(cm, key, 'mapping');\n }\n }\n function handleKeyInsertMode() {\n if (handleEsc()) {\n return true;\n }\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n var keysAreChars = key.length == 1;\n var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n while (keys.length > 1 && match.type != 'full') {\n var keys = vim.inputState.keyBuffer = keys.slice(1);\n var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');\n if (thisMatch.type != 'none') {\n match = thisMatch;\n }\n }\n if (match.type == 'none') {\n clearInputState(cm);\n return false;\n }\n else if (match.type == 'partial') {\n if (lastInsertModeKeyTimer) {\n window.clearTimeout(lastInsertModeKeyTimer);\n }\n lastInsertModeKeyTimer = window.setTimeout(function () { if (vim.insertMode && vim.inputState.keyBuffer) {\n clearInputState(cm);\n } }, getOption('insertModeEscKeysTimeout'));\n return !keysAreChars;\n }\n if (lastInsertModeKeyTimer) {\n window.clearTimeout(lastInsertModeKeyTimer);\n }\n if (keysAreChars) {\n var selections = cm.listSelections();\n for (var i = 0; i < selections.length; i++) {\n var here = selections[i].head;\n cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');\n }\n vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop();\n }\n clearInputState(cm);\n return match.command;\n }\n function handleKeyNonInsertMode() {\n if (handleMacroRecording() || handleEsc()) {\n return true;\n }\n var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;\n if (/^[1-9]\\d*$/.test(keys)) {\n return true;\n }\n var keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (!keysMatcher) {\n clearInputState(cm);\n return false;\n }\n var context = vim.visualMode ? 'visual' :\n 'normal';\n var mainKey = keysMatcher[2] || keysMatcher[1];\n if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) {\n mainKey = vim.inputState.operatorShortcut;\n }\n var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context);\n if (match.type == 'none') {\n clearInputState(cm);\n return false;\n }\n else if (match.type == 'partial') {\n return true;\n }\n else if (match.type == 'clear') {\n clearInputState(cm);\n return true;\n }\n vim.inputState.keyBuffer = '';\n keysMatcher = /^(\\d*)(.*)$/.exec(keys);\n if (keysMatcher[1] && keysMatcher[1] != '0') {\n vim.inputState.pushRepeatDigit(keysMatcher[1]);\n }\n return match.command;\n }\n var command;\n if (vim.insertMode) {\n command = handleKeyInsertMode();\n }\n else {\n command = handleKeyNonInsertMode();\n }\n if (command === false) {\n return undefined; //ace_patch\n }\n else if (command === true) {\n return function () { return true; };\n }\n else {\n return function () {\n if ((command.operator || command.isEdit) && cm.getOption('readOnly'))\n return; // ace_patch\n return cm.operation(function () {\n cm.curOp.isVimOp = true;\n try {\n if (command.type == 'keyToKey') {\n doKeyToKey(command.toKeys);\n }\n else {\n commandDispatcher.processCommand(cm, vim, command);\n }\n }\n catch (e) {\n cm.state.vim = undefined;\n maybeInitVimState(cm);\n if (!vimApi.suppressErrorLogging) {\n console['log'](e);\n }\n throw e;\n }\n return true;\n });\n };\n }\n },\n handleEx: function (cm, input) {\n exCommandDispatcher.processCommand(cm, input);\n },\n defineMotion: defineMotion,\n defineAction: defineAction,\n defineOperator: defineOperator,\n mapCommand: mapCommand,\n _mapCommand: _mapCommand,\n defineRegister: defineRegister,\n exitVisualMode: exitVisualMode,\n exitInsertMode: exitInsertMode\n};\nfunction InputState() {\n this.prefixRepeat = [];\n this.motionRepeat = [];\n this.operator = null;\n this.operatorArgs = null;\n this.motion = null;\n this.motionArgs = null;\n this.keyBuffer = []; // For matching multi-key commands.\n this.registerName = null; // Defaults to the unnamed register.\n}\nInputState.prototype.pushRepeatDigit = function (n) {\n if (!this.operator) {\n this.prefixRepeat = this.prefixRepeat.concat(n);\n }\n else {\n this.motionRepeat = this.motionRepeat.concat(n);\n }\n};\nInputState.prototype.getRepeat = function () {\n var repeat = 0;\n if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) {\n repeat = 1;\n if (this.prefixRepeat.length > 0) {\n repeat *= parseInt(this.prefixRepeat.join(''), 10);\n }\n if (this.motionRepeat.length > 0) {\n repeat *= parseInt(this.motionRepeat.join(''), 10);\n }\n }\n return repeat;\n};\nfunction clearInputState(cm, reason) {\n cm.state.vim.inputState = new InputState();\n CodeMirror.signal(cm, 'vim-command-done', reason);\n}\nfunction Register(text, linewise, blockwise) {\n this.clear();\n this.keyBuffer = [text || ''];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n}\nRegister.prototype = {\n setText: function (text, linewise, blockwise) {\n this.keyBuffer = [text || ''];\n this.linewise = !!linewise;\n this.blockwise = !!blockwise;\n },\n pushText: function (text, linewise) {\n if (linewise) {\n if (!this.linewise) {\n this.keyBuffer.push('\\n');\n }\n this.linewise = true;\n }\n this.keyBuffer.push(text);\n },\n pushInsertModeChanges: function (changes) {\n this.insertModeChanges.push(createInsertModeChanges(changes));\n },\n pushSearchQuery: function (query) {\n this.searchQueries.push(query);\n },\n clear: function () {\n this.keyBuffer = [];\n this.insertModeChanges = [];\n this.searchQueries = [];\n this.linewise = false;\n },\n toString: function () {\n return this.keyBuffer.join('');\n }\n};\nfunction defineRegister(name, register) {\n var registers = vimGlobalState.registerController.registers;\n if (!name || name.length != 1) {\n throw Error('Register name must be 1 character');\n }\n registers[name] = register;\n validRegisters.push(name);\n}\nfunction RegisterController(registers) {\n this.registers = registers;\n this.unnamedRegister = registers['\"'] = new Register();\n registers['.'] = new Register();\n registers[':'] = new Register();\n registers['/'] = new Register();\n registers['+'] = new Register();\n}\nRegisterController.prototype = {\n pushText: function (registerName, operator, text, linewise, blockwise) {\n if (registerName === '_')\n return;\n if (linewise && text.charAt(text.length - 1) !== '\\n') {\n text += '\\n';\n }\n var register = this.isValidRegister(registerName) ?\n this.getRegister(registerName) : null;\n if (!register) {\n switch (operator) {\n case 'yank':\n this.registers['0'] = new Register(text, linewise, blockwise);\n break;\n case 'delete':\n case 'change':\n if (text.indexOf('\\n') == -1) {\n this.registers['-'] = new Register(text, linewise);\n }\n else {\n this.shiftNumericRegisters_();\n this.registers['1'] = new Register(text, linewise);\n }\n break;\n }\n this.unnamedRegister.setText(text, linewise, blockwise);\n return;\n }\n var append = isUpperCase(registerName);\n if (append) {\n register.pushText(text, linewise);\n }\n else {\n register.setText(text, linewise, blockwise);\n }\n if (registerName === '+') {\n navigator.clipboard.writeText(text);\n }\n this.unnamedRegister.setText(register.toString(), linewise);\n },\n getRegister: function (name) {\n if (!this.isValidRegister(name)) {\n return this.unnamedRegister;\n }\n name = name.toLowerCase();\n if (!this.registers[name]) {\n this.registers[name] = new Register();\n }\n return this.registers[name];\n },\n isValidRegister: function (name) {\n return name && inArray(name, validRegisters);\n },\n shiftNumericRegisters_: function () {\n for (var i = 9; i >= 2; i--) {\n this.registers[i] = this.getRegister('' + (i - 1));\n }\n }\n};\nfunction HistoryController() {\n this.historyBuffer = [];\n this.iterator = 0;\n this.initialPrefix = null;\n}\nHistoryController.prototype = {\n nextMatch: function (input, up) {\n var historyBuffer = this.historyBuffer;\n var dir = up ? -1 : 1;\n if (this.initialPrefix === null)\n this.initialPrefix = input;\n for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i += dir) {\n var element = historyBuffer[i];\n for (var j = 0; j <= element.length; j++) {\n if (this.initialPrefix == element.substring(0, j)) {\n this.iterator = i;\n return element;\n }\n }\n }\n if (i >= historyBuffer.length) {\n this.iterator = historyBuffer.length;\n return this.initialPrefix;\n }\n if (i < 0)\n return input;\n },\n pushInput: function (input) {\n var index = this.historyBuffer.indexOf(input);\n if (index > -1)\n this.historyBuffer.splice(index, 1);\n if (input.length)\n this.historyBuffer.push(input);\n },\n reset: function () {\n this.initialPrefix = null;\n this.iterator = this.historyBuffer.length;\n }\n};\nvar commandDispatcher = {\n matchCommand: function (keys, keyMap, inputState, context) {\n var matches = commandMatches(keys, keyMap, context, inputState);\n if (!matches.full && !matches.partial) {\n return { type: 'none' };\n }\n else if (!matches.full && matches.partial) {\n return { type: 'partial' };\n }\n var bestMatch;\n for (var i = 0; i < matches.full.length; i++) {\n var match = matches.full[i];\n if (!bestMatch) {\n bestMatch = match;\n }\n }\n if (bestMatch.keys.slice(-11) == '') {\n var character = lastChar(keys);\n if (!character || character.length > 1)\n return { type: 'clear' };\n inputState.selectedCharacter = character;\n }\n return { type: 'full', command: bestMatch };\n },\n processCommand: function (cm, vim, command) {\n vim.inputState.repeatOverride = command.repeatOverride;\n switch (command.type) {\n case 'motion':\n this.processMotion(cm, vim, command);\n break;\n case 'operator':\n this.processOperator(cm, vim, command);\n break;\n case 'operatorMotion':\n this.processOperatorMotion(cm, vim, command);\n break;\n case 'action':\n this.processAction(cm, vim, command);\n break;\n case 'search':\n this.processSearch(cm, vim, command);\n break;\n case 'ex':\n case 'keyToEx':\n this.processEx(cm, vim, command);\n break;\n default:\n break;\n }\n },\n processMotion: function (cm, vim, command) {\n vim.inputState.motion = command.motion;\n vim.inputState.motionArgs = copyArgs(command.motionArgs);\n this.evalInput(cm, vim);\n },\n processOperator: function (cm, vim, command) {\n var inputState = vim.inputState;\n if (inputState.operator) {\n if (inputState.operator == command.operator) {\n inputState.motion = 'expandToLine';\n inputState.motionArgs = { linewise: true };\n this.evalInput(cm, vim);\n return;\n }\n else {\n clearInputState(cm);\n }\n }\n inputState.operator = command.operator;\n inputState.operatorArgs = copyArgs(command.operatorArgs);\n if (command.keys.length > 1) {\n inputState.operatorShortcut = command.keys;\n }\n if (command.exitVisualBlock) {\n vim.visualBlock = false;\n updateCmSelection(cm);\n }\n if (vim.visualMode) {\n this.evalInput(cm, vim);\n }\n },\n processOperatorMotion: function (cm, vim, command) {\n var visualMode = vim.visualMode;\n var operatorMotionArgs = copyArgs(command.operatorMotionArgs);\n if (operatorMotionArgs) {\n if (visualMode && operatorMotionArgs.visualLine) {\n vim.visualLine = true;\n }\n }\n this.processOperator(cm, vim, command);\n if (!visualMode) {\n this.processMotion(cm, vim, command);\n }\n },\n processAction: function (cm, vim, command) {\n var inputState = vim.inputState;\n var repeat = inputState.getRepeat();\n var repeatIsExplicit = !!repeat;\n var actionArgs = copyArgs(command.actionArgs) || {};\n if (inputState.selectedCharacter) {\n actionArgs.selectedCharacter = inputState.selectedCharacter;\n }\n if (command.operator) {\n this.processOperator(cm, vim, command);\n }\n if (command.motion) {\n this.processMotion(cm, vim, command);\n }\n if (command.motion || command.operator) {\n this.evalInput(cm, vim);\n }\n actionArgs.repeat = repeat || 1;\n actionArgs.repeatIsExplicit = repeatIsExplicit;\n actionArgs.registerName = inputState.registerName;\n clearInputState(cm);\n vim.lastMotion = null;\n if (command.isEdit) {\n this.recordLastEdit(vim, inputState, command);\n }\n actions[command.action](cm, actionArgs, vim);\n },\n processSearch: function (cm, vim, command) {\n if (!cm.getSearchCursor) {\n return;\n }\n var forward = command.searchArgs.forward;\n var wholeWordOnly = command.searchArgs.wholeWordOnly;\n getSearchState(cm).setReversed(!forward);\n var promptPrefix = (forward) ? '/' : '?';\n var originalQuery = getSearchState(cm).getQuery();\n var originalScrollPos = cm.getScrollInfo();\n function handleQuery(query, ignoreCase, smartCase) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n try {\n updateSearchQuery(cm, query, ignoreCase, smartCase);\n }\n catch (e) {\n showConfirm(cm, 'Invalid regex: ' + query);\n clearInputState(cm);\n return;\n }\n commandDispatcher.processMotion(cm, vim, {\n type: 'motion',\n motion: 'findNext',\n motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist }\n });\n }\n function onPromptClose(query) {\n handleQuery(query, true /** ignoreCase */, true /** smartCase */);\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isRecording) {\n logSearchQuery(macroModeState, query);\n }\n }\n function onPromptKeyUp(e, query, close) {\n var keyName = CodeMirror.keyName(e), up, offset;\n if (keyName == 'Up' || keyName == 'Down') {\n up = keyName == 'Up' ? true : false;\n offset = e.target ? e.target.selectionEnd : 0;\n query = vimGlobalState.searchHistoryController.nextMatch(query, up) || '';\n close(query);\n if (offset && e.target)\n e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);\n }\n else {\n if (keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.searchHistoryController.reset();\n }\n var parsedQuery;\n try {\n parsedQuery = updateSearchQuery(cm, query, true /** ignoreCase */, true /** smartCase */);\n }\n catch (e) {\n }\n if (parsedQuery) {\n cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30);\n }\n else {\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n }\n }\n function onPromptKeyDown(e, query, close) {\n var keyName = CodeMirror.keyName(e);\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && query == '')) {\n vimGlobalState.searchHistoryController.pushInput(query);\n vimGlobalState.searchHistoryController.reset();\n updateSearchQuery(cm, originalQuery);\n clearSearchHighlight(cm);\n cm.scrollTo(originalScrollPos.left, originalScrollPos.top);\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n }\n else if (keyName == 'Up' || keyName == 'Down') {\n CodeMirror.e_stop(e);\n }\n else if (keyName == 'Ctrl-U') {\n CodeMirror.e_stop(e);\n close('');\n }\n }\n switch (command.searchArgs.querySrc) {\n case 'prompt':\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n var query = macroModeState.replaySearchQueries.shift();\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n }\n else {\n showPrompt(cm, {\n onClose: onPromptClose,\n prefix: promptPrefix,\n desc: '(JavaScript regexp)',\n onKeyUp: onPromptKeyUp,\n onKeyDown: onPromptKeyDown\n });\n }\n break;\n case 'wordUnderCursor':\n var word = expandWordUnderCursor(cm, false /** inclusive */, true /** forward */, false /** bigWord */, true /** noSymbol */);\n var isKeyword = true;\n if (!word) {\n word = expandWordUnderCursor(cm, false /** inclusive */, true /** forward */, false /** bigWord */, false /** noSymbol */);\n isKeyword = false;\n }\n if (!word) {\n return;\n }\n var query = cm.getLine(word.start.line).substring(word.start.ch, word.end.ch);\n if (isKeyword && wholeWordOnly) {\n query = '\\\\b' + query + '\\\\b';\n }\n else {\n query = escapeRegex(query);\n }\n vimGlobalState.jumpList.cachedCursor = cm.getCursor();\n cm.setCursor(word.start);\n handleQuery(query, true /** ignoreCase */, false /** smartCase */);\n break;\n }\n },\n processEx: function (cm, vim, command) {\n function onPromptClose(input) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n exCommandDispatcher.processCommand(cm, input);\n if (cm.state.vim)\n clearInputState(cm);\n }\n function onPromptKeyDown(e, input, close) {\n var keyName = CodeMirror.keyName(e), up, offset;\n if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||\n (keyName == 'Backspace' && input == '')) {\n vimGlobalState.exCommandHistoryController.pushInput(input);\n vimGlobalState.exCommandHistoryController.reset();\n CodeMirror.e_stop(e);\n clearInputState(cm);\n close();\n cm.focus();\n }\n if (keyName == 'Up' || keyName == 'Down') {\n CodeMirror.e_stop(e);\n up = keyName == 'Up' ? true : false;\n offset = e.target ? e.target.selectionEnd : 0;\n input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || '';\n close(input);\n if (offset && e.target)\n e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);\n }\n else if (keyName == 'Ctrl-U') {\n CodeMirror.e_stop(e);\n close('');\n }\n else {\n if (keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')\n vimGlobalState.exCommandHistoryController.reset();\n }\n }\n if (command.type == 'keyToEx') {\n exCommandDispatcher.processCommand(cm, command.exArgs.input);\n }\n else {\n if (vim.visualMode) {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\\'<,\\'>',\n onKeyDown: onPromptKeyDown, selectValueOnOpen: false });\n }\n else {\n showPrompt(cm, { onClose: onPromptClose, prefix: ':',\n onKeyDown: onPromptKeyDown });\n }\n }\n },\n evalInput: function (cm, vim) {\n var inputState = vim.inputState;\n var motion = inputState.motion;\n var motionArgs = inputState.motionArgs || {};\n var operator = inputState.operator;\n var operatorArgs = inputState.operatorArgs || {};\n var registerName = inputState.registerName;\n var sel = vim.sel;\n var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head) : cm.getCursor('head'));\n var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor'));\n var oldHead = copyCursor(origHead);\n var oldAnchor = copyCursor(origAnchor);\n var newHead, newAnchor;\n var repeat;\n if (operator) {\n this.recordLastEdit(vim, inputState);\n }\n if (inputState.repeatOverride !== undefined) {\n repeat = inputState.repeatOverride;\n }\n else {\n repeat = inputState.getRepeat();\n }\n if (repeat > 0 && motionArgs.explicitRepeat) {\n motionArgs.repeatIsExplicit = true;\n }\n else if (motionArgs.noRepeat ||\n (!motionArgs.explicitRepeat && repeat === 0)) {\n repeat = 1;\n motionArgs.repeatIsExplicit = false;\n }\n if (inputState.selectedCharacter) {\n motionArgs.selectedCharacter = operatorArgs.selectedCharacter =\n inputState.selectedCharacter;\n }\n motionArgs.repeat = repeat;\n clearInputState(cm);\n if (motion) {\n var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState);\n vim.lastMotion = motions[motion];\n if (!motionResult) {\n return;\n }\n if (motionArgs.toJumplist) {\n if (!operator && cm.ace.curOp != null)\n cm.ace.curOp.command.scrollIntoView = \"center-animate\"; // ace_patch\n var jumpList = vimGlobalState.jumpList;\n var cachedCursor = jumpList.cachedCursor;\n if (cachedCursor) {\n recordJumpPosition(cm, cachedCursor, motionResult);\n delete jumpList.cachedCursor;\n }\n else {\n recordJumpPosition(cm, origHead, motionResult);\n }\n }\n if (motionResult instanceof Array) {\n newAnchor = motionResult[0];\n newHead = motionResult[1];\n }\n else {\n newHead = motionResult;\n }\n if (!newHead) {\n newHead = copyCursor(origHead);\n }\n if (vim.visualMode) {\n if (!(vim.visualBlock && newHead.ch === Infinity)) {\n newHead = clipCursorToContent(cm, newHead, oldHead);\n }\n if (newAnchor) {\n newAnchor = clipCursorToContent(cm, newAnchor);\n }\n newAnchor = newAnchor || oldAnchor;\n sel.anchor = newAnchor;\n sel.head = newHead;\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorIsBefore(newAnchor, newHead) ? newAnchor\n : newHead);\n updateMark(cm, vim, '>', cursorIsBefore(newAnchor, newHead) ? newHead\n : newAnchor);\n }\n else if (!operator) {\n if (cm.ace.curOp)\n cm.ace.curOp.vimDialogScroll = \"center-animate\"; // ace_patch\n newHead = clipCursorToContent(cm, newHead, oldHead);\n cm.setCursor(newHead.line, newHead.ch);\n }\n }\n if (operator) {\n if (operatorArgs.lastSel) {\n newAnchor = oldAnchor;\n var lastSel = operatorArgs.lastSel;\n var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line);\n var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);\n if (lastSel.visualLine) {\n newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n }\n else if (lastSel.visualBlock) {\n newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);\n }\n else if (lastSel.head.line == lastSel.anchor.line) {\n newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset);\n }\n else {\n newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);\n }\n vim.visualMode = true;\n vim.visualLine = lastSel.visualLine;\n vim.visualBlock = lastSel.visualBlock;\n sel = vim.sel = {\n anchor: newAnchor,\n head: newHead\n };\n updateCmSelection(cm);\n }\n else if (vim.visualMode) {\n operatorArgs.lastSel = {\n anchor: copyCursor(sel.anchor),\n head: copyCursor(sel.head),\n visualBlock: vim.visualBlock,\n visualLine: vim.visualLine\n };\n }\n var curStart, curEnd, linewise, mode;\n var cmSel;\n if (vim.visualMode) {\n curStart = cursorMin(sel.head, sel.anchor);\n curEnd = cursorMax(sel.head, sel.anchor);\n linewise = vim.visualLine || operatorArgs.linewise;\n mode = vim.visualBlock ? 'block' :\n linewise ? 'line' :\n 'char';\n var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd);\n cmSel = makeCmSelection(cm, {\n anchor: newPositions.start,\n head: newPositions.end\n }, mode);\n if (linewise) {\n var ranges = cmSel.ranges;\n if (mode == 'block') {\n for (var i = 0; i < ranges.length; i++) {\n ranges[i].head.ch = lineLength(cm, ranges[i].head.line);\n }\n }\n else if (mode == 'line') {\n ranges[0].head = new Pos(ranges[0].head.line + 1, 0);\n }\n }\n }\n else {\n curStart = copyCursor(newAnchor || oldAnchor);\n curEnd = copyCursor(newHead || oldHead);\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curStart;\n curStart = curEnd;\n curEnd = tmp;\n }\n linewise = motionArgs.linewise || operatorArgs.linewise;\n if (linewise) {\n expandSelectionToLine(cm, curStart, curEnd);\n }\n else if (motionArgs.forward) {\n clipToLine(cm, curStart, curEnd);\n }\n mode = 'char';\n var exclusive = !motionArgs.inclusive || linewise;\n var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd);\n cmSel = makeCmSelection(cm, {\n anchor: newPositions.start,\n head: newPositions.end\n }, mode, exclusive);\n }\n cm.setSelections(cmSel.ranges, cmSel.primary);\n vim.lastMotion = null;\n operatorArgs.repeat = repeat; // For indent in visual mode.\n operatorArgs.registerName = registerName;\n operatorArgs.linewise = linewise;\n var operatorMoveTo = operators[operator](cm, operatorArgs, cmSel.ranges, oldAnchor, newHead);\n if (vim.visualMode) {\n exitVisualMode(cm, operatorMoveTo != null);\n }\n if (operatorMoveTo) {\n cm.setCursor(operatorMoveTo);\n }\n }\n },\n recordLastEdit: function (vim, inputState, actionCommand) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n return;\n }\n vim.lastEditInputState = inputState;\n vim.lastEditActionCommand = actionCommand;\n macroModeState.lastInsertModeChanges.changes = [];\n macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;\n macroModeState.lastInsertModeChanges.visualBlock = vim.visualBlock ? vim.sel.head.line - vim.sel.anchor.line : 0;\n }\n};\nvar motions = {\n moveToTopLine: function (cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).top + motionArgs.repeat - 1;\n return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToMiddleLine: function (cm) {\n var range = getUserVisibleLines(cm);\n var line = Math.floor((range.top + range.bottom) * 0.5);\n return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n moveToBottomLine: function (cm, _head, motionArgs) {\n var line = getUserVisibleLines(cm).bottom - motionArgs.repeat + 1;\n return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));\n },\n expandToLine: function (_cm, head, motionArgs) {\n var cur = head;\n return new Pos(cur.line + motionArgs.repeat - 1, Infinity);\n },\n findNext: function (cm, _head, motionArgs) {\n var state = getSearchState(cm);\n var query = state.getQuery();\n if (!query) {\n return;\n }\n var prev = !motionArgs.forward;\n prev = (state.isReversed()) ? !prev : prev;\n highlightSearchMatches(cm, query);\n return findNext(cm, prev /** prev */, query, motionArgs.repeat);\n },\n findAndSelectNextInclusive: function (cm, _head, motionArgs, vim, prevInputState) {\n var state = getSearchState(cm);\n var query = state.getQuery();\n if (!query) {\n return;\n }\n var prev = !motionArgs.forward;\n prev = (state.isReversed()) ? !prev : prev;\n var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim);\n if (!next) {\n return;\n }\n if (prevInputState.operator) {\n return next;\n }\n var from = next[0];\n var to = new Pos(next[1].line, next[1].ch - 1);\n if (vim.visualMode) {\n if (vim.visualLine || vim.visualBlock) {\n vim.visualLine = false;\n vim.visualBlock = false;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: \"\" });\n }\n var anchor = vim.sel.anchor;\n if (anchor) {\n if (state.isReversed()) {\n if (motionArgs.forward) {\n return [anchor, from];\n }\n return [anchor, to];\n }\n else {\n if (motionArgs.forward) {\n return [anchor, to];\n }\n return [anchor, from];\n }\n }\n }\n else {\n vim.visualMode = true;\n vim.visualLine = false;\n vim.visualBlock = false;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: \"\" });\n }\n return prev ? [to, from] : [from, to];\n },\n goToMark: function (cm, _head, motionArgs, vim) {\n var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter);\n if (pos) {\n return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos;\n }\n return null;\n },\n moveToOtherHighlightedEnd: function (cm, _head, motionArgs, vim) {\n if (vim.visualBlock && motionArgs.sameLine) {\n var sel = vim.sel;\n return [\n clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)),\n clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch))\n ];\n }\n else {\n return ([vim.sel.head, vim.sel.anchor]);\n }\n },\n jumpToMark: function (cm, head, motionArgs, vim) {\n var best = head;\n for (var i = 0; i < motionArgs.repeat; i++) {\n var cursor = best;\n for (var key in vim.marks) {\n if (!isLowerCase(key)) {\n continue;\n }\n var mark = vim.marks[key].find();\n var isWrongDirection = (motionArgs.forward) ?\n cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark);\n if (isWrongDirection) {\n continue;\n }\n if (motionArgs.linewise && (mark.line == cursor.line)) {\n continue;\n }\n var equal = cursorEqual(cursor, best);\n var between = (motionArgs.forward) ?\n cursorIsBetween(cursor, mark, best) :\n cursorIsBetween(best, mark, cursor);\n if (equal || between) {\n best = mark;\n }\n }\n }\n if (motionArgs.linewise) {\n best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));\n }\n return best;\n },\n moveByCharacters: function (_cm, head, motionArgs) {\n var cur = head;\n var repeat = motionArgs.repeat;\n var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat;\n return new Pos(cur.line, ch);\n },\n moveByLines: function (cm, head, motionArgs, vim) {\n var cur = head;\n var endCh = cur.ch;\n switch (vim.lastMotion) {\n case this.moveByLines:\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveToColumn:\n case this.moveToEol:\n endCh = vim.lastHPos;\n break;\n default:\n vim.lastHPos = endCh;\n }\n var repeat = motionArgs.repeat + (motionArgs.repeatOffset || 0);\n var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;\n var first = cm.firstLine();\n var last = cm.lastLine();\n if (line < first && cur.line == first) {\n return this.moveToStartOfLine(cm, head, motionArgs, vim);\n }\n else if (line > last && cur.line == last) {\n return moveToEol(cm, head, motionArgs, vim, true);\n }\n var fold = cm.ace.session.getFoldLine(line);\n if (fold) {\n if (motionArgs.forward) {\n if (line > fold.start.row)\n line = fold.end.row + 1;\n }\n else {\n line = fold.start.row;\n }\n }\n if (motionArgs.toFirstChar) {\n endCh = findFirstNonWhiteSpaceCharacter(cm.getLine(line));\n vim.lastHPos = endCh;\n }\n vim.lastHSPos = cm.charCoords(new Pos(line, endCh), 'div').left;\n return new Pos(line, endCh);\n },\n moveByDisplayLines: function (cm, head, motionArgs, vim) {\n var cur = head;\n switch (vim.lastMotion) {\n case this.moveByDisplayLines:\n case this.moveByScroll:\n case this.moveByLines:\n case this.moveToColumn:\n case this.moveToEol:\n break;\n default:\n vim.lastHSPos = cm.charCoords(cur, 'div').left;\n }\n var repeat = motionArgs.repeat;\n var res = cm.findPosV(cur, (motionArgs.forward ? repeat : -repeat), 'line', vim.lastHSPos);\n if (res.hitSide) {\n if (motionArgs.forward) {\n var lastCharCoords = cm.charCoords(res, 'div');\n var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };\n var res = cm.coordsChar(goalCoords, 'div');\n }\n else {\n var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div');\n resCoords.left = vim.lastHSPos;\n res = cm.coordsChar(resCoords, 'div');\n }\n }\n vim.lastHPos = res.ch;\n return res;\n },\n moveByPage: function (cm, head, motionArgs) {\n var curStart = head;\n var repeat = motionArgs.repeat;\n return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page');\n },\n moveByParagraph: function (cm, head, motionArgs) {\n var dir = motionArgs.forward ? 1 : -1;\n return findParagraph(cm, head, motionArgs.repeat, dir);\n },\n moveBySentence: function (cm, head, motionArgs) {\n var dir = motionArgs.forward ? 1 : -1;\n return findSentence(cm, head, motionArgs.repeat, dir);\n },\n moveByScroll: function (cm, head, motionArgs, vim) {\n var scrollbox = cm.getScrollInfo();\n var curEnd = null;\n var repeat = motionArgs.repeat;\n if (!repeat) {\n repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight());\n }\n var orig = cm.charCoords(head, 'local');\n motionArgs.repeat = repeat;\n curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim);\n if (!curEnd) {\n return null;\n }\n var dest = cm.charCoords(curEnd, 'local');\n cm.scrollTo(null, scrollbox.top + dest.top - orig.top);\n return curEnd;\n },\n moveByWords: function (cm, head, motionArgs) {\n return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward, !!motionArgs.wordEnd, !!motionArgs.bigWord);\n },\n moveTillCharacter: function (cm, _head, motionArgs) {\n var repeat = motionArgs.repeat;\n var curEnd = moveToCharacter(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter);\n var increment = motionArgs.forward ? -1 : 1;\n recordLastCharacterSearch(increment, motionArgs);\n if (!curEnd)\n return null;\n curEnd.ch += increment;\n return curEnd;\n },\n moveToCharacter: function (cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n recordLastCharacterSearch(0, motionArgs);\n return moveToCharacter(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter) || head;\n },\n moveToSymbol: function (cm, head, motionArgs) {\n var repeat = motionArgs.repeat;\n return findSymbol(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter) || head;\n },\n moveToColumn: function (cm, head, motionArgs, vim) {\n var repeat = motionArgs.repeat;\n vim.lastHPos = repeat - 1;\n vim.lastHSPos = cm.charCoords(head, 'div').left;\n return moveToColumn(cm, repeat);\n },\n moveToEol: function (cm, head, motionArgs, vim) {\n return moveToEol(cm, head, motionArgs, vim, false);\n },\n moveToFirstNonWhiteSpaceCharacter: function (cm, head) {\n var cursor = head;\n return new Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));\n },\n moveToMatchedSymbol: function (cm, head) {\n var cursor = head;\n var line = cursor.line;\n var ch = cursor.ch;\n var lineText = cm.getLine(line);\n var symbol;\n for (; ch < lineText.length; ch++) {\n symbol = lineText.charAt(ch);\n if (symbol && isMatchableSymbol(symbol)) {\n var style = cm.getTokenTypeAt(new Pos(line, ch + 1));\n if (style !== \"string\" && style !== \"comment\") {\n break;\n }\n }\n }\n if (ch < lineText.length) {\n var re = /[<>]/.test(lineText[ch]) ? /[(){}[\\]<>]/ : /[(){}[\\]]/; //ace_patch?\n var matched = cm.findMatchingBracket(new Pos(line, ch + 1), { bracketRegex: re });\n return matched.to;\n }\n else {\n return cursor;\n }\n },\n moveToStartOfLine: function (_cm, head) {\n return new Pos(head.line, 0);\n },\n moveToLineOrEdgeOfDocument: function (cm, _head, motionArgs) {\n var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();\n if (motionArgs.repeatIsExplicit) {\n lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');\n }\n return new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));\n },\n moveToStartOfDisplayLine: function (cm) {\n cm.execCommand(\"goLineLeft\");\n return cm.getCursor();\n },\n moveToEndOfDisplayLine: function (cm) {\n cm.execCommand(\"goLineRight\");\n var head = cm.getCursor();\n if (head.sticky == \"before\")\n head.ch--;\n return head;\n },\n textObjectManipulation: function (cm, head, motionArgs, vim) {\n var mirroredPairs = { '(': ')', ')': '(',\n '{': '}', '}': '{',\n '[': ']', ']': '[',\n '<': '>', '>': '<' };\n var selfPaired = { '\\'': true, '\"': true, '`': true };\n var character = motionArgs.selectedCharacter;\n if (character == 'b') {\n character = '(';\n }\n else if (character == 'B') {\n character = '{';\n }\n var inclusive = !motionArgs.textObjectInner;\n var tmp;\n if (mirroredPairs[character]) {\n tmp = selectCompanionObject(cm, head, character, inclusive);\n }\n else if (selfPaired[character]) {\n tmp = findBeginningAndEnd(cm, head, character, inclusive);\n }\n else if (character === 'W') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, true /** bigWord */);\n }\n else if (character === 'w') {\n tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, false /** bigWord */);\n }\n else if (character === 'p') {\n tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive);\n motionArgs.linewise = true;\n if (vim.visualMode) {\n if (!vim.visualLine) {\n vim.visualLine = true;\n }\n }\n else {\n var operatorArgs = vim.inputState.operatorArgs;\n if (operatorArgs) {\n operatorArgs.linewise = true;\n }\n tmp.end.line--;\n }\n }\n else if (character === 't') {\n tmp = expandTagUnderCursor(cm, head, inclusive);\n }\n else if (character === 's') {\n var content = cm.getLine(head.line);\n if (head.ch > 0 && isEndOfSentenceSymbol(content[head.ch])) {\n head.ch -= 1;\n }\n var end = getSentence(cm, head, motionArgs.repeat, 1, inclusive);\n var start = getSentence(cm, head, motionArgs.repeat, -1, inclusive);\n if (isWhiteSpaceString(cm.getLine(start.line)[start.ch])\n && isWhiteSpaceString(cm.getLine(end.line)[end.ch - 1])) {\n start = { line: start.line, ch: start.ch + 1 };\n }\n tmp = { start: start, end: end };\n }\n else {\n return null;\n }\n if (!cm.state.vim.visualMode) {\n return [tmp.start, tmp.end];\n }\n else {\n return expandSelection(cm, tmp.start, tmp.end);\n }\n },\n repeatLastCharacterSearch: function (cm, head, motionArgs) {\n var lastSearch = vimGlobalState.lastCharacterSearch;\n var repeat = motionArgs.repeat;\n var forward = motionArgs.forward === lastSearch.forward;\n var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);\n cm.moveH(-increment, 'char');\n motionArgs.inclusive = forward ? true : false;\n var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter);\n if (!curEnd) {\n cm.moveH(increment, 'char');\n return head;\n }\n curEnd.ch += increment;\n return curEnd;\n }\n};\nfunction defineMotion(name, fn) {\n motions[name] = fn;\n}\nfunction fillArray(val, times) {\n var arr = [];\n for (var i = 0; i < times; i++) {\n arr.push(val);\n }\n return arr;\n}\nvar operators = {\n change: function (cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n var anchor = ranges[0].anchor, head = ranges[0].head;\n if (!vim.visualMode) {\n text = cm.getRange(anchor, head);\n var lastState = vim.lastEditInputState || {};\n if (lastState.motion == \"moveByWords\" && !isWhiteSpaceString(text)) {\n var match = (/\\s+$/).exec(text);\n if (match && lastState.motionArgs && lastState.motionArgs.forward) {\n head = offsetCursor(head, 0, -match[0].length);\n text = text.slice(0, -match[0].length);\n }\n }\n var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE);\n var wasLastLine = cm.firstLine() == cm.lastLine();\n if (head.line > cm.lastLine() && args.linewise && !wasLastLine) {\n cm.replaceRange('', prevLineEnd, head);\n }\n else {\n cm.replaceRange('', anchor, head);\n }\n if (args.linewise) {\n if (!wasLastLine) {\n cm.setCursor(prevLineEnd);\n CodeMirror.commands.newlineAndIndent(cm);\n }\n anchor.ch = Number.MAX_VALUE;\n }\n finalHead = anchor;\n }\n else if (args.fullLine) {\n head.ch = Number.MAX_VALUE;\n head.line--;\n cm.setSelection(anchor, head);\n text = cm.getSelection();\n cm.replaceSelection(\"\");\n finalHead = anchor;\n }\n else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = cursorMin(ranges[0].head, ranges[0].anchor);\n }\n vimGlobalState.registerController.pushText(args.registerName, 'change', text, args.linewise, ranges.length > 1);\n actions.enterInsertMode(cm, { head: finalHead }, cm.state.vim);\n },\n 'delete': function (cm, args, ranges) {\n var finalHead, text;\n var vim = cm.state.vim;\n if (!vim.visualBlock) {\n var anchor = ranges[0].anchor, head = ranges[0].head;\n if (args.linewise &&\n head.line != cm.firstLine() &&\n anchor.line == cm.lastLine() &&\n anchor.line == head.line - 1) {\n if (anchor.line == cm.firstLine()) {\n anchor.ch = 0;\n }\n else {\n anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));\n }\n }\n text = cm.getRange(anchor, head);\n cm.replaceRange('', anchor, head);\n finalHead = anchor;\n if (args.linewise) {\n finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor);\n }\n }\n else {\n text = cm.getSelection();\n var replacement = fillArray('', ranges.length);\n cm.replaceSelections(replacement);\n finalHead = cursorMin(ranges[0].head, ranges[0].anchor);\n }\n vimGlobalState.registerController.pushText(args.registerName, 'delete', text, args.linewise, vim.visualBlock);\n return clipCursorToContent(cm, finalHead);\n },\n indent: function (cm, args, ranges) {\n var vim = cm.state.vim;\n if (cm.indentMore) {\n var repeat = (vim.visualMode) ? args.repeat : 1;\n for (var j = 0; j < repeat; j++) {\n if (args.indentRight)\n cm.indentMore();\n else\n cm.indentLess();\n }\n }\n else {\n var startLine = ranges[0].anchor.line;\n var endLine = vim.visualBlock ?\n ranges[ranges.length - 1].anchor.line :\n ranges[0].head.line;\n var repeat = (vim.visualMode) ? args.repeat : 1;\n if (args.linewise) {\n endLine--;\n }\n for (var i = startLine; i <= endLine; i++) {\n for (var j = 0; j < repeat; j++) {\n cm.indentLine(i, args.indentRight);\n }\n }\n }\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);\n },\n indentAuto: function (cm, _args, ranges) {\n if (ranges.length > 1) { // ace_patch\n cm.setSelection(ranges[0].anchor, ranges[ranges.length - 1].head);\n }\n cm.execCommand(\"indentAuto\");\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);\n },\n changeCase: function (cm, args, ranges, oldAnchor, newHead) {\n var selections = cm.getSelections();\n var swapped = [];\n var toLower = args.toLower;\n for (var j = 0; j < selections.length; j++) {\n var toSwap = selections[j];\n var text = '';\n if (toLower === true) {\n text = toSwap.toLowerCase();\n }\n else if (toLower === false) {\n text = toSwap.toUpperCase();\n }\n else {\n for (var i = 0; i < toSwap.length; i++) {\n var character = toSwap.charAt(i);\n text += isUpperCase(character) ? character.toLowerCase() :\n character.toUpperCase();\n }\n }\n swapped.push(text);\n }\n cm.replaceSelections(swapped);\n if (args.shouldMoveCursor) {\n return newHead;\n }\n else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) {\n return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor);\n }\n else if (args.linewise) {\n return oldAnchor;\n }\n else {\n return cursorMin(ranges[0].anchor, ranges[0].head);\n }\n },\n yank: function (cm, args, ranges, oldAnchor) {\n var vim = cm.state.vim;\n var text = cm.getSelection();\n var endPos = vim.visualMode\n ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor)\n : oldAnchor;\n vimGlobalState.registerController.pushText(args.registerName, 'yank', text, args.linewise, vim.visualBlock);\n return endPos;\n }\n};\nfunction defineOperator(name, fn) {\n operators[name] = fn;\n}\nvar actions = {\n jumpListWalk: function (cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat;\n var forward = actionArgs.forward;\n var jumpList = vimGlobalState.jumpList;\n var mark = jumpList.move(cm, forward ? repeat : -repeat);\n var markPos = mark ? mark.find() : undefined;\n markPos = markPos ? markPos : cm.getCursor();\n cm.setCursor(markPos);\n cm.ace.curOp.command.scrollIntoView = \"center-animate\"; // ace_patch\n },\n scroll: function (cm, actionArgs, vim) {\n if (vim.visualMode) {\n return;\n }\n var repeat = actionArgs.repeat || 1;\n var lineHeight = cm.defaultTextHeight();\n var top = cm.getScrollInfo().top;\n var delta = lineHeight * repeat;\n var newPos = actionArgs.forward ? top + delta : top - delta;\n var cursor = copyCursor(cm.getCursor());\n var cursorCoords = cm.charCoords(cursor, 'local');\n if (actionArgs.forward) {\n if (newPos > cursorCoords.top) {\n cursor.line += (newPos - cursorCoords.top) / lineHeight;\n cursor.line = Math.ceil(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(null, cursorCoords.top);\n }\n else {\n cm.scrollTo(null, newPos);\n }\n }\n else {\n var newBottom = newPos + cm.getScrollInfo().clientHeight;\n if (newBottom < cursorCoords.bottom) {\n cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight;\n cursor.line = Math.floor(cursor.line);\n cm.setCursor(cursor);\n cursorCoords = cm.charCoords(cursor, 'local');\n cm.scrollTo(null, cursorCoords.bottom - cm.getScrollInfo().clientHeight);\n }\n else {\n cm.scrollTo(null, newPos);\n }\n }\n },\n scrollToCursor: function (cm, actionArgs) {\n var lineNum = cm.getCursor().line;\n var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local');\n var height = cm.getScrollInfo().clientHeight;\n var y = charCoords.top;\n switch (actionArgs.position) {\n case 'center':\n y = charCoords.bottom - height / 2;\n break;\n case 'bottom':\n var lineLastCharPos = new Pos(lineNum, cm.getLine(lineNum).length - 1);\n var lineLastCharCoords = cm.charCoords(lineLastCharPos, 'local');\n var lineHeight = lineLastCharCoords.bottom - y;\n y = y - height + lineHeight;\n break;\n }\n cm.scrollTo(null, y);\n },\n replayMacro: function (cm, actionArgs, vim) {\n var registerName = actionArgs.selectedCharacter;\n var repeat = actionArgs.repeat;\n var macroModeState = vimGlobalState.macroModeState;\n if (registerName == '@') {\n registerName = macroModeState.latestRegister;\n }\n else {\n macroModeState.latestRegister = registerName;\n }\n while (repeat--) {\n executeMacroRegister(cm, vim, macroModeState, registerName);\n }\n },\n enterMacroRecordMode: function (cm, actionArgs) {\n var macroModeState = vimGlobalState.macroModeState;\n var registerName = actionArgs.selectedCharacter;\n if (vimGlobalState.registerController.isValidRegister(registerName)) {\n macroModeState.enterMacroRecordMode(cm, registerName);\n }\n },\n toggleOverwrite: function (cm) {\n if (!cm.state.overwrite) {\n cm.toggleOverwrite(true);\n cm.setOption('keyMap', 'vim-replace');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"replace\" });\n }\n else {\n cm.toggleOverwrite(false);\n cm.setOption('keyMap', 'vim-insert');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"insert\" });\n }\n },\n enterInsertMode: function (cm, actionArgs, vim) {\n if (cm.getOption('readOnly')) {\n return;\n }\n vim.insertMode = true;\n vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1;\n var insertAt = (actionArgs) ? actionArgs.insertAt : null;\n var sel = vim.sel;\n var head = actionArgs.head || cm.getCursor('head');\n var height = cm.listSelections().length;\n if (insertAt == 'eol') {\n head = new Pos(head.line, lineLength(cm, head.line));\n }\n else if (insertAt == 'bol') {\n head = new Pos(head.line, 0);\n }\n else if (insertAt == 'charAfter') {\n var newPosition = updateSelectionForSurrogateCharacters(cm, head, offsetCursor(head, 0, 1));\n head = newPosition.end;\n }\n else if (insertAt == 'firstNonBlank') {\n var newPosition = updateSelectionForSurrogateCharacters(cm, head, motions.moveToFirstNonWhiteSpaceCharacter(cm, head));\n head = newPosition.end;\n }\n else if (insertAt == 'startOfSelectedArea') {\n if (!vim.visualMode)\n return;\n if (!vim.visualBlock) {\n if (sel.head.line < sel.anchor.line) {\n head = sel.head;\n }\n else {\n head = new Pos(sel.anchor.line, 0);\n }\n }\n else {\n head = new Pos(Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch));\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n }\n else if (insertAt == 'endOfSelectedArea') {\n if (!vim.visualMode)\n return;\n if (!vim.visualBlock) {\n if (sel.head.line >= sel.anchor.line) {\n head = offsetCursor(sel.head, 0, 1);\n }\n else {\n head = new Pos(sel.anchor.line, 0);\n }\n }\n else {\n head = new Pos(Math.min(sel.head.line, sel.anchor.line), Math.max(sel.head.ch, sel.anchor.ch) + 1);\n height = Math.abs(sel.head.line - sel.anchor.line) + 1;\n }\n }\n else if (insertAt == 'inplace') {\n if (vim.visualMode) {\n return;\n }\n }\n else if (insertAt == 'lastEdit') {\n head = getLastEditPos(cm) || head;\n }\n cm.setOption('disableInput', false);\n if (actionArgs && actionArgs.replace) {\n cm.toggleOverwrite(true);\n cm.setOption('keyMap', 'vim-replace');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"replace\" });\n }\n else {\n cm.toggleOverwrite(false);\n cm.setOption('keyMap', 'vim-insert');\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"insert\" });\n }\n if (!vimGlobalState.macroModeState.isPlaying) {\n cm.on('change', onChange);\n CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n selectForInsert(cm, head, height);\n },\n toggleVisualMode: function (cm, actionArgs, vim) {\n var repeat = actionArgs.repeat;\n var anchor = cm.getCursor();\n var head;\n if (!vim.visualMode) {\n vim.visualMode = true;\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n head = clipCursorToContent(cm, new Pos(anchor.line, anchor.ch + repeat - 1));\n var newPosition = updateSelectionForSurrogateCharacters(cm, anchor, head);\n vim.sel = {\n anchor: newPosition.start,\n head: newPosition.end\n };\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\" });\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n }\n else if (vim.visualLine ^ actionArgs.linewise ||\n vim.visualBlock ^ actionArgs.blockwise) {\n vim.visualLine = !!actionArgs.linewise;\n vim.visualBlock = !!actionArgs.blockwise;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\", subMode: vim.visualLine ? \"linewise\" : vim.visualBlock ? \"blockwise\" : \"\" });\n updateCmSelection(cm);\n }\n else {\n exitVisualMode(cm);\n }\n },\n reselectLastSelection: function (cm, _actionArgs, vim) {\n var lastSelection = vim.lastSelection;\n if (vim.visualMode) {\n updateLastSelection(cm, vim);\n }\n if (lastSelection) {\n var anchor = lastSelection.anchorMark.find();\n var head = lastSelection.headMark.find();\n if (!anchor || !head) {\n return;\n }\n vim.sel = {\n anchor: anchor,\n head: head\n };\n vim.visualMode = true;\n vim.visualLine = lastSelection.visualLine;\n vim.visualBlock = lastSelection.visualBlock;\n updateCmSelection(cm);\n updateMark(cm, vim, '<', cursorMin(anchor, head));\n updateMark(cm, vim, '>', cursorMax(anchor, head));\n CodeMirror.signal(cm, 'vim-mode-change', {\n mode: 'visual',\n subMode: vim.visualLine ? 'linewise' :\n vim.visualBlock ? 'blockwise' : ''\n });\n }\n },\n joinLines: function (cm, actionArgs, vim) {\n var curStart, curEnd;\n if (vim.visualMode) {\n curStart = cm.getCursor('anchor');\n curEnd = cm.getCursor('head');\n if (cursorIsBefore(curEnd, curStart)) {\n var tmp = curEnd;\n curEnd = curStart;\n curStart = tmp;\n }\n curEnd.ch = lineLength(cm, curEnd.line) - 1;\n }\n else {\n var repeat = Math.max(actionArgs.repeat, 2);\n curStart = cm.getCursor();\n curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1, Infinity));\n }\n var finalCh = 0;\n for (var i = curStart.line; i < curEnd.line; i++) {\n finalCh = lineLength(cm, curStart.line);\n var text = '';\n var nextStartCh = 0;\n if (!actionArgs.keepSpaces) {\n var nextLine = cm.getLine(curStart.line + 1);\n nextStartCh = nextLine.search(/\\S/);\n if (nextStartCh == -1) {\n nextStartCh = nextLine.length;\n }\n else {\n text = \" \";\n }\n }\n cm.replaceRange(text, new Pos(curStart.line, finalCh), new Pos(curStart.line + 1, nextStartCh));\n }\n var curFinalPos = clipCursorToContent(cm, new Pos(curStart.line, finalCh));\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curFinalPos);\n },\n newLineAndEnterInsertMode: function (cm, actionArgs, vim) {\n vim.insertMode = true;\n var insertAt = copyCursor(cm.getCursor());\n if (insertAt.line === cm.firstLine() && !actionArgs.after) {\n cm.replaceRange('\\n', new Pos(cm.firstLine(), 0));\n cm.setCursor(cm.firstLine(), 0);\n }\n else {\n insertAt.line = (actionArgs.after) ? insertAt.line :\n insertAt.line - 1;\n insertAt.ch = lineLength(cm, insertAt.line);\n cm.setCursor(insertAt);\n var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment ||\n CodeMirror.commands.newlineAndIndent;\n newlineFn(cm);\n }\n this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim);\n },\n paste: function (cm, actionArgs, vim) {\n var _this = this;\n var register = vimGlobalState.registerController.getRegister(actionArgs.registerName);\n if (actionArgs.registerName === '+') {\n navigator.clipboard.readText().then(function (value) {\n _this.continuePaste(cm, actionArgs, vim, value, register);\n });\n }\n else {\n var text = register.toString();\n this.continuePaste(cm, actionArgs, vim, text, register);\n }\n },\n continuePaste: function (cm, actionArgs, vim, text, register) {\n var cur = copyCursor(cm.getCursor());\n if (!text) {\n return;\n }\n if (actionArgs.matchIndent) {\n var tabSize = cm.getOption(\"tabSize\");\n var whitespaceLength = function (str) {\n var tabs = (str.split(\"\\t\").length - 1);\n var spaces = (str.split(\" \").length - 1);\n return tabs * tabSize + spaces * 1;\n };\n var currentLine = cm.getLine(cm.getCursor().line);\n var indent = whitespaceLength(currentLine.match(/^\\s*/)[0]);\n var chompedText = text.replace(/\\n$/, '');\n var wasChomped = text !== chompedText;\n var firstIndent = whitespaceLength(text.match(/^\\s*/)[0]);\n var text = chompedText.replace(/^\\s*/gm, function (wspace) {\n var newIndent = indent + (whitespaceLength(wspace) - firstIndent);\n if (newIndent < 0) {\n return \"\";\n }\n else if (cm.getOption(\"indentWithTabs\")) {\n var quotient = Math.floor(newIndent / tabSize);\n return Array(quotient + 1).join('\\t');\n }\n else {\n return Array(newIndent + 1).join(' ');\n }\n });\n text += wasChomped ? \"\\n\" : \"\";\n }\n if (actionArgs.repeat > 1) {\n var text = Array(actionArgs.repeat + 1).join(text);\n }\n var linewise = register.linewise;\n var blockwise = register.blockwise;\n if (blockwise) {\n text = text.split('\\n');\n if (linewise) {\n text.pop();\n }\n for (var i = 0; i < text.length; i++) {\n text[i] = (text[i] == '') ? ' ' : text[i];\n }\n cur.ch += actionArgs.after ? 1 : 0;\n cur.ch = Math.min(lineLength(cm, cur.line), cur.ch);\n }\n else if (linewise) {\n if (vim.visualMode) {\n text = vim.visualLine ? text.slice(0, -1) : '\\n' + text.slice(0, text.length - 1) + '\\n';\n }\n else if (actionArgs.after) {\n text = '\\n' + text.slice(0, text.length - 1);\n cur.ch = lineLength(cm, cur.line);\n }\n else {\n cur.ch = 0;\n }\n }\n else {\n cur.ch += actionArgs.after ? 1 : 0;\n }\n var curPosFinal;\n var idx;\n if (vim.visualMode) {\n vim.lastPastedText = text;\n var lastSelectionCurEnd;\n var selectedArea = getSelectedAreaRange(cm, vim);\n var selectionStart = selectedArea[0];\n var selectionEnd = selectedArea[1];\n var selectedText = cm.getSelection();\n var selections = cm.listSelections();\n var emptyStrings = new Array(selections.length).join('1').split('1');\n if (vim.lastSelection) {\n lastSelectionCurEnd = vim.lastSelection.headMark.find();\n }\n vimGlobalState.registerController.unnamedRegister.setText(selectedText);\n if (blockwise) {\n cm.replaceSelections(emptyStrings);\n selectionEnd = new Pos(selectionStart.line + text.length - 1, selectionStart.ch);\n cm.setCursor(selectionStart);\n selectBlock(cm, selectionEnd);\n cm.replaceSelections(text);\n curPosFinal = selectionStart;\n }\n else if (vim.visualBlock) {\n cm.replaceSelections(emptyStrings);\n cm.setCursor(selectionStart);\n cm.replaceRange(text, selectionStart, selectionStart);\n curPosFinal = selectionStart;\n }\n else {\n cm.replaceRange(text, selectionStart, selectionEnd);\n curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1);\n }\n if (lastSelectionCurEnd) {\n vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd);\n }\n if (linewise) {\n curPosFinal.ch = 0;\n }\n }\n else {\n if (blockwise) {\n cm.setCursor(cur);\n for (var i = 0; i < text.length; i++) {\n var line = cur.line + i;\n if (line > cm.lastLine()) {\n cm.replaceRange('\\n', new Pos(line, 0));\n }\n var lastCh = lineLength(cm, line);\n if (lastCh < cur.ch) {\n extendLineToColumn(cm, line, cur.ch);\n }\n }\n cm.setCursor(cur);\n selectBlock(cm, new Pos(cur.line + text.length - 1, cur.ch));\n cm.replaceSelections(text);\n curPosFinal = cur;\n }\n else {\n cm.replaceRange(text, cur);\n if (linewise && actionArgs.after) {\n curPosFinal = new Pos(cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));\n }\n else if (linewise && !actionArgs.after) {\n curPosFinal = new Pos(cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));\n }\n else if (!linewise && actionArgs.after) {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length - 1);\n }\n else {\n idx = cm.indexFromPos(cur);\n curPosFinal = cm.posFromIndex(idx + text.length);\n }\n }\n }\n if (vim.visualMode) {\n exitVisualMode(cm, false);\n }\n cm.setCursor(curPosFinal);\n },\n undo: function (cm, actionArgs) {\n cm.operation(function () {\n repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)();\n cm.setCursor(clipCursorToContent(cm, cm.getCursor('start')));\n });\n },\n redo: function (cm, actionArgs) {\n repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)();\n },\n setRegister: function (_cm, actionArgs, vim) {\n vim.inputState.registerName = actionArgs.selectedCharacter;\n },\n setMark: function (cm, actionArgs, vim) {\n var markName = actionArgs.selectedCharacter;\n updateMark(cm, vim, markName, cm.getCursor());\n },\n replace: function (cm, actionArgs, vim) {\n var replaceWith = actionArgs.selectedCharacter;\n var curStart = cm.getCursor();\n var replaceTo;\n var curEnd;\n var selections = cm.listSelections();\n if (vim.visualMode) {\n curStart = cm.getCursor('start');\n curEnd = cm.getCursor('end');\n }\n else {\n var line = cm.getLine(curStart.line);\n replaceTo = curStart.ch + actionArgs.repeat;\n if (replaceTo > line.length) {\n replaceTo = line.length;\n }\n curEnd = new Pos(curStart.line, replaceTo);\n }\n var newPositions = updateSelectionForSurrogateCharacters(cm, curStart, curEnd);\n curStart = newPositions.start;\n curEnd = newPositions.end;\n if (replaceWith == '\\n') {\n if (!vim.visualMode)\n cm.replaceRange('', curStart, curEnd);\n (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm);\n }\n else {\n var replaceWithStr = cm.getRange(curStart, curEnd);\n replaceWithStr = replaceWithStr.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, replaceWith);\n replaceWithStr = replaceWithStr.replace(/[^\\n]/g, replaceWith);\n if (vim.visualBlock) {\n var spaces = new Array(cm.getOption(\"tabSize\") + 1).join(' ');\n replaceWithStr = cm.getSelection();\n replaceWithStr = replaceWithStr.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, replaceWith);\n replaceWithStr = replaceWithStr.replace(/\\t/g, spaces).replace(/[^\\n]/g, replaceWith).split('\\n');\n cm.replaceSelections(replaceWithStr);\n }\n else {\n cm.replaceRange(replaceWithStr, curStart, curEnd);\n }\n if (vim.visualMode) {\n curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ?\n selections[0].anchor : selections[0].head;\n cm.setCursor(curStart);\n exitVisualMode(cm, false);\n }\n else {\n cm.setCursor(offsetCursor(curEnd, 0, -1));\n }\n }\n },\n incrementNumberToken: function (cm, actionArgs) {\n var cur = cm.getCursor();\n var lineStr = cm.getLine(cur.line);\n var re = /(-?)(?:(0x)([\\da-f]+)|(0b|0|)(\\d+))/gi;\n var match;\n var start;\n var end;\n var numberStr;\n while ((match = re.exec(lineStr)) !== null) {\n start = match.index;\n end = start + match[0].length;\n if (cur.ch < end)\n break;\n }\n if (!actionArgs.backtrack && (end <= cur.ch))\n return;\n if (match) {\n var baseStr = match[2] || match[4];\n var digits = match[3] || match[5];\n var increment = actionArgs.increase ? 1 : -1;\n var base = { '0b': 2, '0': 8, '': 10, '0x': 16 }[baseStr.toLowerCase()];\n var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat);\n numberStr = number.toString(base);\n var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '';\n if (numberStr.charAt(0) === '-') {\n numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1);\n }\n else {\n numberStr = baseStr + zeroPadding + numberStr;\n }\n var from = new Pos(cur.line, start);\n var to = new Pos(cur.line, end);\n cm.replaceRange(numberStr, from, to);\n }\n else {\n return;\n }\n cm.setCursor(new Pos(cur.line, start + numberStr.length - 1));\n },\n repeatLastEdit: function (cm, actionArgs, vim) {\n var lastEditInputState = vim.lastEditInputState;\n if (!lastEditInputState) {\n return;\n }\n var repeat = actionArgs.repeat;\n if (repeat && actionArgs.repeatIsExplicit) {\n vim.lastEditInputState.repeatOverride = repeat;\n }\n else {\n repeat = vim.lastEditInputState.repeatOverride || repeat;\n }\n repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */);\n },\n indent: function (cm, actionArgs) {\n cm.indentLine(cm.getCursor().line, actionArgs.indentRight);\n },\n exitInsertMode: exitInsertMode\n};\nfunction defineAction(name, fn) {\n actions[name] = fn;\n}\nfunction clipCursorToContent(cm, cur, oldCur) {\n var vim = cm.state.vim;\n var includeLineBreak = vim.insertMode || vim.visualMode;\n var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine());\n var text = cm.getLine(line);\n var maxCh = text.length - 1 + !!includeLineBreak;\n var ch = Math.min(Math.max(0, cur.ch), maxCh);\n var charCode = text.charCodeAt(ch);\n if (0xDC00 < charCode && charCode < 0xDFFF) {\n var direction = 1;\n if (oldCur && oldCur.line == line) {\n if (oldCur.ch > ch) {\n direction = -1;\n }\n }\n ch += direction;\n if (ch > maxCh)\n ch -= 2;\n }\n return new Pos(line, ch);\n}\nfunction copyArgs(args) {\n var ret = {};\n for (var prop in args) {\n if (args.hasOwnProperty(prop)) {\n ret[prop] = args[prop];\n }\n }\n return ret;\n}\nfunction offsetCursor(cur, offsetLine, offsetCh) {\n if (typeof offsetLine === 'object') {\n offsetCh = offsetLine.ch;\n offsetLine = offsetLine.line;\n }\n return new Pos(cur.line + offsetLine, cur.ch + offsetCh);\n}\nfunction commandMatches(keys, keyMap, context, inputState) {\n var match, partial = [], full = [];\n for (var i = 0; i < keyMap.length; i++) {\n var command = keyMap[i];\n if (context == 'insert' && command.context != 'insert' ||\n command.context && command.context != context ||\n inputState.operator && command.type == 'action' ||\n !(match = commandMatch(keys, command.keys))) {\n continue;\n }\n if (match == 'partial') {\n partial.push(command);\n }\n if (match == 'full') {\n full.push(command);\n }\n }\n return {\n partial: partial.length && partial,\n full: full.length && full\n };\n}\nfunction commandMatch(pressed, mapped) {\n if (mapped.slice(-11) == '') {\n var prefixLen = mapped.length - 11;\n var pressedPrefix = pressed.slice(0, prefixLen);\n var mappedPrefix = mapped.slice(0, prefixLen);\n return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' :\n mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false;\n }\n else {\n return pressed == mapped ? 'full' :\n mapped.indexOf(pressed) == 0 ? 'partial' : false;\n }\n}\nfunction lastChar(keys) {\n var match = /^.*(<[^>]+>)$/.exec(keys);\n var selectedCharacter = match ? match[1] : keys.slice(-1);\n if (selectedCharacter.length > 1) {\n switch (selectedCharacter) {\n case '':\n selectedCharacter = '\\n';\n break;\n case '':\n selectedCharacter = ' ';\n break;\n default:\n selectedCharacter = '';\n break;\n }\n }\n return selectedCharacter;\n}\nfunction repeatFn(cm, fn, repeat) {\n return function () {\n for (var i = 0; i < repeat; i++) {\n fn(cm);\n }\n };\n}\nfunction copyCursor(cur) {\n return new Pos(cur.line, cur.ch);\n}\nfunction cursorEqual(cur1, cur2) {\n return cur1.ch == cur2.ch && cur1.line == cur2.line;\n}\nfunction cursorIsBefore(cur1, cur2) {\n if (cur1.line < cur2.line) {\n return true;\n }\n if (cur1.line == cur2.line && cur1.ch < cur2.ch) {\n return true;\n }\n return false;\n}\nfunction cursorMin(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur1 : cur2;\n}\nfunction cursorMax(cur1, cur2) {\n if (arguments.length > 2) {\n cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1));\n }\n return cursorIsBefore(cur1, cur2) ? cur2 : cur1;\n}\nfunction cursorIsBetween(cur1, cur2, cur3) {\n var cur1before2 = cursorIsBefore(cur1, cur2);\n var cur2before3 = cursorIsBefore(cur2, cur3);\n return cur1before2 && cur2before3;\n}\nfunction lineLength(cm, lineNum) {\n return cm.getLine(lineNum).length;\n}\nfunction trim(s) {\n if (s.trim) {\n return s.trim();\n }\n return s.replace(/^\\s+|\\s+$/g, '');\n}\nfunction escapeRegex(s) {\n return s.replace(/([.?*+$\\[\\]\\/\\\\(){}|\\-])/g, '\\\\$1');\n}\nfunction extendLineToColumn(cm, lineNum, column) {\n var endCh = lineLength(cm, lineNum);\n var spaces = new Array(column - endCh + 1).join(' ');\n cm.setCursor(new Pos(lineNum, endCh));\n cm.replaceRange(spaces, cm.getCursor());\n}\nfunction selectBlock(cm, selectionEnd) {\n var selections = [], ranges = cm.listSelections();\n var head = copyCursor(cm.clipPos(selectionEnd));\n var isClipped = !cursorEqual(selectionEnd, head);\n var curHead = cm.getCursor('head');\n var primIndex = getIndex(ranges, curHead);\n var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor);\n var max = ranges.length - 1;\n var index = max - primIndex > primIndex ? max : 0;\n var base = ranges[index].anchor;\n var firstLine = Math.min(base.line, head.line);\n var lastLine = Math.max(base.line, head.line);\n var baseCh = base.ch, headCh = head.ch;\n var dir = ranges[index].head.ch - baseCh;\n var newDir = headCh - baseCh;\n if (dir > 0 && newDir <= 0) {\n baseCh++;\n if (!isClipped) {\n headCh--;\n }\n }\n else if (dir < 0 && newDir >= 0) {\n baseCh--;\n if (!wasClipped) {\n headCh++;\n }\n }\n else if (dir < 0 && newDir == -1) {\n baseCh--;\n headCh++;\n }\n for (var line = firstLine; line <= lastLine; line++) {\n var range = { anchor: new Pos(line, baseCh), head: new Pos(line, headCh) };\n selections.push(range);\n }\n cm.setSelections(selections);\n selectionEnd.ch = headCh;\n base.ch = baseCh;\n return base;\n}\nfunction selectForInsert(cm, head, height) {\n var sel = [];\n for (var i = 0; i < height; i++) {\n var lineHead = offsetCursor(head, i, 0);\n sel.push({ anchor: lineHead, head: lineHead });\n }\n cm.setSelections(sel, 0);\n}\nfunction getIndex(ranges, cursor, end) {\n for (var i = 0; i < ranges.length; i++) {\n var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor);\n var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor);\n if (atAnchor || atHead) {\n return i;\n }\n }\n return -1;\n}\nfunction getSelectedAreaRange(cm, vim) {\n var lastSelection = vim.lastSelection;\n var getCurrentSelectedAreaRange = function () {\n var selections = cm.listSelections();\n var start = selections[0];\n var end = selections[selections.length - 1];\n var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head;\n var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor;\n return [selectionStart, selectionEnd];\n };\n var getLastSelectedAreaRange = function () {\n var selectionStart = cm.getCursor();\n var selectionEnd = cm.getCursor();\n var block = lastSelection.visualBlock;\n if (block) {\n var width = block.width;\n var height = block.height;\n selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width);\n var selections = [];\n for (var i = selectionStart.line; i < selectionEnd.line; i++) {\n var anchor = new Pos(i, selectionStart.ch);\n var head = new Pos(i, selectionEnd.ch);\n var range = { anchor: anchor, head: head };\n selections.push(range);\n }\n cm.setSelections(selections);\n }\n else {\n var start = lastSelection.anchorMark.find();\n var end = lastSelection.headMark.find();\n var line = end.line - start.line;\n var ch = end.ch - start.ch;\n selectionEnd = { line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch };\n if (lastSelection.visualLine) {\n selectionStart = new Pos(selectionStart.line, 0);\n selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));\n }\n cm.setSelection(selectionStart, selectionEnd);\n }\n return [selectionStart, selectionEnd];\n };\n if (!vim.visualMode) {\n return getLastSelectedAreaRange();\n }\n else {\n return getCurrentSelectedAreaRange();\n }\n}\nfunction updateLastSelection(cm, vim) {\n var anchor = vim.sel.anchor;\n var head = vim.sel.head;\n if (vim.lastPastedText) {\n head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);\n vim.lastPastedText = null;\n }\n vim.lastSelection = { 'anchorMark': cm.setBookmark(anchor),\n 'headMark': cm.setBookmark(head),\n 'anchor': copyCursor(anchor),\n 'head': copyCursor(head),\n 'visualMode': vim.visualMode,\n 'visualLine': vim.visualLine,\n 'visualBlock': vim.visualBlock };\n}\nfunction expandSelection(cm, start, end) {\n var sel = cm.state.vim.sel;\n var head = sel.head;\n var anchor = sel.anchor;\n var tmp;\n if (cursorIsBefore(end, start)) {\n tmp = end;\n end = start;\n start = tmp;\n }\n if (cursorIsBefore(head, anchor)) {\n head = cursorMin(start, head);\n anchor = cursorMax(anchor, end);\n }\n else {\n anchor = cursorMin(start, anchor);\n head = cursorMax(head, end);\n head = offsetCursor(head, 0, -1);\n if (head.ch == -1 && head.line != cm.firstLine()) {\n head = new Pos(head.line - 1, lineLength(cm, head.line - 1));\n }\n }\n return [anchor, head];\n}\nfunction updateCmSelection(cm, sel, mode) {\n var vim = cm.state.vim;\n sel = sel || vim.sel;\n var mode = mode ||\n vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';\n var cmSel = makeCmSelection(cm, sel, mode);\n cm.setSelections(cmSel.ranges, cmSel.primary);\n}\nfunction makeCmSelection(cm, sel, mode, exclusive) {\n var head = copyCursor(sel.head);\n var anchor = copyCursor(sel.anchor);\n if (mode == 'char') {\n var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;\n head = offsetCursor(sel.head, 0, headOffset);\n anchor = offsetCursor(sel.anchor, 0, anchorOffset);\n return {\n ranges: [{ anchor: anchor, head: head }],\n primary: 0\n };\n }\n else if (mode == 'line') {\n if (!cursorIsBefore(sel.head, sel.anchor)) {\n anchor.ch = 0;\n var lastLine = cm.lastLine();\n if (head.line > lastLine) {\n head.line = lastLine;\n }\n head.ch = lineLength(cm, head.line);\n }\n else {\n head.ch = 0;\n anchor.ch = lineLength(cm, anchor.line);\n }\n return {\n ranges: [{ anchor: anchor, head: head }],\n primary: 0\n };\n }\n else if (mode == 'block') {\n var top = Math.min(anchor.line, head.line), fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), toCh = head.ch;\n if (fromCh < toCh) {\n toCh += 1;\n }\n else {\n fromCh += 1;\n }\n ;\n var height = bottom - top + 1;\n var primary = head.line == top ? 0 : height - 1;\n var ranges = [];\n for (var i = 0; i < height; i++) {\n ranges.push({\n anchor: new Pos(top + i, fromCh),\n head: new Pos(top + i, toCh)\n });\n }\n return {\n ranges: ranges,\n primary: primary\n };\n }\n}\nfunction getHead(cm) {\n var cur = cm.getCursor('head');\n if (cm.getSelection().length == 1) {\n cur = cursorMin(cur, cm.getCursor('anchor'));\n }\n return cur;\n}\nfunction exitVisualMode(cm, moveHead) {\n var vim = cm.state.vim;\n if (moveHead !== false) {\n cm.setCursor(clipCursorToContent(cm, vim.sel.head));\n }\n updateLastSelection(cm, vim);\n vim.visualMode = false;\n vim.visualLine = false;\n vim.visualBlock = false;\n if (!vim.insertMode)\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"normal\" });\n}\nfunction clipToLine(cm, curStart, curEnd) {\n var selection = cm.getRange(curStart, curEnd);\n if (/\\n\\s*$/.test(selection)) {\n var lines = selection.split('\\n');\n lines.pop();\n var line;\n for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) {\n curEnd.line--;\n curEnd.ch = 0;\n }\n if (line) {\n curEnd.line--;\n curEnd.ch = lineLength(cm, curEnd.line);\n }\n else {\n curEnd.ch = 0;\n }\n }\n}\nfunction expandSelectionToLine(_cm, curStart, curEnd) {\n curStart.ch = 0;\n curEnd.ch = 0;\n curEnd.line++;\n}\nfunction findFirstNonWhiteSpaceCharacter(text) {\n if (!text) {\n return 0;\n }\n var firstNonWS = text.search(/\\S/);\n return firstNonWS == -1 ? text.length : firstNonWS;\n}\nfunction expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) {\n var cur = getHead(cm);\n var line = cm.getLine(cur.line);\n var idx = cur.ch;\n var test = noSymbol ? wordCharTest[0] : bigWordCharTest[0];\n while (!test(line.charAt(idx))) {\n idx++;\n if (idx >= line.length) {\n return null;\n }\n }\n if (bigWord) {\n test = bigWordCharTest[0];\n }\n else {\n test = wordCharTest[0];\n if (!test(line.charAt(idx))) {\n test = wordCharTest[1];\n }\n }\n var end = idx, start = idx;\n while (test(line.charAt(end)) && end < line.length) {\n end++;\n }\n while (test(line.charAt(start)) && start >= 0) {\n start--;\n }\n start++;\n if (inclusive) {\n var wordEnd = end;\n while (/\\s/.test(line.charAt(end)) && end < line.length) {\n end++;\n }\n if (wordEnd == end) {\n var wordStart = start;\n while (/\\s/.test(line.charAt(start - 1)) && start > 0) {\n start--;\n }\n if (!start) {\n start = wordStart;\n }\n }\n }\n return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) };\n}\nfunction expandTagUnderCursor(cm, head, inclusive) {\n var cur = head;\n if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) {\n return { start: cur, end: cur };\n }\n var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head);\n if (!tags || !tags.open || !tags.close) {\n return { start: cur, end: cur };\n }\n if (inclusive) {\n return { start: tags.open.from, end: tags.close.to };\n }\n return { start: tags.open.to, end: tags.close.from };\n}\nfunction recordJumpPosition(cm, oldCur, newCur) {\n if (!cursorEqual(oldCur, newCur)) {\n vimGlobalState.jumpList.add(cm, oldCur, newCur);\n }\n}\nfunction recordLastCharacterSearch(increment, args) {\n vimGlobalState.lastCharacterSearch.increment = increment;\n vimGlobalState.lastCharacterSearch.forward = args.forward;\n vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;\n}\nvar symbolToMode = {\n '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket',\n '[': 'section', ']': 'section',\n '*': 'comment', '/': 'comment',\n 'm': 'method', 'M': 'method',\n '#': 'preprocess'\n};\nvar findSymbolModes = {\n bracket: {\n isComplete: function (state) {\n if (state.nextCh === state.symb) {\n state.depth++;\n if (state.depth >= 1)\n return true;\n }\n else if (state.nextCh === state.reverseSymb) {\n state.depth--;\n }\n return false;\n }\n },\n section: {\n init: function (state) {\n state.curMoveThrough = true;\n state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}';\n },\n isComplete: function (state) {\n return state.index === 0 && state.nextCh === state.symb;\n }\n },\n comment: {\n isComplete: function (state) {\n var found = state.lastCh === '*' && state.nextCh === '/';\n state.lastCh = state.nextCh;\n return found;\n }\n },\n method: {\n init: function (state) {\n state.symb = (state.symb === 'm' ? '{' : '}');\n state.reverseSymb = state.symb === '{' ? '}' : '{';\n },\n isComplete: function (state) {\n if (state.nextCh === state.symb)\n return true;\n return false;\n }\n },\n preprocess: {\n init: function (state) {\n state.index = 0;\n },\n isComplete: function (state) {\n if (state.nextCh === '#') {\n var token = state.lineText.match(/^#(\\w+)/)[1];\n if (token === 'endif') {\n if (state.forward && state.depth === 0) {\n return true;\n }\n state.depth++;\n }\n else if (token === 'if') {\n if (!state.forward && state.depth === 0) {\n return true;\n }\n state.depth--;\n }\n if (token === 'else' && state.depth === 0)\n return true;\n }\n return false;\n }\n }\n};\nfunction findSymbol(cm, repeat, forward, symb) {\n var cur = copyCursor(cm.getCursor());\n var increment = forward ? 1 : -1;\n var endLine = forward ? cm.lineCount() : -1;\n var curCh = cur.ch;\n var line = cur.line;\n var lineText = cm.getLine(line);\n var state = {\n lineText: lineText,\n nextCh: lineText.charAt(curCh),\n lastCh: null,\n index: curCh,\n symb: symb,\n reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb],\n forward: forward,\n depth: 0,\n curMoveThrough: false\n };\n var mode = symbolToMode[symb];\n if (!mode)\n return cur;\n var init = findSymbolModes[mode].init;\n var isComplete = findSymbolModes[mode].isComplete;\n if (init) {\n init(state);\n }\n while (line !== endLine && repeat) {\n state.index += increment;\n state.nextCh = state.lineText.charAt(state.index);\n if (!state.nextCh) {\n line += increment;\n state.lineText = cm.getLine(line) || '';\n if (increment > 0) {\n state.index = 0;\n }\n else {\n var lineLen = state.lineText.length;\n state.index = (lineLen > 0) ? (lineLen - 1) : 0;\n }\n state.nextCh = state.lineText.charAt(state.index);\n }\n if (isComplete(state)) {\n cur.line = line;\n cur.ch = state.index;\n repeat--;\n }\n }\n if (state.nextCh || state.curMoveThrough) {\n return new Pos(line, state.index);\n }\n return cur;\n}\nfunction findWord(cm, cur, forward, bigWord, emptyLineIsWord) {\n var lineNum = cur.line;\n var pos = cur.ch;\n var line = cm.getLine(lineNum);\n var dir = forward ? 1 : -1;\n var charTests = bigWord ? bigWordCharTest : wordCharTest;\n if (emptyLineIsWord && line == '') {\n lineNum += dir;\n line = cm.getLine(lineNum);\n if (!isLine(cm, lineNum)) {\n return null;\n }\n pos = (forward) ? 0 : line.length;\n }\n while (true) {\n if (emptyLineIsWord && line == '') {\n return { from: 0, to: 0, line: lineNum };\n }\n var stop = (dir > 0) ? line.length : -1;\n var wordStart = stop, wordEnd = stop;\n while (pos != stop) {\n var foundWord = false;\n for (var i = 0; i < charTests.length && !foundWord; ++i) {\n if (charTests[i](line.charAt(pos))) {\n wordStart = pos;\n while (pos != stop && charTests[i](line.charAt(pos))) {\n pos += dir;\n }\n wordEnd = pos;\n foundWord = wordStart != wordEnd;\n if (wordStart == cur.ch && lineNum == cur.line &&\n wordEnd == wordStart + dir) {\n continue;\n }\n else {\n return {\n from: Math.min(wordStart, wordEnd + 1),\n to: Math.max(wordStart, wordEnd),\n line: lineNum\n };\n }\n }\n }\n if (!foundWord) {\n pos += dir;\n }\n }\n lineNum += dir;\n if (!isLine(cm, lineNum)) {\n return null;\n }\n line = cm.getLine(lineNum);\n pos = (dir > 0) ? 0 : line.length;\n }\n}\nfunction moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) {\n var curStart = copyCursor(cur);\n var words = [];\n if (forward && !wordEnd || !forward && wordEnd) {\n repeat++;\n }\n var emptyLineIsWord = !(forward && wordEnd);\n for (var i = 0; i < repeat; i++) {\n var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord);\n if (!word) {\n var eodCh = lineLength(cm, cm.lastLine());\n words.push(forward\n ? { line: cm.lastLine(), from: eodCh, to: eodCh }\n : { line: 0, from: 0, to: 0 });\n break;\n }\n words.push(word);\n cur = new Pos(word.line, forward ? (word.to - 1) : word.from);\n }\n var shortCircuit = words.length != repeat;\n var firstWord = words[0];\n var lastWord = words.pop();\n if (forward && !wordEnd) {\n if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) {\n lastWord = words.pop();\n }\n return new Pos(lastWord.line, lastWord.from);\n }\n else if (forward && wordEnd) {\n return new Pos(lastWord.line, lastWord.to - 1);\n }\n else if (!forward && wordEnd) {\n if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) {\n lastWord = words.pop();\n }\n return new Pos(lastWord.line, lastWord.to);\n }\n else {\n return new Pos(lastWord.line, lastWord.from);\n }\n}\nfunction moveToEol(cm, head, motionArgs, vim, keepHPos) {\n var cur = head;\n var retval = new Pos(cur.line + motionArgs.repeat - 1, Infinity);\n var end = cm.clipPos(retval);\n end.ch--;\n if (!keepHPos) {\n vim.lastHPos = Infinity;\n vim.lastHSPos = cm.charCoords(end, 'div').left;\n }\n return retval;\n}\nfunction moveToCharacter(cm, repeat, forward, character) {\n var cur = cm.getCursor();\n var start = cur.ch;\n var idx;\n for (var i = 0; i < repeat; i++) {\n var line = cm.getLine(cur.line);\n idx = charIdxInLine(start, line, character, forward, true);\n if (idx == -1) {\n return null;\n }\n start = idx;\n }\n return new Pos(cm.getCursor().line, idx);\n}\nfunction moveToColumn(cm, repeat) {\n var line = cm.getCursor().line;\n return clipCursorToContent(cm, new Pos(line, repeat - 1));\n}\nfunction updateMark(cm, vim, markName, pos) {\n if (!inArray(markName, validMarks)) {\n return;\n }\n if (vim.marks[markName]) {\n vim.marks[markName].clear();\n }\n vim.marks[markName] = cm.setBookmark(pos);\n}\nfunction charIdxInLine(start, line, character, forward, includeChar) {\n var idx;\n if (forward) {\n idx = line.indexOf(character, start + 1);\n if (idx != -1 && !includeChar) {\n idx -= 1;\n }\n }\n else {\n idx = line.lastIndexOf(character, start - 1);\n if (idx != -1 && !includeChar) {\n idx += 1;\n }\n }\n return idx;\n}\nfunction findParagraph(cm, head, repeat, dir, inclusive) {\n var line = head.line;\n var min = cm.firstLine();\n var max = cm.lastLine();\n var start, end, i = line;\n function isEmpty(i) { return !/\\S/.test(cm.getLine(i)); } // ace_patch\n function isBoundary(i, dir, any) {\n if (any) {\n return isEmpty(i) != isEmpty(i + dir);\n }\n return !isEmpty(i) && isEmpty(i + dir);\n }\n function skipFold(i) {\n dir = dir > 0 ? 1 : -1;\n var foldLine = cm.ace.session.getFoldLine(i);\n if (foldLine) {\n if (i + dir > foldLine.start.row && i + dir < foldLine.end.row)\n dir = (dir > 0 ? foldLine.end.row : foldLine.start.row) - i;\n }\n }\n if (dir) {\n while (min <= i && i <= max && repeat > 0) {\n skipFold(i);\n if (isBoundary(i, dir)) {\n repeat--;\n }\n i += dir;\n }\n return new Pos(i, 0);\n }\n var vim = cm.state.vim;\n if (vim.visualLine && isBoundary(line, 1, true)) {\n var anchor = vim.sel.anchor;\n if (isBoundary(anchor.line, -1, true)) {\n if (!inclusive || anchor.line != line) {\n line += 1;\n }\n }\n }\n var startState = isEmpty(line);\n for (i = line; i <= max && repeat; i++) {\n if (isBoundary(i, 1, true)) {\n if (!inclusive || isEmpty(i) != startState) {\n repeat--;\n }\n }\n }\n end = new Pos(i, 0);\n if (i > max && !startState) {\n startState = true;\n }\n else {\n inclusive = false;\n }\n for (i = line; i > min; i--) {\n if (!inclusive || isEmpty(i) == startState || i == line) {\n if (isBoundary(i, -1, true)) {\n break;\n }\n }\n }\n start = new Pos(i, 0);\n return { start: start, end: end };\n}\nfunction getSentence(cm, cur, repeat, dir, inclusive /*includes whitespace*/) {\n function nextChar(curr) {\n if (curr.pos + curr.dir < 0 || curr.pos + curr.dir >= curr.line.length) {\n curr.line = null;\n }\n else {\n curr.pos += curr.dir;\n }\n }\n function forward(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n if (curr.line === \"\") {\n return { ln: curr.ln, pos: curr.pos };\n }\n var lastSentencePos = curr.pos;\n nextChar(curr);\n while (curr.line !== null) {\n lastSentencePos = curr.pos;\n if (isEndOfSentenceSymbol(curr.line[curr.pos])) {\n if (!inclusive) {\n return { ln: curr.ln, pos: curr.pos + 1 };\n }\n else {\n nextChar(curr);\n while (curr.line !== null) {\n if (isWhiteSpaceString(curr.line[curr.pos])) {\n lastSentencePos = curr.pos;\n nextChar(curr);\n }\n else {\n break;\n }\n }\n return { ln: curr.ln, pos: lastSentencePos + 1 };\n }\n }\n nextChar(curr);\n }\n return { ln: curr.ln, pos: lastSentencePos + 1 };\n }\n function reverse(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n if (curr.line === \"\") {\n return { ln: curr.ln, pos: curr.pos };\n }\n var lastSentencePos = curr.pos;\n nextChar(curr);\n while (curr.line !== null) {\n if (!isWhiteSpaceString(curr.line[curr.pos]) && !isEndOfSentenceSymbol(curr.line[curr.pos])) {\n lastSentencePos = curr.pos;\n }\n else if (isEndOfSentenceSymbol(curr.line[curr.pos])) {\n if (!inclusive) {\n return { ln: curr.ln, pos: lastSentencePos };\n }\n else {\n if (isWhiteSpaceString(curr.line[curr.pos + 1])) {\n return { ln: curr.ln, pos: curr.pos + 1 };\n }\n else {\n return { ln: curr.ln, pos: lastSentencePos };\n }\n }\n }\n nextChar(curr);\n }\n curr.line = line;\n if (inclusive && isWhiteSpaceString(curr.line[curr.pos])) {\n return { ln: curr.ln, pos: curr.pos };\n }\n else {\n return { ln: curr.ln, pos: lastSentencePos };\n }\n }\n var curr_index = {\n ln: cur.line,\n pos: cur.ch,\n };\n while (repeat > 0) {\n if (dir < 0) {\n curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);\n }\n else {\n curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);\n }\n repeat--;\n }\n return new Pos(curr_index.ln, curr_index.pos);\n}\nfunction findSentence(cm, cur, repeat, dir) {\n function nextChar(cm, idx) {\n if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {\n idx.ln += idx.dir;\n if (!isLine(cm, idx.ln)) {\n idx.line = null;\n idx.ln = null;\n idx.pos = null;\n return;\n }\n idx.line = cm.getLine(idx.ln);\n idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1;\n }\n else {\n idx.pos += idx.dir;\n }\n }\n function forward(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var stop = (line === \"\");\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n var last_valid = {\n ln: curr.ln,\n pos: curr.pos,\n };\n var skip_empty_lines = (curr.line === \"\");\n nextChar(cm, curr);\n while (curr.line !== null) {\n last_valid.ln = curr.ln;\n last_valid.pos = curr.pos;\n if (curr.line === \"\" && !skip_empty_lines) {\n return { ln: curr.ln, pos: curr.pos, };\n }\n else if (stop && curr.line !== \"\" && !isWhiteSpaceString(curr.line[curr.pos])) {\n return { ln: curr.ln, pos: curr.pos, };\n }\n else if (isEndOfSentenceSymbol(curr.line[curr.pos])\n && !stop\n && (curr.pos === curr.line.length - 1\n || isWhiteSpaceString(curr.line[curr.pos + 1]))) {\n stop = true;\n }\n nextChar(cm, curr);\n }\n var line = cm.getLine(last_valid.ln);\n last_valid.pos = 0;\n for (var i = line.length - 1; i >= 0; --i) {\n if (!isWhiteSpaceString(line[i])) {\n last_valid.pos = i;\n break;\n }\n }\n return last_valid;\n }\n function reverse(cm, ln, pos, dir) {\n var line = cm.getLine(ln);\n var curr = {\n line: line,\n ln: ln,\n pos: pos,\n dir: dir,\n };\n var last_valid = {\n ln: curr.ln,\n pos: null,\n };\n var skip_empty_lines = (curr.line === \"\");\n nextChar(cm, curr);\n while (curr.line !== null) {\n if (curr.line === \"\" && !skip_empty_lines) {\n if (last_valid.pos !== null) {\n return last_valid;\n }\n else {\n return { ln: curr.ln, pos: curr.pos };\n }\n }\n else if (isEndOfSentenceSymbol(curr.line[curr.pos])\n && last_valid.pos !== null\n && !(curr.ln === last_valid.ln && curr.pos + 1 === last_valid.pos)) {\n return last_valid;\n }\n else if (curr.line !== \"\" && !isWhiteSpaceString(curr.line[curr.pos])) {\n skip_empty_lines = false;\n last_valid = { ln: curr.ln, pos: curr.pos };\n }\n nextChar(cm, curr);\n }\n var line = cm.getLine(last_valid.ln);\n last_valid.pos = 0;\n for (var i = 0; i < line.length; ++i) {\n if (!isWhiteSpaceString(line[i])) {\n last_valid.pos = i;\n break;\n }\n }\n return last_valid;\n }\n var curr_index = {\n ln: cur.line,\n pos: cur.ch,\n };\n while (repeat > 0) {\n if (dir < 0) {\n curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);\n }\n else {\n curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);\n }\n repeat--;\n }\n return new Pos(curr_index.ln, curr_index.pos);\n}\nfunction selectCompanionObject(cm, head, symb, inclusive) {\n var cur = head, start, end;\n var bracketRegexp = ({\n '(': /[()]/, ')': /[()]/,\n '[': /[[\\]]/, ']': /[[\\]]/,\n '{': /[{}]/, '}': /[{}]/,\n '<': /[<>]/, '>': /[<>]/\n })[symb];\n var openSym = ({\n '(': '(', ')': '(',\n '[': '[', ']': '[',\n '{': '{', '}': '{',\n '<': '<', '>': '<'\n })[symb];\n var curChar = cm.getLine(cur.line).charAt(cur.ch);\n var offset = curChar === openSym ? 1 : 0;\n start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, { 'bracketRegex': bracketRegexp });\n end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, { 'bracketRegex': bracketRegexp });\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n start = start.pos;\n end = end.pos;\n if ((start.line == end.line && start.ch > end.ch)\n || (start.line > end.line)) {\n var tmp = start;\n start = end;\n end = tmp;\n }\n if (inclusive) {\n end.ch += 1;\n }\n else {\n start.ch += 1;\n }\n return { start: start, end: end };\n}\nfunction findBeginningAndEnd(cm, head, symb, inclusive) {\n var cur = copyCursor(head);\n var line = cm.getLine(cur.line);\n var chars = line.split('');\n var start, end, i, len;\n var firstIndex = chars.indexOf(symb);\n if (cur.ch < firstIndex) {\n cur.ch = firstIndex;\n }\n else if (firstIndex < cur.ch && chars[cur.ch] == symb) {\n end = cur.ch; // assign end to the current cursor\n --cur.ch; // make sure to look backwards\n }\n if (chars[cur.ch] == symb && !end) {\n start = cur.ch + 1; // assign start to ahead of the cursor\n }\n else {\n for (i = cur.ch; i > -1 && !start; i--) {\n if (chars[i] == symb) {\n start = i + 1;\n }\n }\n }\n if (start && !end) {\n for (i = start, len = chars.length; i < len && !end; i++) {\n if (chars[i] == symb) {\n end = i;\n }\n }\n }\n if (!start || !end) {\n return { start: cur, end: cur };\n }\n if (inclusive) {\n --start;\n ++end;\n }\n return {\n start: new Pos(cur.line, start),\n end: new Pos(cur.line, end)\n };\n}\ndefineOption('pcre', true, 'boolean');\nfunction SearchState() { }\nSearchState.prototype = {\n getQuery: function () {\n return vimGlobalState.query;\n },\n setQuery: function (query) {\n vimGlobalState.query = query;\n },\n getOverlay: function () {\n return this.searchOverlay;\n },\n setOverlay: function (overlay) {\n this.searchOverlay = overlay;\n },\n isReversed: function () {\n return vimGlobalState.isReversed;\n },\n setReversed: function (reversed) {\n vimGlobalState.isReversed = reversed;\n },\n getScrollbarAnnotate: function () {\n return this.annotate;\n },\n setScrollbarAnnotate: function (annotate) {\n this.annotate = annotate;\n }\n};\nfunction getSearchState(cm) {\n var vim = cm.state.vim;\n return vim.searchState_ || (vim.searchState_ = new SearchState());\n}\nfunction splitBySlash(argString) {\n return splitBySeparator(argString, '/');\n}\nfunction findUnescapedSlashes(argString) {\n return findUnescapedSeparators(argString, '/');\n}\nfunction splitBySeparator(argString, separator) {\n var slashes = findUnescapedSeparators(argString, separator) || [];\n if (!slashes.length)\n return [];\n var tokens = [];\n if (slashes[0] !== 0)\n return;\n for (var i = 0; i < slashes.length; i++) {\n if (typeof slashes[i] == 'number')\n tokens.push(argString.substring(slashes[i] + 1, slashes[i + 1]));\n }\n return tokens;\n}\nfunction findUnescapedSeparators(str, separator) {\n if (!separator)\n separator = '/';\n var escapeNextChar = false;\n var slashes = [];\n for (var i = 0; i < str.length; i++) {\n var c = str.charAt(i);\n if (!escapeNextChar && c == separator) {\n slashes.push(i);\n }\n escapeNextChar = !escapeNextChar && (c == '\\\\');\n }\n return slashes;\n}\nfunction translateRegex(str) {\n var specials = '|(){';\n var unescape = '}';\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i + 1) || '';\n var specialComesNext = (n && specials.indexOf(n) != -1);\n if (escapeNextChar) {\n if (c !== '\\\\' || !specialComesNext) {\n out.push(c);\n }\n escapeNextChar = false;\n }\n else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if (n && unescape.indexOf(n) != -1) {\n specialComesNext = true;\n }\n if (!specialComesNext || n === '\\\\') {\n out.push(c);\n }\n }\n else {\n out.push(c);\n if (specialComesNext && n !== '\\\\') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n}\nvar charUnescapes = { '\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t' };\nfunction translateRegexReplace(str) {\n var escapeNextChar = false;\n var out = [];\n for (var i = -1; i < str.length; i++) {\n var c = str.charAt(i) || '';\n var n = str.charAt(i + 1) || '';\n if (charUnescapes[c + n]) {\n out.push(charUnescapes[c + n]);\n i++;\n }\n else if (escapeNextChar) {\n out.push(c);\n escapeNextChar = false;\n }\n else {\n if (c === '\\\\') {\n escapeNextChar = true;\n if ((isNumber(n) || n === '$')) {\n out.push('$');\n }\n else if (n !== '/' && n !== '\\\\') {\n out.push('\\\\');\n }\n }\n else {\n if (c === '$') {\n out.push('$');\n }\n out.push(c);\n if (n === '/') {\n out.push('\\\\');\n }\n }\n }\n }\n return out.join('');\n}\nvar unescapes = { '\\\\/': '/', '\\\\\\\\': '\\\\', '\\\\n': '\\n', '\\\\r': '\\r', '\\\\t': '\\t', '\\\\&': '&' };\nfunction unescapeRegexReplace(str) {\n var stream = new CodeMirror.StringStream(str);\n var output = [];\n while (!stream.eol()) {\n while (stream.peek() && stream.peek() != '\\\\') {\n output.push(stream.next());\n }\n var matched = false;\n for (var matcher in unescapes) {\n if (stream.match(matcher, true)) {\n matched = true;\n output.push(unescapes[matcher]);\n break;\n }\n }\n if (!matched) {\n output.push(stream.next());\n }\n }\n return output.join('');\n}\nfunction parseQuery(query, ignoreCase, smartCase) {\n var lastSearchRegister = vimGlobalState.registerController.getRegister('/');\n lastSearchRegister.setText(query);\n if (query instanceof RegExp) {\n return query;\n }\n var slashes = findUnescapedSlashes(query);\n var regexPart;\n var forceIgnoreCase;\n if (!slashes.length) {\n regexPart = query;\n }\n else {\n regexPart = query.substring(0, slashes[0]);\n var flagsPart = query.substring(slashes[0]);\n forceIgnoreCase = (flagsPart.indexOf('i') != -1);\n }\n if (!regexPart) {\n return null;\n }\n if (!getOption('pcre')) {\n regexPart = translateRegex(regexPart);\n }\n if (smartCase) {\n ignoreCase = (/^[^A-Z]*$/).test(regexPart);\n }\n var regexp = new RegExp(regexPart, (ignoreCase || forceIgnoreCase) ? 'im' : 'm');\n return regexp;\n}\nfunction dom(n) {\n if (typeof n === 'string')\n n = document.createElement(n);\n for (var a, i = 1; i < arguments.length; i++) {\n if (!(a = arguments[i]))\n continue;\n if (typeof a !== 'object')\n a = document.createTextNode(a);\n if (a.nodeType)\n n.appendChild(a);\n else\n for (var key in a) {\n if (!Object.prototype.hasOwnProperty.call(a, key))\n continue;\n if (key[0] === '$')\n n.style[key.slice(1)] = a[key];\n else\n n.setAttribute(key, a[key]);\n }\n }\n return n;\n}\nfunction showConfirm(cm, template) {\n var pre = dom('div', { $color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message' }, template);\n if (cm.openNotification) {\n cm.openNotification(pre, { bottom: true, duration: 5000 });\n }\n else {\n alert(pre.innerText);\n }\n}\nfunction makePrompt(prefix, desc) {\n return dom(document.createDocumentFragment(), dom('span', { $fontFamily: 'monospace', $whiteSpace: 'pre' }, prefix, dom('input', { type: 'text', autocorrect: 'off',\n autocapitalize: 'off', spellcheck: 'false' })), desc && dom('span', { $color: '#888' }, desc));\n}\nfunction showPrompt(cm, options) {\n var template = makePrompt(options.prefix, options.desc);\n if (cm.openDialog) {\n cm.openDialog(template, options.onClose, {\n onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp,\n bottom: true, selectValueOnOpen: false, value: options.value\n });\n }\n else {\n var shortText = '';\n if (typeof options.prefix != \"string\" && options.prefix)\n shortText += options.prefix.textContent;\n if (options.desc)\n shortText += \" \" + options.desc;\n options.onClose(prompt(shortText, ''));\n }\n}\nfunction regexEqual(r1, r2) {\n if (r1 instanceof RegExp && r2 instanceof RegExp) {\n var props = ['global', 'multiline', 'ignoreCase', 'source'];\n for (var i = 0; i < props.length; i++) {\n var prop = props[i];\n if (r1[prop] !== r2[prop]) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\nfunction updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) {\n if (!rawQuery) {\n return;\n }\n var state = getSearchState(cm);\n var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase);\n if (!query) {\n return;\n }\n highlightSearchMatches(cm, query);\n if (regexEqual(query, state.getQuery())) {\n return query;\n }\n state.setQuery(query);\n return query;\n}\nfunction searchOverlay(query) {\n if (query.source.charAt(0) == '^') {\n var matchSol = true;\n }\n return {\n token: function (stream) {\n if (matchSol && !stream.sol()) {\n stream.skipToEnd();\n return;\n }\n var match = stream.match(query, false);\n if (match) {\n if (match[0].length == 0) {\n stream.next();\n return 'searching';\n }\n if (!stream.sol()) {\n stream.backUp(1);\n if (!query.exec(stream.next() + match[0])) {\n stream.next();\n return null;\n }\n }\n stream.match(query);\n return 'searching';\n }\n while (!stream.eol()) {\n stream.next();\n if (stream.match(query, false))\n break;\n }\n },\n query: query\n };\n}\nvar highlightTimeout = 0;\nfunction highlightSearchMatches(cm, query) {\n clearTimeout(highlightTimeout);\n highlightTimeout = setTimeout(function () {\n if (!cm.state.vim)\n return;\n var searchState = getSearchState(cm);\n var overlay = searchState.getOverlay();\n if (!overlay || query != overlay.query) {\n if (overlay) {\n cm.removeOverlay(overlay);\n }\n overlay = searchOverlay(query);\n cm.addOverlay(overlay);\n if (cm.showMatchesOnScrollbar) {\n if (searchState.getScrollbarAnnotate()) {\n searchState.getScrollbarAnnotate().clear();\n }\n searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));\n }\n searchState.setOverlay(overlay);\n }\n }, 50);\n}\nfunction findNext(cm, prev, query, repeat) {\n if (repeat === undefined) {\n repeat = 1;\n }\n return cm.operation(function () {\n var pos = cm.getCursor();\n var cursor = cm.getSearchCursor(query, pos);\n for (var i = 0; i < repeat; i++) {\n var found = cursor.find(prev);\n if (i == 0 && found && cursorEqual(cursor.from(), pos)) {\n var lastEndPos = prev ? cursor.from() : cursor.to();\n found = cursor.find(prev);\n if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) {\n if (cm.getLine(lastEndPos.line).length == lastEndPos.ch)\n found = cursor.find(prev);\n }\n }\n if (!found) {\n cursor = cm.getSearchCursor(query, (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0));\n if (!cursor.find(prev)) {\n return;\n }\n }\n }\n return cursor.from();\n });\n}\nfunction findNextFromAndToInclusive(cm, prev, query, repeat, vim) {\n if (repeat === undefined) {\n repeat = 1;\n }\n return cm.operation(function () {\n var pos = cm.getCursor();\n var cursor = cm.getSearchCursor(query, pos);\n var found = cursor.find(!prev);\n if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) {\n cursor.find(!prev);\n }\n for (var i = 0; i < repeat; i++) {\n found = cursor.find(prev);\n if (!found) {\n cursor = cm.getSearchCursor(query, (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0));\n if (!cursor.find(prev)) {\n return;\n }\n }\n }\n return [cursor.from(), cursor.to()];\n });\n}\nfunction clearSearchHighlight(cm) {\n var state = getSearchState(cm);\n cm.removeOverlay(getSearchState(cm).getOverlay());\n state.setOverlay(null);\n if (state.getScrollbarAnnotate()) {\n state.getScrollbarAnnotate().clear();\n state.setScrollbarAnnotate(null);\n }\n}\nfunction isInRange(pos, start, end) {\n if (typeof pos != 'number') {\n pos = pos.line;\n }\n if (start instanceof Array) {\n return inArray(pos, start);\n }\n else {\n if (typeof end == 'number') {\n return (pos >= start && pos <= end);\n }\n else {\n return pos == start;\n }\n }\n}\nfunction getUserVisibleLines(cm) {\n var renderer = cm.ace.renderer;\n return {\n top: renderer.getFirstFullyVisibleRow(),\n bottom: renderer.getLastFullyVisibleRow()\n };\n}\nfunction getMarkPos(cm, vim, markName) {\n if (markName == '\\'' || markName == '`') {\n return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0);\n }\n else if (markName == '.') {\n return getLastEditPos(cm);\n }\n var mark = vim.marks[markName];\n return mark && mark.find();\n}\nfunction getLastEditPos(cm) {\n var undoManager = cm.ace.session.$undoManager;\n if (undoManager && undoManager.$lastDelta)\n return toCmPos(undoManager.$lastDelta.end);\n}\nvar ExCommandDispatcher = function () {\n this.buildCommandMap_();\n};\nExCommandDispatcher.prototype = {\n processCommand: function (cm, input, opt_params) {\n var that = this;\n cm.operation(function () {\n cm.curOp.isVimOp = true;\n that._processCommand(cm, input, opt_params);\n });\n },\n _processCommand: function (cm, input, opt_params) {\n var vim = cm.state.vim;\n var commandHistoryRegister = vimGlobalState.registerController.getRegister(':');\n var previousCommand = commandHistoryRegister.toString();\n if (vim.visualMode) {\n exitVisualMode(cm);\n }\n var inputStream = new CodeMirror.StringStream(input);\n commandHistoryRegister.setText(input);\n var params = opt_params || {};\n params.input = input;\n try {\n this.parseInput_(cm, inputStream, params);\n }\n catch (e) {\n showConfirm(cm, e.toString());\n throw e;\n }\n var command;\n var commandName;\n if (!params.commandName) {\n if (params.line !== undefined) {\n commandName = 'move';\n }\n }\n else {\n command = this.matchCommand_(params.commandName);\n if (command) {\n commandName = command.name;\n if (command.excludeFromCommandHistory) {\n commandHistoryRegister.setText(previousCommand);\n }\n this.parseCommandArgs_(inputStream, params, command);\n if (command.type == 'exToKey') {\n for (var i = 0; i < command.toKeys.length; i++) {\n vimApi.handleKey(cm, command.toKeys[i], 'mapping');\n }\n return;\n }\n else if (command.type == 'exToEx') {\n this.processCommand(cm, command.toInput);\n return;\n }\n }\n }\n if (!commandName) {\n showConfirm(cm, 'Not an editor command \":' + input + '\"');\n return;\n }\n try {\n exCommands[commandName](cm, params);\n if ((!command || !command.possiblyAsync) && params.callback) {\n params.callback();\n }\n }\n catch (e) {\n showConfirm(cm, e.toString());\n throw e;\n }\n },\n parseInput_: function (cm, inputStream, result) {\n inputStream.eatWhile(':');\n if (inputStream.eat('%')) {\n result.line = cm.firstLine();\n result.lineEnd = cm.lastLine();\n }\n else {\n result.line = this.parseLineSpec_(cm, inputStream);\n if (result.line !== undefined && inputStream.eat(',')) {\n result.lineEnd = this.parseLineSpec_(cm, inputStream);\n }\n }\n var commandMatch = inputStream.match(/^(\\w+|!!|@@|[!#&*<=>@~])/);\n if (commandMatch) {\n result.commandName = commandMatch[1];\n }\n else {\n result.commandName = inputStream.match(/.*/)[0];\n }\n return result;\n },\n parseLineSpec_: function (cm, inputStream) {\n var numberMatch = inputStream.match(/^(\\d+)/);\n if (numberMatch) {\n return parseInt(numberMatch[1], 10) - 1;\n }\n switch (inputStream.next()) {\n case '.':\n return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);\n case '$':\n return this.parseLineSpecOffset_(inputStream, cm.lastLine());\n case '\\'':\n var markName = inputStream.next();\n var markPos = getMarkPos(cm, cm.state.vim, markName);\n if (!markPos)\n throw new Error('Mark not set');\n return this.parseLineSpecOffset_(inputStream, markPos.line);\n case '-':\n case '+':\n inputStream.backUp(1);\n return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);\n default:\n inputStream.backUp(1);\n return undefined;\n }\n },\n parseLineSpecOffset_: function (inputStream, line) {\n var offsetMatch = inputStream.match(/^([+-])?(\\d+)/);\n if (offsetMatch) {\n var offset = parseInt(offsetMatch[2], 10);\n if (offsetMatch[1] == \"-\") {\n line -= offset;\n }\n else {\n line += offset;\n }\n }\n return line;\n },\n parseCommandArgs_: function (inputStream, params, command) {\n if (inputStream.eol()) {\n return;\n }\n params.argString = inputStream.match(/.*/)[0];\n var delim = command.argDelimiter || /\\s+/;\n var args = trim(params.argString).split(delim);\n if (args.length && args[0]) {\n params.args = args;\n }\n },\n matchCommand_: function (commandName) {\n for (var i = commandName.length; i > 0; i--) {\n var prefix = commandName.substring(0, i);\n if (this.commandMap_[prefix]) {\n var command = this.commandMap_[prefix];\n if (command.name.indexOf(commandName) === 0) {\n return command;\n }\n }\n }\n return null;\n },\n buildCommandMap_: function () {\n this.commandMap_ = {};\n for (var i = 0; i < defaultExCommandMap.length; i++) {\n var command = defaultExCommandMap[i];\n var key = command.shortName || command.name;\n this.commandMap_[key] = command;\n }\n },\n map: function (lhs, rhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) {\n throw Error('Mode not supported for ex mappings');\n }\n var commandName = lhs.substring(1);\n if (rhs != ':' && rhs.charAt(0) == ':') {\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToEx',\n toInput: rhs.substring(1),\n user: true\n };\n }\n else {\n this.commandMap_[commandName] = {\n name: commandName,\n type: 'exToKey',\n toKeys: rhs,\n user: true\n };\n }\n }\n else {\n if (rhs != ':' && rhs.charAt(0) == ':') {\n var mapping = {\n keys: lhs,\n type: 'keyToEx',\n exArgs: { input: rhs.substring(1) }\n };\n if (ctx) {\n mapping.context = ctx;\n }\n defaultKeymap.unshift(mapping);\n }\n else {\n var mapping = {\n keys: lhs,\n type: 'keyToKey',\n toKeys: rhs\n };\n if (ctx) {\n mapping.context = ctx;\n }\n defaultKeymap.unshift(mapping);\n }\n }\n },\n unmap: function (lhs, ctx) {\n if (lhs != ':' && lhs.charAt(0) == ':') {\n if (ctx) {\n throw Error('Mode not supported for ex mappings');\n }\n var commandName = lhs.substring(1);\n if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {\n delete this.commandMap_[commandName];\n return true;\n }\n }\n else {\n var keys = lhs;\n for (var i = 0; i < defaultKeymap.length; i++) {\n if (keys == defaultKeymap[i].keys\n && defaultKeymap[i].context === ctx) {\n defaultKeymap.splice(i, 1);\n return true;\n }\n }\n }\n }\n};\nvar exCommands = {\n colorscheme: function (cm, params) {\n if (!params.args || params.args.length < 1) {\n showConfirm(cm, cm.getOption('theme'));\n return;\n }\n cm.setOption('theme', params.args[0]);\n },\n map: function (cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 2) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx);\n },\n imap: function (cm, params) { this.map(cm, params, 'insert'); },\n nmap: function (cm, params) { this.map(cm, params, 'normal'); },\n vmap: function (cm, params) { this.map(cm, params, 'visual'); },\n unmap: function (cm, params, ctx) {\n var mapArgs = params.args;\n if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) {\n if (cm) {\n showConfirm(cm, 'No such mapping: ' + params.input);\n }\n }\n },\n move: function (cm, params) {\n commandDispatcher.processCommand(cm, cm.state.vim, {\n type: 'motion',\n motion: 'moveToLineOrEdgeOfDocument',\n motionArgs: { forward: false, explicitRepeat: true,\n linewise: true },\n repeatOverride: params.line + 1\n });\n },\n set: function (cm, params) {\n var setArgs = params.args;\n var setCfg = params.setCfg || {};\n if (!setArgs || setArgs.length < 1) {\n if (cm) {\n showConfirm(cm, 'Invalid mapping: ' + params.input);\n }\n return;\n }\n var expr = setArgs[0].split('=');\n var optionName = expr[0];\n var value = expr[1];\n var forceGet = false;\n if (optionName.charAt(optionName.length - 1) == '?') {\n if (value) {\n throw Error('Trailing characters: ' + params.argString);\n }\n optionName = optionName.substring(0, optionName.length - 1);\n forceGet = true;\n }\n if (value === undefined && optionName.substring(0, 2) == 'no') {\n optionName = optionName.substring(2);\n value = false;\n }\n var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean';\n if (optionIsBoolean && value == undefined) {\n value = true;\n }\n if (!optionIsBoolean && value === undefined || forceGet) {\n var oldValue = getOption(optionName, cm, setCfg);\n if (oldValue instanceof Error) {\n showConfirm(cm, oldValue.message);\n }\n else if (oldValue === true || oldValue === false) {\n showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName);\n }\n else {\n showConfirm(cm, ' ' + optionName + '=' + oldValue);\n }\n }\n else {\n var setOptionReturn = setOption(optionName, value, cm, setCfg);\n if (setOptionReturn instanceof Error) {\n showConfirm(cm, setOptionReturn.message);\n }\n }\n },\n setlocal: function (cm, params) {\n params.setCfg = { scope: 'local' };\n this.set(cm, params);\n },\n setglobal: function (cm, params) {\n params.setCfg = { scope: 'global' };\n this.set(cm, params);\n },\n registers: function (cm, params) {\n var regArgs = params.args;\n var registers = vimGlobalState.registerController.registers;\n var regInfo = '----------Registers----------\\n\\n';\n if (!regArgs) {\n for (var registerName in registers) {\n var text = registers[registerName].toString();\n if (text.length) {\n regInfo += '\"' + registerName + ' ' + text + '\\n';\n }\n }\n }\n else {\n var registerName;\n regArgs = regArgs.join('');\n for (var i = 0; i < regArgs.length; i++) {\n registerName = regArgs.charAt(i);\n if (!vimGlobalState.registerController.isValidRegister(registerName)) {\n continue;\n }\n var register = registers[registerName] || new Register();\n regInfo += '\"' + registerName + ' ' + register.toString() + '\\n';\n }\n }\n showConfirm(cm, regInfo);\n },\n sort: function (cm, params) {\n var reverse, ignoreCase, unique, number, pattern;\n function parseArgs() {\n if (params.argString) {\n var args = new CodeMirror.StringStream(params.argString);\n if (args.eat('!')) {\n reverse = true;\n }\n if (args.eol()) {\n return;\n }\n if (!args.eatSpace()) {\n return 'Invalid arguments';\n }\n var opts = args.match(/([dinuox]+)?\\s*(\\/.+\\/)?\\s*/);\n if (!opts && !args.eol()) {\n return 'Invalid arguments';\n }\n if (opts[1]) {\n ignoreCase = opts[1].indexOf('i') != -1;\n unique = opts[1].indexOf('u') != -1;\n var decimal = opts[1].indexOf('d') != -1 || opts[1].indexOf('n') != -1 && 1;\n var hex = opts[1].indexOf('x') != -1 && 1;\n var octal = opts[1].indexOf('o') != -1 && 1;\n if (decimal + hex + octal > 1) {\n return 'Invalid arguments';\n }\n number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';\n }\n if (opts[2]) {\n pattern = new RegExp(opts[2].substr(1, opts[2].length - 2), ignoreCase ? 'i' : '');\n }\n }\n }\n var err = parseArgs();\n if (err) {\n showConfirm(cm, err + ': ' + params.argString);\n return;\n }\n var lineStart = params.line || cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n if (lineStart == lineEnd) {\n return;\n }\n var curStart = new Pos(lineStart, 0);\n var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd));\n var text = cm.getRange(curStart, curEnd).split('\\n');\n var numberRegex = pattern ? pattern :\n (number == 'decimal') ? /(-?)([\\d]+)/ :\n (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :\n (number == 'octal') ? /([0-7]+)/ : null;\n var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;\n var numPart = [], textPart = [];\n if (number || pattern) {\n for (var i = 0; i < text.length; i++) {\n var matchPart = pattern ? text[i].match(pattern) : null;\n if (matchPart && matchPart[0] != '') {\n numPart.push(matchPart);\n }\n else if (!pattern && numberRegex.exec(text[i])) {\n numPart.push(text[i]);\n }\n else {\n textPart.push(text[i]);\n }\n }\n }\n else {\n textPart = text;\n }\n function compareFn(a, b) {\n if (reverse) {\n var tmp;\n tmp = a;\n a = b;\n b = tmp;\n }\n if (ignoreCase) {\n a = a.toLowerCase();\n b = b.toLowerCase();\n }\n var anum = number && numberRegex.exec(a);\n var bnum = number && numberRegex.exec(b);\n if (!anum) {\n return a < b ? -1 : 1;\n }\n anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix);\n bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);\n return anum - bnum;\n }\n function comparePatternFn(a, b) {\n if (reverse) {\n var tmp;\n tmp = a;\n a = b;\n b = tmp;\n }\n if (ignoreCase) {\n a[0] = a[0].toLowerCase();\n b[0] = b[0].toLowerCase();\n }\n return (a[0] < b[0]) ? -1 : 1;\n }\n numPart.sort(pattern ? comparePatternFn : compareFn);\n if (pattern) {\n for (var i = 0; i < numPart.length; i++) {\n numPart[i] = numPart[i].input;\n }\n }\n else if (!number) {\n textPart.sort(compareFn);\n }\n text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);\n if (unique) { // Remove duplicate lines\n var textOld = text;\n var lastLine;\n text = [];\n for (var i = 0; i < textOld.length; i++) {\n if (textOld[i] != lastLine) {\n text.push(textOld[i]);\n }\n lastLine = textOld[i];\n }\n }\n cm.replaceRange(text.join('\\n'), curStart, curEnd);\n },\n vglobal: function (cm, params) {\n this.global(cm, params);\n },\n global: function (cm, params) {\n var argString = params.argString;\n if (!argString) {\n showConfirm(cm, 'Regular Expression missing from global');\n return;\n }\n var inverted = params.commandName[0] === 'v';\n var lineStart = (params.line !== undefined) ? params.line : cm.firstLine();\n var lineEnd = params.lineEnd || params.line || cm.lastLine();\n var tokens = splitBySlash(argString);\n var regexPart = argString, cmd;\n if (tokens.length) {\n regexPart = tokens[0];\n cmd = tokens.slice(1, tokens.length).join('/');\n }\n if (regexPart) {\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */, true /** smartCase */);\n }\n catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n var query = getSearchState(cm).getQuery();\n var matchedLines = [];\n for (var i = lineStart; i <= lineEnd; i++) {\n var line = cm.getLineHandle(i);\n var matched = query.test(line.text);\n if (matched !== inverted) {\n matchedLines.push(cmd ? line : line.text);\n }\n }\n if (!cmd) {\n showConfirm(cm, matchedLines.join('\\n'));\n return;\n }\n var index = 0;\n var nextCommand = function () {\n if (index < matchedLines.length) {\n var line = matchedLines[index++];\n var lineNum = cm.getLineNumber(line);\n if (lineNum == null) {\n nextCommand();\n return;\n }\n var command = (lineNum + 1) + cmd;\n exCommandDispatcher.processCommand(cm, command, {\n callback: nextCommand\n });\n }\n };\n nextCommand();\n },\n substitute: function (cm, params) {\n if (!cm.getSearchCursor) {\n throw new Error('Search feature not available. Requires searchcursor.js or ' +\n 'any other getSearchCursor implementation.');\n }\n var argString = params.argString;\n var tokens = argString ? splitBySeparator(argString, argString[0]) : [];\n var regexPart, replacePart = '', trailing, flagsPart, count;\n var confirm = false; // Whether to confirm each replace.\n var global = false; // True to replace all instances on a line, false to replace only 1.\n if (tokens.length) {\n regexPart = tokens[0];\n if (getOption('pcre') && regexPart !== '') {\n regexPart = new RegExp(regexPart).source; //normalize not escaped characters\n }\n replacePart = tokens[1];\n if (replacePart !== undefined) {\n if (getOption('pcre')) {\n replacePart = unescapeRegexReplace(replacePart.replace(/([^\\\\])&/g, \"$1$$&\"));\n }\n else {\n replacePart = translateRegexReplace(replacePart);\n }\n vimGlobalState.lastSubstituteReplacePart = replacePart;\n }\n trailing = tokens[2] ? tokens[2].split(' ') : [];\n }\n else {\n if (argString && argString.length) {\n showConfirm(cm, 'Substitutions should be of the form ' +\n ':s/pattern/replace/');\n return;\n }\n }\n if (trailing) {\n flagsPart = trailing[0];\n count = parseInt(trailing[1]);\n if (flagsPart) {\n if (flagsPart.indexOf('c') != -1) {\n confirm = true;\n }\n if (flagsPart.indexOf('g') != -1) {\n global = true;\n }\n if (getOption('pcre')) {\n regexPart = regexPart + '/' + flagsPart;\n }\n else {\n regexPart = regexPart.replace(/\\//g, \"\\\\/\") + '/' + flagsPart;\n }\n }\n }\n if (regexPart) {\n try {\n updateSearchQuery(cm, regexPart, true /** ignoreCase */, true /** smartCase */);\n }\n catch (e) {\n showConfirm(cm, 'Invalid regex: ' + regexPart);\n return;\n }\n }\n replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart;\n if (replacePart === undefined) {\n showConfirm(cm, 'No previous substitute regular expression');\n return;\n }\n var state = getSearchState(cm);\n var query = state.getQuery();\n var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;\n var lineEnd = params.lineEnd || lineStart;\n if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {\n lineEnd = Infinity;\n }\n if (count) {\n lineStart = lineEnd;\n lineEnd = lineStart + count - 1;\n }\n var startPos = clipCursorToContent(cm, new Pos(lineStart, 0));\n var cursor = cm.getSearchCursor(query, startPos);\n doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);\n },\n redo: CodeMirror.commands.redo,\n undo: CodeMirror.commands.undo,\n write: function (cm) {\n if (CodeMirror.commands.save) {\n CodeMirror.commands.save(cm);\n }\n else if (cm.save) {\n cm.save();\n }\n },\n nohlsearch: function (cm) {\n clearSearchHighlight(cm);\n },\n yank: function (cm) {\n var cur = copyCursor(cm.getCursor());\n var line = cur.line;\n var lineText = cm.getLine(line);\n vimGlobalState.registerController.pushText('0', 'yank', lineText, true, true);\n },\n delmarks: function (cm, params) {\n if (!params.argString || !trim(params.argString)) {\n showConfirm(cm, 'Argument required');\n return;\n }\n var state = cm.state.vim;\n var stream = new CodeMirror.StringStream(trim(params.argString));\n while (!stream.eol()) {\n stream.eatSpace();\n var count = stream.pos;\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n var sym = stream.next();\n if (stream.match('-', true)) {\n if (!stream.match(/[a-zA-Z]/, false)) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n var startMark = sym;\n var finishMark = stream.next();\n if (isLowerCase(startMark) && isLowerCase(finishMark) ||\n isUpperCase(startMark) && isUpperCase(finishMark)) {\n var start = startMark.charCodeAt(0);\n var finish = finishMark.charCodeAt(0);\n if (start >= finish) {\n showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));\n return;\n }\n for (var j = 0; j <= finish - start; j++) {\n var mark = String.fromCharCode(start + j);\n delete state.marks[mark];\n }\n }\n else {\n showConfirm(cm, 'Invalid argument: ' + startMark + '-');\n return;\n }\n }\n else {\n delete state.marks[sym];\n }\n }\n }\n};\nvar exCommandDispatcher = new ExCommandDispatcher();\nfunction doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, replaceWith, callback) {\n cm.state.vim.exMode = true;\n var done = false;\n var lastPos, modifiedLineNumber, joined;\n function replaceAll() {\n cm.operation(function () {\n while (!done) {\n replace();\n next();\n }\n stop();\n });\n }\n function replace() {\n var text = cm.getRange(searchCursor.from(), searchCursor.to());\n var newText = text.replace(query, replaceWith);\n var unmodifiedLineNumber = searchCursor.to().line;\n searchCursor.replace(newText);\n modifiedLineNumber = searchCursor.to().line;\n lineEnd += modifiedLineNumber - unmodifiedLineNumber;\n joined = modifiedLineNumber < unmodifiedLineNumber;\n }\n function findNextValidMatch() {\n var lastMatchTo = lastPos && copyCursor(searchCursor.to());\n var match = searchCursor.findNext();\n if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) {\n match = searchCursor.findNext();\n }\n return match;\n }\n function next() {\n while (findNextValidMatch() &&\n isInRange(searchCursor.from(), lineStart, lineEnd)) {\n if (!global && searchCursor.from().line == modifiedLineNumber && !joined) {\n continue;\n }\n cm.scrollIntoView(searchCursor.from(), 30);\n cm.setSelection(searchCursor.from(), searchCursor.to());\n lastPos = searchCursor.from();\n done = false;\n return;\n }\n done = true;\n }\n function stop(close) {\n if (close) {\n close();\n }\n cm.focus();\n if (lastPos) {\n cm.setCursor(lastPos);\n var vim = cm.state.vim;\n vim.exMode = false;\n vim.lastHPos = vim.lastHSPos = lastPos.ch;\n }\n if (callback) {\n callback();\n }\n }\n function onPromptKeyDown(e, _value, close) {\n CodeMirror.e_stop(e);\n var keyName = CodeMirror.keyName(e);\n switch (keyName) {\n case 'Y':\n replace();\n next();\n break;\n case 'N':\n next();\n break;\n case 'A':\n var savedCallback = callback;\n callback = undefined;\n cm.operation(replaceAll);\n callback = savedCallback;\n break;\n case 'L':\n replace();\n case 'Q':\n case 'Esc':\n case 'Ctrl-C':\n case 'Ctrl-[':\n stop(close);\n break;\n }\n if (done) {\n stop(close);\n }\n return true;\n }\n next();\n if (done) {\n showConfirm(cm, 'No matches for ' + query.source);\n return;\n }\n if (!confirm) {\n replaceAll();\n if (callback) {\n callback();\n }\n return;\n }\n showPrompt(cm, {\n prefix: dom('span', 'replace with ', dom('strong', replaceWith), ' (y/n/a/q/l)'),\n onKeyDown: onPromptKeyDown\n });\n}\nCodeMirror.keyMap.vim = {\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n};\nfunction exitInsertMode(cm) {\n var vim = cm.state.vim;\n var macroModeState = vimGlobalState.macroModeState;\n var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');\n var isPlaying = macroModeState.isPlaying;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!isPlaying) {\n cm.off('change', onChange);\n CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);\n }\n if (!isPlaying && vim.insertModeRepeat > 1) {\n repeatLastEdit(cm, vim, vim.insertModeRepeat - 1, true /** repeatForInsert */);\n vim.lastEditInputState.repeatOverride = vim.insertModeRepeat;\n }\n delete vim.insertModeRepeat;\n vim.insertMode = false;\n cm.setCursor(cm.getCursor().line, cm.getCursor().ch - 1);\n cm.setOption('keyMap', 'vim');\n cm.setOption('disableInput', true);\n cm.toggleOverwrite(false); // exit replace mode if we were in it.\n insertModeChangeRegister.setText(lastChange.changes.join(''));\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"normal\" });\n if (macroModeState.isRecording) {\n logInsertModeChange(macroModeState);\n }\n}\nfunction _mapCommand(command) {\n defaultKeymap.unshift(command);\n}\nfunction mapCommand(keys, type, name, args, extra) {\n var command = { keys: keys, type: type };\n command[type] = name;\n command[type + \"Args\"] = args;\n for (var key in extra)\n command[key] = extra[key];\n _mapCommand(command);\n}\ndefineOption('insertModeEscKeysTimeout', 200, 'number');\nCodeMirror.keyMap['vim-insert'] = {\n fallthrough: ['default'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n};\nCodeMirror.keyMap['vim-replace'] = {\n 'Backspace': 'goCharLeft',\n fallthrough: ['vim-insert'],\n attach: attachVimMap,\n detach: detachVimMap,\n call: cmKey\n};\nfunction executeMacroRegister(cm, vim, macroModeState, registerName) {\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (registerName == ':') {\n if (register.keyBuffer[0]) {\n exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);\n }\n macroModeState.isPlaying = false;\n return;\n }\n var keyBuffer = register.keyBuffer;\n var imc = 0;\n macroModeState.isPlaying = true;\n macroModeState.replaySearchQueries = register.searchQueries.slice(0);\n for (var i = 0; i < keyBuffer.length; i++) {\n var text = keyBuffer[i];\n var match, key;\n while (text) {\n match = (/<\\w+-.+?>|<\\w+>|./).exec(text);\n key = match[0];\n text = text.substring(match.index + key.length);\n vimApi.handleKey(cm, key, 'macro');\n if (vim.insertMode) {\n var changes = register.insertModeChanges[imc++].changes;\n vimGlobalState.macroModeState.lastInsertModeChanges.changes =\n changes;\n repeatInsertModeChanges(cm, changes, 1);\n exitInsertMode(cm);\n }\n }\n }\n macroModeState.isPlaying = false;\n}\nfunction logKey(macroModeState, key) {\n if (macroModeState.isPlaying) {\n return;\n }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register) {\n register.pushText(key);\n }\n}\nfunction logInsertModeChange(macroModeState) {\n if (macroModeState.isPlaying) {\n return;\n }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushInsertModeChanges) {\n register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);\n }\n}\nfunction logSearchQuery(macroModeState, query) {\n if (macroModeState.isPlaying) {\n return;\n }\n var registerName = macroModeState.latestRegister;\n var register = vimGlobalState.registerController.getRegister(registerName);\n if (register && register.pushSearchQuery) {\n register.pushSearchQuery(query);\n }\n}\nfunction onChange(cm, changeObj) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n if (!macroModeState.isPlaying) {\n while (changeObj) {\n lastChange.expectCursorActivityForChange = true;\n if (lastChange.ignoreCount > 1) {\n lastChange.ignoreCount--;\n }\n else if (changeObj.origin == '+input' || changeObj.origin == 'paste'\n || changeObj.origin === undefined /* only in testing */) {\n var selectionCount = cm.listSelections().length;\n if (selectionCount > 1)\n lastChange.ignoreCount = selectionCount;\n var text = changeObj.text.join('\\n');\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n if (text) {\n if (cm.state.overwrite && !/\\n/.test(text)) {\n lastChange.changes.push([text]);\n }\n else {\n lastChange.changes.push(text);\n }\n }\n }\n changeObj = changeObj.next;\n }\n }\n}\nfunction onCursorActivity(cm) {\n var vim = cm.state.vim;\n if (vim.insertMode) {\n var macroModeState = vimGlobalState.macroModeState;\n if (macroModeState.isPlaying) {\n return;\n }\n var lastChange = macroModeState.lastInsertModeChanges;\n if (lastChange.expectCursorActivityForChange) {\n lastChange.expectCursorActivityForChange = false;\n }\n else {\n lastChange.maybeReset = true;\n }\n }\n else if (!cm.curOp.isVimOp) {\n handleExternalSelection(cm, vim);\n }\n}\nfunction handleExternalSelection(cm, vim, keepHPos) {\n var anchor = cm.getCursor('anchor');\n var head = cm.getCursor('head');\n if (vim.visualMode && !cm.somethingSelected()) {\n exitVisualMode(cm, false);\n }\n else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) {\n vim.visualMode = true;\n vim.visualLine = false;\n CodeMirror.signal(cm, \"vim-mode-change\", { mode: \"visual\" });\n }\n if (vim.visualMode) {\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n vim.sel = {\n anchor: anchor,\n head: head\n };\n updateMark(cm, vim, '<', cursorMin(head, anchor));\n updateMark(cm, vim, '>', cursorMax(head, anchor));\n }\n else if (!vim.insertMode && !keepHPos) {\n vim.lastHPos = cm.getCursor().ch;\n }\n}\nfunction InsertModeKey(keyName) {\n this.keyName = keyName;\n}\nfunction onKeyEventTargetKeyDown(e) {\n var macroModeState = vimGlobalState.macroModeState;\n var lastChange = macroModeState.lastInsertModeChanges;\n var keyName = CodeMirror.keyName(e);\n if (!keyName) {\n return;\n }\n function onKeyFound() {\n if (lastChange.maybeReset) {\n lastChange.changes = [];\n lastChange.maybeReset = false;\n }\n lastChange.changes.push(new InsertModeKey(keyName));\n return true;\n }\n if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {\n CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound);\n }\n}\nfunction repeatLastEdit(cm, vim, repeat, repeatForInsert) {\n var macroModeState = vimGlobalState.macroModeState;\n macroModeState.isPlaying = true;\n var isAction = !!vim.lastEditActionCommand;\n var cachedInputState = vim.inputState;\n function repeatCommand() {\n if (isAction) {\n commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);\n }\n else {\n commandDispatcher.evalInput(cm, vim);\n }\n }\n function repeatInsert(repeat) {\n if (macroModeState.lastInsertModeChanges.changes.length > 0) {\n repeat = !vim.lastEditActionCommand ? 1 : repeat;\n var changeObject = macroModeState.lastInsertModeChanges;\n repeatInsertModeChanges(cm, changeObject.changes, repeat);\n }\n }\n vim.inputState = vim.lastEditInputState;\n if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) {\n for (var i = 0; i < repeat; i++) {\n repeatCommand();\n repeatInsert(1);\n }\n }\n else {\n if (!repeatForInsert) {\n repeatCommand();\n }\n repeatInsert(repeat);\n }\n vim.inputState = cachedInputState;\n if (vim.insertMode && !repeatForInsert) {\n exitInsertMode(cm);\n }\n macroModeState.isPlaying = false;\n}\nfunction repeatInsertModeChanges(cm, changes, repeat) {\n function keyHandler(binding) {\n if (typeof binding == 'string') {\n CodeMirror.commands[binding](cm);\n }\n else {\n binding(cm);\n }\n return true;\n }\n var head = cm.getCursor('head');\n var visualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.visualBlock;\n if (visualBlock) {\n selectForInsert(cm, head, visualBlock + 1);\n repeat = cm.listSelections().length;\n cm.setCursor(head);\n }\n for (var i = 0; i < repeat; i++) {\n if (visualBlock) {\n cm.setCursor(offsetCursor(head, i, 0));\n }\n for (var j = 0; j < changes.length; j++) {\n var change = changes[j];\n if (change instanceof InsertModeKey) {\n CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);\n }\n else if (typeof change == \"string\") {\n cm.replaceSelection(change);\n }\n else {\n var start = cm.getCursor();\n var end = offsetCursor(start, 0, change[0].length);\n cm.replaceRange(change[0], start, end);\n cm.setCursor(end);\n }\n }\n }\n if (visualBlock) {\n cm.setCursor(offsetCursor(head, 0, 1));\n }\n}\nresetVimGlobalState();\nCodeMirror.Vim = vimApi;\nvar specialKey = { 'return': 'CR', backspace: 'BS', 'delete': 'Del', esc: 'Esc',\n left: 'Left', right: 'Right', up: 'Up', down: 'Down', space: 'Space', insert: 'Ins',\n home: 'Home', end: 'End', pageup: 'PageUp', pagedown: 'PageDown', enter: 'CR'\n};\nfunction lookupKey(hashId, key, e) {\n if (key.length > 1 && key[0] == \"n\") {\n key = key.replace(\"numpad\", \"\");\n }\n key = specialKey[key] || key;\n var name = '';\n if (e.ctrlKey) {\n name += 'C-';\n }\n if (e.altKey) {\n name += 'A-';\n }\n if ((name || key.length > 1) && e.shiftKey) {\n name += 'S-';\n }\n name += key;\n if (name.length > 1) {\n name = '<' + name + '>';\n }\n return name;\n}\nvar handleKey = vimApi.handleKey.bind(vimApi);\nvimApi.handleKey = function (cm, key, origin) {\n return cm.operation(function () {\n return handleKey(cm, key, origin);\n }, true);\n};\nfunction cloneVimState(state) {\n var n = new state.constructor();\n Object.keys(state).forEach(function (key) {\n var o = state[key];\n if (Array.isArray(o))\n o = o.slice();\n else if (o && typeof o == \"object\" && o.constructor != Object)\n o = cloneVimState(o);\n n[key] = o;\n });\n if (state.sel) {\n n.sel = {\n head: state.sel.head && copyCursor(state.sel.head),\n anchor: state.sel.anchor && copyCursor(state.sel.anchor)\n };\n }\n return n;\n}\nfunction multiSelectHandleKey(cm, key, origin) {\n var isHandled = false;\n var vim = vimApi.maybeInitVimState_(cm);\n var visualBlock = vim.visualBlock || vim.wasInVisualBlock;\n var wasMultiselect = cm.ace.inMultiSelectMode;\n if (vim.wasInVisualBlock && !wasMultiselect) {\n vim.wasInVisualBlock = false;\n }\n else if (wasMultiselect && vim.visualBlock) {\n vim.wasInVisualBlock = true;\n }\n if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect) {\n cm.ace.exitMultiSelectMode();\n }\n else if (visualBlock || !wasMultiselect || cm.ace.inVirtualSelectionMode) {\n isHandled = vimApi.handleKey(cm, key, origin);\n }\n else {\n var old = cloneVimState(vim);\n cm.operation(function () {\n cm.ace.forEachSelection(function () {\n var sel = cm.ace.selection;\n cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn;\n var head = cm.getCursor(\"head\");\n var anchor = cm.getCursor(\"anchor\");\n var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;\n var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;\n head = offsetCursor(head, 0, headOffset);\n anchor = offsetCursor(anchor, 0, anchorOffset);\n cm.state.vim.sel.head = head;\n cm.state.vim.sel.anchor = anchor;\n isHandled = handleKey(cm, key, origin);\n sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos;\n if (cm.virtualSelectionMode()) {\n cm.state.vim = cloneVimState(old);\n }\n });\n if (cm.curOp.cursorActivity && !isHandled)\n cm.curOp.cursorActivity = false;\n }, true);\n }\n if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) {\n handleExternalSelection(cm, vim, true);\n }\n return isHandled;\n}\nexports.CodeMirror = CodeMirror;\nvar getVim = vimApi.maybeInitVimState_;\nexports.handler = {\n $id: \"ace/keyboard/vim\",\n drawCursor: function (element, pixelPos, config, sel, session) {\n var vim = this.state.vim || {};\n var w = config.characterWidth;\n var h = config.lineHeight;\n var top = pixelPos.top;\n var left = pixelPos.left;\n if (!vim.insertMode) {\n var isbackwards = !sel.cursor\n ? session.selection.isBackwards() || session.selection.isEmpty()\n : Range.comparePoints(sel.cursor, sel.start) <= 0;\n if (!isbackwards && left > w)\n left -= w;\n }\n if (!vim.insertMode && vim.status) {\n h = h / 2;\n top += h;\n }\n domLib.translate(element, left, top);\n domLib.setStyle(element.style, \"width\", w + \"px\");\n domLib.setStyle(element.style, \"height\", h + \"px\");\n },\n $getDirectionForHighlight: function (editor) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (!vim.insertMode) {\n return editor.session.selection.isBackwards() || editor.session.selection.isEmpty();\n }\n },\n handleKeyboard: function (data, hashId, key, keyCode, e) {\n var editor = data.editor;\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (keyCode == -1)\n return;\n if (!vim.insertMode) {\n if (hashId == -1) {\n if (key.charCodeAt(0) > 0xFF) {\n if (data.inputKey) {\n key = data.inputKey;\n if (key && data.inputHash == 4)\n key = key.toUpperCase();\n }\n }\n data.inputChar = key;\n }\n else if (hashId == 4 || hashId == 0) {\n if (data.inputKey == key && data.inputHash == hashId && data.inputChar) {\n key = data.inputChar;\n hashId = -1;\n }\n else {\n data.inputChar = null;\n data.inputKey = key;\n data.inputHash = hashId;\n }\n }\n else {\n data.inputChar = data.inputKey = null;\n }\n }\n if (cm.state.overwrite && vim.insertMode && key == \"backspace\" && hashId == 0) {\n return { command: \"gotoleft\" };\n }\n if (key == \"c\" && hashId == 1) { // key == \"ctrl-c\"\n if (!useragent.isMac && editor.getCopyText()) {\n editor.once(\"copy\", function () {\n if (vim.insertMode)\n editor.selection.clearSelection();\n else\n cm.operation(function () { exitVisualMode(cm); });\n });\n return { command: \"null\", passEvent: true };\n }\n }\n if (key == \"esc\" && !vim.insertMode && !vim.visualMode && !cm.ace.inMultiSelectMode) {\n var searchState = getSearchState(cm);\n var overlay = searchState.getOverlay();\n if (overlay)\n cm.removeOverlay(overlay);\n }\n if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) {\n var insertMode = vim.insertMode;\n var name = lookupKey(hashId, key, e || {});\n if (vim.status == null)\n vim.status = \"\";\n var isHandled = multiSelectHandleKey(cm, name, 'user');\n vim = getVim(cm); // may be changed by multiSelectHandleKey\n if (isHandled && vim.status != null)\n vim.status += name;\n else if (vim.status == null)\n vim.status = \"\";\n cm._signal(\"changeStatus\");\n if (!isHandled && (hashId != -1 || insertMode))\n return;\n return { command: \"null\", passEvent: !isHandled };\n }\n },\n attach: function (editor) {\n if (!editor.state)\n editor.state = {};\n var cm = new CodeMirror(editor);\n editor.state.cm = cm;\n editor.$vimModeHandler = this;\n CodeMirror.keyMap.vim.attach(cm);\n getVim(cm).status = null;\n cm.on('vim-command-done', function () {\n if (cm.virtualSelectionMode())\n return;\n getVim(cm).status = null;\n cm.ace._signal(\"changeStatus\");\n cm.ace.session.markUndoGroup();\n });\n cm.on(\"changeStatus\", function () {\n cm.ace.renderer.updateCursor();\n cm.ace._signal(\"changeStatus\");\n });\n cm.on(\"vim-mode-change\", function () {\n if (cm.virtualSelectionMode())\n return;\n updateInputMode();\n cm._signal(\"changeStatus\");\n });\n function updateInputMode() {\n var isIntsert = getVim(cm).insertMode;\n cm.ace.renderer.setStyle(\"normal-mode\", !isIntsert);\n editor.textInput.setCommandMode(!isIntsert);\n editor.renderer.$keepTextAreaAtCursor = isIntsert;\n editor.renderer.$blockCursor = !isIntsert;\n }\n updateInputMode();\n editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm);\n },\n detach: function (editor) {\n var cm = editor.state.cm;\n CodeMirror.keyMap.vim.detach(cm);\n cm.destroy();\n editor.state.cm = null;\n editor.$vimModeHandler = null;\n editor.renderer.$cursorLayer.drawCursor = null;\n editor.renderer.setStyle(\"normal-mode\", false);\n editor.textInput.setCommandMode(false);\n editor.renderer.$keepTextAreaAtCursor = true;\n },\n getStatusText: function (editor) {\n var cm = editor.state.cm;\n var vim = getVim(cm);\n if (vim.insertMode)\n return \"INSERT\";\n var status = \"\";\n if (vim.visualMode) {\n status += \"VISUAL\";\n if (vim.visualLine)\n status += \" LINE\";\n if (vim.visualBlock)\n status += \" BLOCK\";\n }\n if (vim.status)\n status += (status ? \" \" : \"\") + vim.status;\n return status;\n }\n};\nvimApi.defineOption({\n name: \"wrap\",\n set: function (value, cm) {\n if (cm) {\n cm.ace.setOption(\"wrap\", value);\n }\n },\n type: \"boolean\"\n}, false);\nvimApi.defineEx('write', 'w', function () {\n console.log(':write is not implemented');\n});\ndefaultKeymap.push({ keys: 'zc', type: 'action', action: 'fold', actionArgs: { open: false } }, { keys: 'zC', type: 'action', action: 'fold', actionArgs: { open: false, all: true } }, { keys: 'zo', type: 'action', action: 'fold', actionArgs: { open: true } }, { keys: 'zO', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'za', type: 'action', action: 'fold', actionArgs: { toggle: true } }, { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } }, { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorAbove\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorBelow\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorAboveSkipCurrent\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"addCursorBelowSkipCurrent\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectMoreBefore\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectMoreAfter\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectNextBefore\" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: \"selectNextAfter\" } });\ndefaultKeymap.push({\n keys: 'gq',\n type: 'operator',\n operator: 'hardWrap'\n});\nvimApi.defineOperator(\"hardWrap\", function (cm, operatorArgs, ranges, oldAnchor, newHead) {\n var anchor = ranges[0].anchor.line;\n var head = ranges[0].head.line;\n if (operatorArgs.linewise)\n head--;\n hardWrap(cm.ace, { startRow: anchor, endRow: head });\n return Pos(head, 0);\n});\ndefineOption('textwidth', undefined, 'number', ['tw'], function (width, cm) {\n if (cm === undefined) {\n return;\n }\n if (width === undefined) {\n var value = cm.ace.getOption('printMarginColumn');\n return value;\n }\n else {\n var column = Math.round(width);\n if (column > 1) {\n cm.ace.setOption('printMarginColumn', column);\n }\n }\n});\nactions.aceCommand = function (cm, actionArgs, vim) {\n cm.vimCmd = actionArgs;\n if (cm.ace.inVirtualSelectionMode)\n cm.ace.on(\"beforeEndOperation\", delayedExecAceCommand);\n else\n delayedExecAceCommand(null, cm.ace);\n};\nfunction delayedExecAceCommand(op, ace) {\n ace.off(\"beforeEndOperation\", delayedExecAceCommand);\n var cmd = ace.state.cm.vimCmd;\n if (cmd) {\n ace.execCommand(cmd.exec ? cmd : cmd.name, cmd.args);\n }\n ace.curOp = ace.prevOp;\n}\nactions.fold = function (cm, actionArgs, vim) {\n cm.ace.execCommand(['toggleFoldWidget', 'toggleFoldWidget', 'foldOther', 'unfoldall'\n ][(actionArgs.all ? 2 : 0) + (actionArgs.open ? 1 : 0)]);\n};\nexports.handler.defaultKeymap = defaultKeymap;\nexports.handler.actions = actions;\nexports.Vim = vimApi;\n\n}); (function() {\n ace.require([\"ace/keyboard/vim\"], function(m) {\n if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n module.exports = m;\n }\n });\n })();\n "],"mappings":"qEAAA,IAAAA,GAAAC,GAAA,CAAAC,GAAAC,KAAA,KAAI,OAAO,mBAAmB,CAAC,UAAU,UAAU,SAAS,YAAY,aAAa,YAAY,EAAG,SAASC,EAASF,EAASC,GAAO,CAAC,aACvI,IAAIE,GAAQD,EAAQ,UAAU,EAAE,MAChC,SAASE,EAASC,GAAQC,EAAS,CAM/B,QALIC,EAAMD,EAAQ,QAAUD,GAAO,UAAU,mBAAmB,EAC5DG,GAAaF,EAAQ,YAAc,GACnCG,EAAM,KAAK,IAAIH,EAAQ,SAAU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AgB+K,EAChC/K,EAAQ,QAAQ,QAAUwM,GAC1BxM,EAAQ,IAAM+L,CAEd,CAAC,GAAmB,UAAW,CACX,IAAI,QAAQ,CAAC,kBAAkB,EAAG,SAASpI,EAAG,CACtC,OAAO1D,IAAU,UAAY,OAAOD,IAAW,UAAYC,KAC3DA,GAAO,QAAU0D,EAEzB,CAAC,CACL,GAAG","names":["require_c1ef58663e7326fe623bed35be305efd","__commonJSMin","exports","module","require","Range","hardWrap","editor","options","max","allowMerge","row","endRow","session","line","space","findSpace","indentation","nextLine","trimmedLine","trimmedNextLine","mergedLine","replaceRange","min","before","after","spaceAfter","spaceBefore","start","end","wrapAfterInput","e","cursor","lastDelta","Editor","val","log","d","format","p","x","i","f","EventEmitter","domLib","oop","KEYS","event","Search","useragent","SearchHighlight","multiSelectCommands","TextModeTokenRe","CodeMirror","ace","ch","Pos","name","setter","cm","key","m","cmd","lookupKey","map","handle","found","result","head","o","delta","change","curOp","fn","force","prevOp","op","eventName","handlers","listeners","shouldScroll","sel","pos","toCmPos","ranges","r","primIndex","anchor","toAcePos","range","a","h","isInsert","rowShift","colShift","point","cmp","cmp2","Marker","id","column","bm","increment","unit","amount","goalColumn","renderer","config","screenPos","mode","sc","lh","cw","top","col","query","caseFold","caseSensitive","isRegexp","search","acePos","last","back","text","y","maxHeight","margin","viewMargin","s","optMap","aceOpt","on","highlight","marker","re","v","token","method","index","dir","_","tokenRe","cmPos","StringStream","string","tabSize","match","ok","n","pattern","consume","caseInsensitive","cased","str","substr","inner","dialogDiv","template","bottom","wrap","dialog","closeNotification","newVal","callback","closed","me","close","inp","button","doneTimer","duration","transformCursor","vim","updateSelectionForSurrogateCharacters","curStart","curEnd","charCode","defaultKeymap","defaultKeymapLength","defaultExCommandMap","enterVimMode","onCursorActivity","maybeInitVimState","getOnPasteFn","leaveVimMode","highlightTimeout","detachVimMap","next","attachVimMap","prev","cmKey","vimKey","cmKeyToVimKey","vimApi","modifiers","specialKeys","pieces","lastPiece","hasCharacter","piece","isUpperCase","offsetCursor","actions","numberRegex","wordCharTest","bigWordCharTest","makeKeyRange","size","keys","upperCaseAlphabet","lowerCaseAlphabet","numbers","validMarks","validRegisters","upperCaseChars","isLine","isLowerCase","k","isMatchableSymbol","isNumber","isWhiteSpaceString","isEndOfSentenceSymbol","inArray","arr","defineOption","defaultValue","type","aliases","setOption","value","cfg","option","scope","getOption","local","createCircularJumpList","pointer","tail","buffer","add","oldCur","newCur","current","curMark","useNextSlot","trashMark","markPos","cursorEqual","move","offset","mark","inc","find","oldPointer","createInsertModeChanges","c","MacroModeState","macroModeState","vimGlobalState","registerName","register","dom","InputState","resetVimGlobalState","RegisterController","HistoryController","optionName","lastInsertModeKeyTimer","InsertModeKey","lhs","rhs","ctx","exCommandDispatcher","toCtxArray","ctxsToMap","actualLength","origLength","mapping","newMapping","mappedCtxs","el","userKeymap","contexts","j","prefix","func","exCommands","origin","command","multiSelectHandleKey","handleMacroRecording","clearInputState","logKey","handleEsc","exitVisualMode","exitInsertMode","doKeyToKey","handleKeyInsertMode","keysAreChars","commandDispatcher","thisMatch","selections","here","handleKeyNonInsertMode","keysMatcher","context","mainKey","input","defineMotion","defineAction","defineOperator","mapCommand","_mapCommand","defineRegister","repeat","reason","Register","linewise","blockwise","changes","registers","operator","append","up","historyBuffer","element","keyMap","inputState","matches","commandMatches","bestMatch","character","lastChar","copyArgs","updateCmSelection","visualMode","operatorMotionArgs","repeatIsExplicit","actionArgs","forward","wholeWordOnly","getSearchState","promptPrefix","originalQuery","originalScrollPos","handleQuery","ignoreCase","smartCase","updateSearchQuery","showConfirm","onPromptClose","logSearchQuery","onPromptKeyUp","keyName","parsedQuery","findNext","clearSearchHighlight","onPromptKeyDown","showPrompt","word","expandWordUnderCursor","isKeyword","escapeRegex","motion","motionArgs","operatorArgs","origHead","copyCursor","clipCursorToContent","origAnchor","oldHead","oldAnchor","newHead","newAnchor","motionResult","motions","jumpList","cachedCursor","recordJumpPosition","updateMark","cursorIsBefore","lastSel","lineOffset","chOffset","cmSel","cursorMin","cursorMax","newPositions","makeCmSelection","lineLength","tmp","expandSelectionToLine","clipToLine","exclusive","operatorMoveTo","operators","actionCommand","_head","getUserVisibleLines","findFirstNonWhiteSpaceCharacter","_cm","cur","state","highlightSearchMatches","prevInputState","findNextFromAndToInclusive","from","to","getMarkPos","best","isWrongDirection","equal","between","cursorIsBetween","endCh","first","moveToEol","fold","res","lastCharCoords","goalCoords","resCoords","findParagraph","findSentence","scrollbox","orig","dest","moveToWord","moveToCharacter","recordLastCharacterSearch","findSymbol","moveToColumn","lineText","symbol","style","matched","lineNum","mirroredPairs","selfPaired","inclusive","selectCompanionObject","findBeginningAndEnd","expandTagUnderCursor","content","getSentence","expandSelection","lastSearch","fillArray","times","args","finalHead","replacement","lastState","prevLineEnd","wasLastLine","startLine","endLine","_args","swapped","toLower","toSwap","endPos","lineHeight","newPos","cursorCoords","newBottom","charCoords","height","lineLastCharPos","lineLastCharCoords","executeMacroRegister","insertAt","newPosition","getLastEditPos","onChange","onKeyEventTargetKeyDown","selectForInsert","_actionArgs","lastSelection","updateLastSelection","finalCh","nextStartCh","curFinalPos","newlineFn","_this","whitespaceLength","tabs","spaces","currentLine","indent","chompedText","wasChomped","firstIndent","wspace","newIndent","quotient","curPosFinal","idx","lastSelectionCurEnd","selectedArea","getSelectedAreaRange","selectionStart","selectionEnd","selectedText","emptyStrings","selectBlock","lastCh","extendLineToColumn","repeatFn","markName","replaceWith","replaceTo","replaceWithStr","lineStr","numberStr","baseStr","digits","base","number","zeroPadding","lastEditInputState","repeatLastEdit","includeLineBreak","maxCh","direction","ret","prop","offsetLine","offsetCh","partial","full","commandMatch","pressed","mapped","prefixLen","pressedPrefix","mappedPrefix","selectedCharacter","cur1","cur2","cur3","cur1before2","cur2before3","trim","isClipped","curHead","getIndex","wasClipped","firstLine","lastLine","baseCh","headCh","newDir","lineHead","atAnchor","atHead","getCurrentSelectedAreaRange","getLastSelectedAreaRange","block","width","headOffset","anchorOffset","fromCh","toCh","primary","getHead","moveHead","selection","lines","firstNonWS","_forward","bigWord","noSymbol","test","wordEnd","wordStart","tags","symbolToMode","findSymbolModes","symb","curCh","init","isComplete","lineLen","findWord","emptyLineIsWord","charTests","stop","foundWord","words","eodCh","shortCircuit","firstWord","lastWord","keepHPos","retval","charIdxInLine","includeChar","isEmpty","isBoundary","any","skipFold","foldLine","startState","nextChar","curr","ln","lastSentencePos","reverse","curr_index","last_valid","skip_empty_lines","bracketRegexp","openSym","curChar","chars","len","firstIndex","SearchState","overlay","reversed","annotate","splitBySlash","argString","splitBySeparator","findUnescapedSlashes","findUnescapedSeparators","separator","slashes","tokens","escapeNextChar","translateRegex","specials","unescape","out","specialComesNext","charUnescapes","translateRegexReplace","unescapes","unescapeRegexReplace","stream","output","matcher","parseQuery","lastSearchRegister","regexPart","forceIgnoreCase","flagsPart","regexp","pre","makePrompt","desc","shortText","regexEqual","r1","r2","props","rawQuery","searchOverlay","matchSol","searchState","lastEndPos","isInRange","undoManager","ExCommandDispatcher","opt_params","that","commandHistoryRegister","previousCommand","inputStream","params","commandName","numberMatch","offsetMatch","delim","mapArgs","setArgs","setCfg","expr","forceGet","optionIsBoolean","oldValue","setOptionReturn","regArgs","regInfo","unique","parseArgs","opts","decimal","hex","octal","err","lineStart","lineEnd","radix","numPart","textPart","matchPart","compareFn","b","anum","bnum","comparePatternFn","textOld","inverted","matchedLines","nextCommand","replacePart","trailing","count","confirm","global","startPos","doReplace","sym","startMark","finishMark","finish","searchCursor","done","lastPos","modifiedLineNumber","joined","replaceAll","replace","newText","unmodifiedLineNumber","findNextValidMatch","lastMatchTo","_value","savedCallback","insertModeChangeRegister","isPlaying","lastChange","logInsertModeChange","extra","keyBuffer","imc","repeatInsertModeChanges","changeObj","selectionCount","handleExternalSelection","onKeyFound","repeatForInsert","isAction","cachedInputState","repeatCommand","repeatInsert","changeObject","keyHandler","binding","visualBlock","specialKey","hashId","handleKey","cloneVimState","isHandled","wasMultiselect","old","getVim","pixelPos","w","left","isbackwards","data","keyCode","insertMode","updateInputMode","isIntsert","status","delayedExecAceCommand"],"sourceRoot":"","file":"c1ef58663e7326fe623bed35be305efd.js"}